Merge branch 'dev' into bo_daily

This commit is contained in:
김현주
2025-07-01 09:20:23 +09:00
21 changed files with 445 additions and 263 deletions

4
.gitignore vendored
View File

@@ -39,3 +39,7 @@ META-INF
.jpd .jpd
*.log *.log
front/src/main/resources/static/kri_appimg.png
front/src/main/resources/static/kri_favicon.ico
front/src/main/resources/static/manifest.json
front/web/WEB-INF/web.xml

View File

@@ -155,11 +155,12 @@ InitAdminData, InitUriFrontData 등 *ApplicationRunner* 구현체에서 내용
다음 기능은 Ajax를 통해 REST API(JSON)를 호출합니다 다음 기능은 Ajax를 통해 REST API(JSON)를 호출합니다
| 기능 | 메서드 | URI | 예시 | | 기능 | 메서드 | URI | 예시 |
|------------|------------|------------------------------------|------------------------| |----------|----------|------------------------------------|------------------------|
| 목록 조회 | GET | `/api/{resource-name}/list` | `/api/articles/list` | | 목록 조회 | GET | `/api/{resource-name}/list` | `/api/articles/list` |
| 등록 | POST | `/api/{resource-name}/create` | `/api/articles/create` | | 등록 | POST | `/api/{resource-name}/create` | `/api/articles/create` |
| 수정 | PUT/PATCH | `/api/{resource-name}/update` | `/api/articles/update` | | 수정 | PUT/PATCH | `/api/{resource-name}/update` | `/api/articles/update` |
| 삭제 | DELETE | `/api/{resource-name}/remove` | `/api/articles/remove` | | 삭제 | DELETE | `/api/{resource-name}/remove` | `/api/articles/remove` |
| 등록 & 수정 |POST | `/api/{resource-name}/save` | `/api/articles/save` |
- #### 🖥️ 서버 렌더링 방식 (SSR) - #### 🖥️ 서버 렌더링 방식 (SSR)

View File

@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@@ -42,6 +43,7 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
@Transactional @Transactional
public ExcelUploadResultVO operate(MultipartFile file) throws IOException { public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
// 엑셀 파일 읽기 // 엑셀 파일 읽기
Workbook workbook = WorkbookFactory.create(file.getInputStream()); Workbook workbook = WorkbookFactory.create(file.getInputStream());
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
Integer success = 0; Integer success = 0;
@@ -52,6 +54,7 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
List<UICodeElement> IndustryLargeCodeList = uiCodeListMapper.findByParentId("code.industry.large"); List<UICodeElement> IndustryLargeCodeList = uiCodeListMapper.findByParentId("code.industry.large");
List<UICodeElement> IndustryMiddleCodeList = uiCodeListMapper.findByParentId("code.industry.middle"); List<UICodeElement> IndustryMiddleCodeList = uiCodeListMapper.findByParentId("code.industry.middle");
List<String> errorList = new ArrayList<>();
// 첫 번째 행은 헤더로 간주하고 스킵 // 첫 번째 행은 헤더로 간주하고 스킵
for (int i = 1; i <= sheet.getLastRowNum(); i++) { for (int i = 1; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i); Row row = sheet.getRow(i);
@@ -60,9 +63,9 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
CheckHouseholdNum checkHouseholdNum = checkHouseholdNumMapper.checkHouseholdNum(new CheckHouseholdNumCmd(getCellValue(row.getCell(0)))).orElse(null); CheckHouseholdNum checkHouseholdNum = checkHouseholdNumMapper.checkHouseholdNum(new CheckHouseholdNumCmd(getCellValue(row.getCell(0)))).orElse(null);
ExcelUploadContactVO contactVO = getDivisionContact(row.getCell(3)); ExcelUploadContactVO contactVO = getDivisionContact(row.getCell(3));
// 데이터 누락 warn
if(!checkHouseholdNum.getIsDuplicated() && contactVO != null) { if(!checkHouseholdNum.getIsDuplicated() && contactVO != null) {
int flag = 0;
ExcelCreateHouseholdVO household = new ExcelCreateHouseholdVO(); ExcelCreateHouseholdVO household = new ExcelCreateHouseholdVO();
household.setHouseholdNum(getCellValue(row.getCell(0))); // 임가번호 household.setHouseholdNum(getCellValue(row.getCell(0))); // 임가번호
household.setOwnerName(getCellValue(row.getCell(1))); // 경영주명 household.setOwnerName(getCellValue(row.getCell(1))); // 경영주명
@@ -80,7 +83,7 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
household.setIndustryDetail(getCellValue(row.getCell(11))); // 규모 / 세부품목 household.setIndustryDetail(getCellValue(row.getCell(11))); // 규모 / 세부품목
household.setResearcherSeq(getResearcherSeq(row.getCell(12))); // 조사원 household.setResearcherSeq(getResearcherSeq(row.getCell(12))); // 조사원
household.setIsPanel(getIsPanel(row.getCell(13))); // 유지여부 household.setIsPanel(getIsPanel(row.getCell(13))); // 유지여부
household.setMemo(getCellValue(row.getCell(14))); // 비고
CreateHouseholdOutCmd cmd = new CreateHouseholdOutCmd( CreateHouseholdOutCmd cmd = new CreateHouseholdOutCmd(
null, null,
@@ -100,11 +103,17 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
household.getIndustryDetail(), household.getIndustryDetail(),
household.getResearcherSeq(), household.getResearcherSeq(),
household.getIsPanel(), household.getIsPanel(),
null, household.getMemo(),
List.of("ROLE_GENERAL") List.of("ROLE_GENERAL")
); );
success += createHouseholdMapper.createHousehold(AuditUtil.create(cmd)); flag = createHouseholdMapper.createHousehold(AuditUtil.create(cmd));
success += flag;
if(flag == 0){
errorList.add(household.getHouseholdNum());
}
if(cmd.getRoleIds() != null && !cmd.getRoleIds().isEmpty()) { if(cmd.getRoleIds() != null && !cmd.getRoleIds().isEmpty()) {
createHouseholdMapper.createHouseholdHasRole(AuditUtil.create(new CreateHouseholdHasRoleCmd(cmd.getSeq(), cmd.getRoleIds()))); createHouseholdMapper.createHouseholdHasRole(AuditUtil.create(new CreateHouseholdHasRoleCmd(cmd.getSeq(), cmd.getRoleIds())));
@@ -116,7 +125,7 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
} }
} }
workbook.close(); workbook.close();
return new ExcelUploadResultVO(sheet.getLastRowNum()-1 , success); return new ExcelUploadResultVO(sheet.getLastRowNum()-1 , success, errorList);
} }
// 셀 값을 문자열로 변환 // 셀 값을 문자열로 변환

View File

@@ -24,4 +24,5 @@ public class ExcelCreateHouseholdVO {
private String industryDetail; private String industryDetail;
private Long researcherSeq; private Long researcherSeq;
private Boolean isPanel; private Boolean isPanel;
private String memo;
} }

View File

@@ -4,10 +4,13 @@ import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.List;
@Getter @Getter
@Setter @Setter
@AllArgsConstructor @AllArgsConstructor
public class ExcelUploadResultVO { public class ExcelUploadResultVO {
private Integer total; private Integer total;
private Integer success; private Integer success;
private List<String> errorList;
} }

View File

@@ -13,7 +13,7 @@ public class GetBankAutoTransferExpenseRecords {
private Long id; private Long id;
private String categoryText; private String categoryText;
private String sourcePurpose; private String sourcePurpose;
private Integer count; private String count;
private String unitText; private String unitText;
private Integer price; private Integer price;
} }

View File

@@ -15,7 +15,7 @@ public class GetBankAutoTransferIncomeRecords {
private String categoryText; private String categoryText;
private String target; private String target;
private String sourcePurpose; private String sourcePurpose;
private Integer count; private String count;
private String unitText; private String unitText;
private Integer price; private Integer price;
} }

View File

@@ -42,6 +42,10 @@ server:
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript
# 압축 적용 최소 응답 크기(바이트) # 압축 적용 최소 응답 크기(바이트)
min-response-size: 2048 min-response-size: 2048
servlet:
session:
cookie:
name: ADMIN_SESSION
# ============================================== # ==============================================
# 관리자 관련 설정 # 관리자 관련 설정

View File

@@ -39,17 +39,25 @@
</select> </select>
<select id="countAll" parameterType="app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO" resultType="long"> <select id="countAll" parameterType="app.module.admin.usecase.researcher.adpaters.web.model.ResearchersListReqVO" resultType="long">
select COUNT(a.seq) select COUNT(DISTINCT a.seq)
from admin a from admin a
join admin_has_role ahr ON a.seq = ahr.admin_seq join admin_has_role ahr ON a.seq = ahr.admin_seq AND ahr.is_deleted = false
where left join researcher_has_household rhh ON rhh.admin_seq = a.seq AND rhh.is_deleted = false
ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false left join household h ON h.seq = rhh.household_seq AND h.is_panel IS true AND h.is_deleted = false
where ahr.role_id = 'ROLE_RESEARCHER'
<if test="searchField == '' and searchValue != null and searchValue != ''">
and (a.name LIKE CONCAT('%', #{searchValue}, '%') OR a.phone LIKE CONCAT('%', #{searchValue}, '%'))
</if>
<if test="searchField == 'name' and searchValue != null and searchValue != ''"> <if test="searchField == 'name' and searchValue != null and searchValue != ''">
and a.name LIKE CONCAT('%', #{searchValue}, '%') and a.name LIKE CONCAT('%', #{searchValue}, '%')
</if> </if>
<if test="searchField == 'phone' and searchValue != null and searchValue != ''"> <if test="searchField == 'phone' and searchValue != null and searchValue != ''">
and a.phone LIKE CONCAT('%', #{searchValue}, '%') and a.phone LIKE CONCAT('%', #{searchValue}, '%')
</if> </if>
<if test="searchArea != null and searchArea != ''">
and a.region_main_code = #{searchArea}
</if>
<if test="searchAccountDisabled != null and searchAccountDisabled != ''"> <if test="searchAccountDisabled != null and searchAccountDisabled != ''">
and a.account_disabled = #{searchAccountDisabled} and a.account_disabled = #{searchAccountDisabled}
</if> </if>
@@ -358,7 +366,6 @@
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
</select> </select>
<select id="selectResearcherId"> <select id="selectResearcherId">
select seq select seq
from admin a from admin a

View File

@@ -16,6 +16,7 @@
FROM uicode FROM uicode
WHERE parent_id = #{parentId} WHERE parent_id = #{parentId}
AND is_deleted = false AND is_deleted = false
AND in_use = true
ORDER BY order_no ASC ORDER BY order_no ASC
</select> </select>

View File

@@ -277,7 +277,7 @@ CREATE TABLE household (
owner_name varchar(255) NOT NULL, -- 경영주 이름 owner_name varchar(255) NOT NULL, -- 경영주 이름
owner_age integer NOT NULL, -- 경영주 나이 owner_age integer NOT NULL, -- 경영주 나이
tel varchar(20), -- 유선 전화번호 tel varchar(20), -- 유선 전화번호
phone varchar(255) NOT NULL, -- 휴대폰 번호 phone varchar(255), -- 휴대폰 번호
password varchar(255) NOT NULL, -- 비밀번호 password varchar(255) NOT NULL, -- 비밀번호
region_main_code varchar(255), -- 실사(공통코드) region_main_code varchar(255), -- 실사(공통코드)
region_sub_code varchar(255), -- 지역(공통코드) region_sub_code varchar(255), -- 지역(공통코드)

View File

@@ -14,7 +14,7 @@ public class UpdateUserFrontCmd extends AuditCommand {
private Integer ownerAge; private Integer ownerAge;
private String tel; private String tel;
private String phone; private String phone;
private String regionMainCode;
private String regionSubCode; private String regionSubCode;
private String regionDetailCode;
private String address; private String address;
} }

View File

@@ -42,8 +42,8 @@ class UpdateUserController {
reqVO.getOwnerAge(), reqVO.getOwnerAge(),
reqVO.getTel1() + '-'+ reqVO.getTel2() + '-' + reqVO.getTel3(), reqVO.getTel1() + '-'+ reqVO.getTel2() + '-' + reqVO.getTel3(),
reqVO.getPhone1() + '-'+ reqVO.getPhone2() + '-' + reqVO.getPhone3(), reqVO.getPhone1() + '-'+ reqVO.getPhone2() + '-' + reqVO.getPhone3(),
reqVO.getRegionMainCode(),
reqVO.getRegionSubCode(), reqVO.getRegionSubCode(),
reqVO.getRegionDetailCode(),
reqVO.getAddress() reqVO.getAddress()
)); ));

View File

@@ -1,8 +1,7 @@
package app.module.front.usecase.info.userUI.updateUserUI.adapters.web; package app.module.front.usecase.info.userUI.updateUserUI.adapters.web;
import app.module.core.config.application.enums.UiCodeType;
import app.module.core.config.application.util.CommonUtil; import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn; import app.module.core.usecase.uicode.toptier.ports.UICodeTopTierPortIn;
import app.module.front.usecase.info.userFront.getUserFront.ports.GetUserFrontPortIn; import app.module.front.usecase.info.userFront.getUserFront.ports.GetUserFrontPortIn;
import app.module.front.usecase.info.userFront.getUserFront.ports.application.domain.GetUserFrontCmd; import app.module.front.usecase.info.userFront.getUserFront.ports.application.domain.GetUserFrontCmd;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
@@ -14,12 +13,9 @@ import org.springframework.web.bind.annotation.GetMapping;
@Controller @Controller
@RequiredArgsConstructor @RequiredArgsConstructor
class UpdateUserUIController { class UpdateUserUIController {
private final UICodeTopTierPortIn uiCodeTopTierPortIn;
private final UICodeListPortIn uiCodeListPortIn;
private final GetUserFrontPortIn getUserPortIn; private final GetUserFrontPortIn getUserPortIn;
@GetMapping(path = "/info/user") @GetMapping(path = "/info/user")
String operate(Model model, HttpServletRequest request) { String operate(Model model, HttpServletRequest request) {
@@ -28,9 +24,8 @@ class UpdateUserUIController {
return "redirect:/"; // 요청 처리 중단 return "redirect:/"; // 요청 처리 중단
} }
// 지역 + 세부지역 공통코드
model.addAttribute("regionMainList",uiCodeListPortIn.connect(UiCodeType.REGION_MAIN.getCode())); model.addAttribute("regionSubList", uiCodeTopTierPortIn.connect("code.region.sub"));
model.addAttribute("regionSubList",uiCodeListPortIn.connect(UiCodeType.REGION_SUB.getCode()));
model.addAttribute("userInfo", model.addAttribute("userInfo",
getUserPortIn.operate(new GetUserFrontCmd(CommonUtil.getLoginUsername())).orElseThrow()); getUserPortIn.operate(new GetUserFrontCmd(CommonUtil.getLoginUsername())).orElseThrow());

View File

@@ -38,12 +38,12 @@ public class UpdateUserReqVO {
private String phone3; private String phone3;
@NotBlank(message = "지역을 선택해주세요.")//"시/도는 필수 항목입니다.") @NotBlank(message = "지역을 선택해주세요.")//"시/도는 필수 항목입니다.")
@Pattern(regexp = "^code\\.region\\.main\\.\\d+$", message = "지역을 선택해주세요.")//"시/도 형식이 올바르지 않습니다.") @Pattern(regexp = "^code\\.region\\.sub\\.\\d+$", message = "지역을 선택해주세요.")//"시/도 형식이 올바르지 않습니다.")
private String regionMainCode; private String regionSubCode;
@NotBlank(message = "세부 지역을 선택해주세요.")//"시/군/구는 필수 항목입니다.") @NotBlank(message = "세부 지역을 선택해주세요.")//"시/군/구는 필수 항목입니다.")
@Pattern(regexp = "^code\\.region\\.sub\\.\\d+$", message = "세부 지역을 선택해주세요.")//"시/군/구 형식이 올바르지 않습니다.") @Pattern(regexp = "^code\\.region\\.detail\\.\\d+$", message = "세부 지역을 선택해주세요.")//"시/군/구 형식이 올바르지 않습니다.")
private String regionSubCode; private String regionDetailCode;
@NotBlank(message = "전체 주소를 입력해주세요.")//"주소는 필수 항목입니다.") @NotBlank(message = "전체 주소를 입력해주세요.")//"주소는 필수 항목입니다.")
@Size(max = 255, message = "전체 주소를 입력해주세요.")//"주소는 255자 이하여야 합니다.") @Size(max = 255, message = "전체 주소를 입력해주세요.")//"주소는 255자 이하여야 합니다.")

View File

@@ -92,3 +92,11 @@ logging:
orm: orm:
jdbc: jdbc:
bind: trace # Hibernate SQL 파라미터 바인딩 로깅 bind: trace # Hibernate SQL 파라미터 바인딩 로깅
# ==============================================
# 서버 압축 설정
# ==============================================
server:
servlet:
session:
cookie:
name: FRONT_SESSION

View File

@@ -11,8 +11,8 @@
owner_age = #{ownerAge}, owner_age = #{ownerAge},
tel = #{tel}, tel = #{tel},
phone = #{phone}, phone = #{phone},
region_main_code = #{regionMainCode},
region_sub_code = #{regionSubCode}, region_sub_code = #{regionSubCode},
region_detail_code = #{regionDetailCode},
address = #{address}, address = #{address},
<include refid="common.fields.UpdateBaseSet" /> <include refid="common.fields.UpdateBaseSet" />
WHERE seq = ${seq} WHERE seq = ${seq}

View File

@@ -259,3 +259,92 @@ $(function() {
} }
}) })
}) })
/**
* 공통코드 기반의 2단계 셀렉트박스(부모/자식) UI를 구성하는 함수
*
* @param {Object} codeList - 공통코드 리스트 객체
* @param {string} parentSelector - 부모 셀렉트박스 셀렉터 (ex. '#regionSubCode')
* @param {string} childSelector - 자식 셀렉트박스 셀렉터 (ex. '#regionDetailCode')
* @param {string} selectedParentCode - 초기 선택할 부모 코드값 (ex. 'code.region.sub.31')
* @param {string} selectedChildCode - 초기 선택할 자식 코드값 (ex. 'code.region.detail.9')
*/
kri.form.setSelectBoxUiCode = function({
codeList,
parentSelector,
childSelector,
selectedParentCode = '',
selectedChildCode = ''
}) {
const $parent = $(parentSelector);
const $child = $(childSelector);
if (!codeList?.nodes || !$parent.length || !$child.length) return;
const renderOptions = ($el, list, selected, inputSelector) => {
let html = '';
list.forEach(item => {
const isCurrent = item.id === selected ? 'current' : '';
html += `<li class="option ${isCurrent}" data-value="${item.id}">${item.codeText}</li>`;
});
$el.html(html);
// 항목 클릭 시 hidden input에 값 반영
$el.find('li.option').off('click').on('click', function () {
const value = $(this).data('value');
const text = $(this).text();
// 표시 텍스트 업데이트
$el.closest('.component-select').find('.select-txt').text(text);
// 선택 클래스 처리
$el.find('li.option').removeClass('current');
$(this).addClass('current');
// hidden input 값 반영
$el.closest('.component-select').find('input[data-type="select"]').val(value).trigger('change');
});
};
let childSelectUI = null;
const loadChildren = (parentId, selectedChild = '') => {
if (!parentId) return;
const $childEl = document.querySelector(childSelector);
if($childEl.ui){
$childEl.ui.core.destroy();
}
const parent = codeList.nodes.find(n => n.id === parentId);
if (!parent?.nodes) return;
const $childList = $child.find('ul');
renderOptions($childList, parent.nodes, selectedChild);
childSelectUI = etUI.components.SelectBox();
childSelectUI.core.init($childEl, {})
};
// 초기 렌더링
const $parentList = $parent.find('ul');
renderOptions($parentList, codeList.nodes, selectedParentCode);
const $parentEl = document.querySelector(parentSelector);
const parentSelectUI = new etUI.components.SelectBox();
parentSelectUI.core.init($parentEl, {});
if (selectedParentCode) {
loadChildren(selectedParentCode, selectedChildCode);
}
// 부모 셀렉션 변경 시 자식 재로드
$parent.find('ul').on('click', 'li.option', function () {
const newParentCode = $(this).data('value');
loadChildren(newParentCode);
});
return {
getParentValue: () => parentSelectUI.getValue(),
getChildValue: () => childSelectUI?.getValue() ?? ''
};
}

View File

@@ -48,7 +48,7 @@
<div id="tel1Id" class="component-select bottom-sheet" <div id="tel1Id" class="component-select bottom-sheet"
th:data-props-default="${userInfo.tel1}" data-props-type="bottomSheet"> th:data-props-default="${userInfo.tel1}" data-props-type="bottomSheet">
<input type="hidden" th:field="*{tel1}" data-type="select"> <input type="hidden" name="tel1" th:field="*{tel1}" data-type="select">
<button type="button" class="select-box"> <button type="button" class="select-box">
<span class="select-txt"></span> <span class="select-txt"></span>
</button> </button>
@@ -130,15 +130,15 @@
<div class="select-group"> <div class="select-group">
<div class="select-label"> <div class="select-label">
<p class="label-txt"> <p class="label-txt">
도로명 주소 주소
<i class="ico-required-mark" role="img" aria-label="필수">*</i> <i class="ico-required-mark" role="img" aria-label="필수">*</i>
</p> </p>
</div> </div>
<div id="regionMainCodeId" class="component-select bottom-sheet" data-props-default="지역 선택" <div id="regionSubCodeId" class="component-select bottom-sheet" data-props-default="지역 선택"
data-props-type="bottomSheet"> data-props-type="bottomSheet">
<input type="hidden" name="regionMainCode" data-type="select" th:value="${userInfo.regionMainCode}"> <input type="hidden" name="regionSubCode" data-type="select" th:value="${userInfo.regionSubCode}">
<button type="button" class="select-box"> <button type="button" class="select-box">
<span class="select-txt">선택</span> <span class="select-txt">선택</span>
</button> </button>
@@ -152,12 +152,12 @@
<div class="select-scroll"> <div class="select-scroll">
<ul class=""> <ul class="">
<th:block th:each="item : ${regionMainList}"> <!-- <th:block th:each="item : ${regionMainList}">-->
<li class="option" th:data-value="${item.id}" <!-- <li class="option" th:data-value="${item.id}"-->
th:text="${item.codeText}" <!-- th:text="${item.codeText}"-->
th:classappend="${item.id eq userInfo.regionMainCode ? 'current' : ''}">option1 <!-- th:classappend="${item.id eq userInfo.regionMainCode ? 'current' : ''}">option1-->
</li> <!-- </li>-->
</th:block> <!-- </th:block>-->
</ul> </ul>
</div> </div>
</div> </div>
@@ -167,29 +167,29 @@
<div class="select-group"> <div class="select-group">
<div id="regionSubCodeId" class="component-select bottom-sheet" <div id="regionDetailCodeId" class="component-select bottom-sheet"
data-props-default="세부지역 선택" data-props-type="bottomSheet"> data-props-default="세부 지역 선택" data-props-type="bottomSheet" data-init="false">
<input type="hidden" th:field="*{regionSubCode}" data-type="select"> <!-- <input type="hidden" name="regionDetailCode" data-type="select">-->
<input type="hidden" name="regionDetailCode" th:field="*{regionDetailCode}" data-type="select">
<button type="button" class="select-box"> <button type="button" class="select-box">
<span class="select-txt">선택</span> <span class="select-txt">선택</span>
</button> </button>
<div class="select-options"> <div class="select-options">
<div class="select-header"> <div class="select-header">
<p>세부지역 선택</p> <p>세부 지역 선택</p>
<button type="button" class="select-close"> <button type="button" class="select-close">
<span class="hide-txt">닫기</span> <span class="hide-txt">닫기</span>
</button> </button>
</div> </div>
<div class="select-scroll"> <div class="select-scroll">
<ul class=""> <ul class="">
<th:block th:each="item : ${regionSubList}"> <!-- <th:block th:each="item : ${regionSubList}">-->
<li class="option" th:data-value="${item.id}" <!-- <li class="option" th:data-value="${item.id}"-->
th:text="${item.codeText}" <!-- th:text="${item.codeText}"-->
th:classappend="${item.id eq userInfo.regionSubCode ? 'current' : ''}" <!-- th:classappend="${item.id eq userInfo.regionSubCode ? 'current' : ''}"-->
>option1 <!-- >option1-->
</li> <!-- </li>-->
</th:block> <!-- </th:block>-->
</ul> </ul>
</div> </div>
</div> </div>
@@ -262,6 +262,21 @@
<section layout:fragment="script"> <section layout:fragment="script">
<script th:inline="javascript"> <script th:inline="javascript">
const regionList = [[${regionSubList}]];
const selectedRegionSubCode = /*[[${userInfo.regionSubCode}]]*/ '';
const selectedRegionDetailCode = /*[[${userInfo.regionDetailCode}]]*/ '';
$(document).ready(function () {
// 지역, 세부지역 셀렉트박스 세팅
ENV.select.regionSelect = kri.form.setSelectBoxUiCode({
codeList: regionList,
parentSelector: '#regionSubCodeId',
childSelector: '#regionDetailCodeId',
selectedParentCode: selectedRegionSubCode,
selectedChildCode: selectedRegionDetailCode
});
});
let ENV = { let ENV = {
httpUrl: { httpUrl: {
root: /*[[#{uri.front.info.user.path}]]*/'rootUrl', root: /*[[#{uri.front.info.user.path}]]*/'rootUrl',
@@ -272,10 +287,9 @@
confirmPopup: null confirmPopup: null
}, },
select:{ select:{
select1:null, selectRegion: null,
select2:null, selectTel:null,
select3:null, selectPhone:null
select4:null
}, },
submitted: false, submitted: false,
}; };
@@ -291,45 +305,25 @@
ENV.initialOwnerName = document.querySelector('input[name="ownerName"]').value; ENV.initialOwnerName = document.querySelector('input[name="ownerName"]').value;
}, },
_bindUI() { _bindUI() {
console.log("bind") console.log("bind")
ENV.module.confirmPopup = document.querySelector(".confirmPopup").ui; ENV.module.confirmPopup = document.querySelector(".confirmPopup").ui;
const $select1 = document.querySelector('#regionMainCodeId'); const $selectTel = document.querySelector('#tel1Id');
ENV.select.select1 = new etUI.components.SelectBox(); ENV.select.selectTel = new etUI.components.SelectBox();
ENV.select.select1.core.init($select1, { ENV.select.selectTel.core.init($selectTel, {
selectItemCallback({selectValue, dataValue}){
document.querySelector('#regionMainCode').value = dataValue;
}
});
const $select2 = document.querySelector('#regionSubCodeId');
ENV.select.select2 = new etUI.components.SelectBox();
ENV.select.select2.core.init($select2, {
selectItemCallback({selectValue, dataValue}){
document.querySelector('#regionSubCode').value = dataValue;
}
});
const $select3 = document.querySelector('#tel1Id');
ENV.select.select3 = new etUI.components.SelectBox();
ENV.select.select3.core.init($select3, {
selectItemCallback({selectValue, dataValue}){ selectItemCallback({selectValue, dataValue}){
document.querySelector('#tel1').value = dataValue; document.querySelector('#tel1').value = dataValue;
} }
}); });
const $selectPhone = document.querySelector('#phone1Id');
const $select4 = document.querySelector('#phone1Id'); ENV.select.selectPhone = new etUI.components.SelectBox();
ENV.select.select4 = new etUI.components.SelectBox(); ENV.select.selectPhone.core.init($selectPhone, {
ENV.select.select4.core.init($select4, {
selectItemCallback({selectValue, dataValue}){ selectItemCallback({selectValue, dataValue}){
document.querySelector('#phone1').value = dataValue; document.querySelector('#phone1').value = dataValue;
} }
}); });
// selectboxInstance1.setValue($('input[name=regionMainCode]').val()); // selectboxInstance1.setValue($('input[name=regionMainCode]').val());
}, },
confirmPopup() { confirmPopup() {
@@ -369,10 +363,10 @@
// f.regionSubCode.value = regionSubCodeIdElement.value; // f.regionSubCode.value = regionSubCodeIdElement.value;
// } // }
f.regionMainCode.value = ENV.select.select1.getValue(); f.regionSubCode.value = ENV.select.regionSelect.getParentValue();
f.regionSubCode.value = ENV.select.select2.getValue(); f.regionDetailCode.value = ENV.select.regionSelect.getChildValue();
f.tel1.value = ENV.select.select3.getValue(); f.tel1.value = ENV.select.selectTel.getValue();
f.phone1.value = ENV.select.select4.getValue(); f.phone1.value = ENV.select.selectPhone.getValue();
@@ -389,7 +383,9 @@
// 이름이 바뀐 경우만 팝업 // 이름이 바뀐 경우만 팝업
ENV.module.confirmPopup.open(); ENV.module.confirmPopup.open();
} else { } else {
ajaxUtil._alert('개인정보 변경이 완료되었습니다.', null, () => {
location.href = '/info'; location.href = '/info';
});
} }
} else if (rstData.code === 'ERROR') { } else if (rstData.code === 'ERROR') {
ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null); ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null);

View File

@@ -7,9 +7,10 @@
<div class="component-btns type-tab" <div class="component-btns type-tab"
th:if="not ${detail.updated}"> th:if="not ${detail.updated}">
<div class="btns-row"> <div class="btns-row">
<button type="button" class="btn active">수기 등록</button> <button type="button" class="btn active" onclick="modalControl.changeModal('self')">수기 등록</button>
<!--/* TODO : 2차 오픈 */--> <th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
<!--<button type="button" class="btn">영수증 등록</button>--> <button type="button" class="btn" onclick="modalControl.changeModal('ocr')">영수증 등록</button>
</th:block>
</div> </div>
</div> </div>
@@ -17,6 +18,8 @@
<form name="reqModalForm"> <form name="reqModalForm">
<input type="hidden" name="inputType" th:value="${#strings.defaultString(detail.inputType, 'SELF')}"> <input type="hidden" name="inputType" th:value="${#strings.defaultString(detail.inputType, 'SELF')}">
<input type="hidden" name="id" th:value="${detail.id}"> <input type="hidden" name="id" th:value="${detail.id}">
<!--/* 수기 등록 s */-->
<div id="modelSelf">
<section class="form-group"> <section class="form-group">
<div class="segment-label"> <div class="segment-label">
<p class="label-txt"> <p class="label-txt">
@@ -198,6 +201,58 @@
</button> </button>
</div> </div>
</div> </div>
</div>
<!--/* 수기 등록 e */-->
<!--/* 영수증 등록 s */-->
<div id="modelOcr" style="display: none;">
<section class="form-group">
<div class="segment-label">
<p class="label-txt">
영수증 첨부
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</p>
</div>
<div class="component-segment">
<div class="component-file">
<div class="file-list">
<div class="file-item">
<img class="profile-image-add" src="../../assets/images/acco/file_sample.png" alt="이미지샘플" />
<button type="button" class="btn-delete"><span class="hide-txt">삭제</span></button>
</div>
<div class="file-item">
<img class="profile-image-add" src="../../assets/images/acco/file_sample.png" alt="이미지샘플" />
<button type="button" class="btn-delete"><span class="hide-txt">삭제</span></button>
</div>
<div class="file-item">
<img class="profile-image-add" src="../../assets/images/acco/file_sample.png" alt="이미지샘플" />
<button type="button" class="btn-delete"><span class="hide-txt">삭제</span></button>
</div>
</div>
<button type="button" class="btn btn-m btn-link btn-full">
<i class="ico-add ico-small" aria-hidden="true"></i>
<span class="btn-txt">사진 첨부</span>
</button>
<ul class="guide-info">
<li>영수증은 일일 최대 3개 등록하실 수 있습니다.</li>
<li>
최대 갯수 등록 후에는 수기 입력만 가능합니다. <br>
(사진 1개당 5MB 이하)
</li>
</ul>
</div>
</div>
</section>
<div class="component-btns">
<div class="btns-row">
<!-- 버튼비활성 스타일 속성에 disabled 추가 -->
<button type="button" class="btn btn-full btn-l btn-primary">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</div>
<!--/* 영수증 등록 e */-->
</form> </form>
</div> </div>
</th:block> </th:block>

View File

@@ -239,6 +239,15 @@
$input.val('').attr('disabled', true); $input.val('').attr('disabled', true);
$input.parent().parent().closest('.component-input').addClass('input-disabled'); $input.parent().parent().closest('.component-input').addClass('input-disabled');
}, },
changeModal(type) {
if (type === 'self') {
$('#modelSelf').show();
$('#modelOcr').hide();
} else {
$('#modelSelf').hide();
$('#modelOcr').show();
}
},
createVaild() { createVaild() {
modalControl.create(); modalControl.create();
}, },