diff --git a/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/web/UpdateNoticeController.java b/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/web/UpdateNoticeController.java index 35996152..d296b14d 100644 --- a/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/web/UpdateNoticeController.java +++ b/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/web/UpdateNoticeController.java @@ -43,8 +43,10 @@ class UpdateNoticeController { updateFilePortIn.operate( new UpdateFileCmd( reqVO.getId(), - reqVO.getFileMappingId().stream().map(Long::parseLong).toList(), - FileUploadType.NOTICE) + reqVO.getFileMappingId() != null + ? reqVO.getFileMappingId().stream().map(Long::parseLong).toList() + : List.of(), + FileUploadType.NOTICE) ); updateNoticePortIn.operate( diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoDao.java index d008d48e..75aff5ef 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoDao.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoDao.java @@ -10,19 +10,24 @@ import org.springframework.transaction.annotation.Transactional; @Repository @RequiredArgsConstructor class SaveHouseholdVisitInfoDao implements SaveHouseholdVisitInfoPortOut { - private final SaveHouseholdVisitInfoMapper mapper; + private final SaveHouseholdVisitInfoMapper mapper; - @Override - @Transactional - public void operate(SaveHouseholdVisitInfoCmd cmd) { - if (cmd.getVisitInfoId() != null) { - mapper.findById(cmd.getHouseholdSeq()) - .ifPresentOrElse( - v -> mapper.updateHouseholdVisitInfo(AuditUtil.update(cmd)), - () -> { throw new IllegalArgumentException("방문정보가 없습니다."); } - ); - } else { - mapper.createHouseholdVisitInfo(AuditUtil.create(cmd)); + @Override + @Transactional + public void operate(SaveHouseholdVisitInfoCmd cmd) { + // 답례품 전달 완료일 경우 기존 방문들 중 true → false로 변경 + if (Boolean.TRUE.equals(cmd.getIsGiftSent())) { + mapper.updateGiftSentToFalse(AuditUtil.update(cmd)); + } + + if (cmd.getVisitInfoId() != null) { + mapper.findById(cmd.getHouseholdSeq()) + .ifPresentOrElse(v -> mapper.updateHouseholdVisitInfo(AuditUtil.update(cmd)), + () -> { + throw new IllegalArgumentException("방문정보가 없습니다."); + }); + } else { + mapper.createHouseholdVisitInfo(AuditUtil.create(cmd)); + } } - } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoMapper.java index 294a2f83..e26a152b 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoMapper.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/persistence/SaveHouseholdVisitInfoMapper.java @@ -9,4 +9,6 @@ public interface SaveHouseholdVisitInfoMapper { Optional findById(Long id); void createHouseholdVisitInfo(SaveHouseholdVisitInfoCmd cmd); void updateHouseholdVisitInfo(SaveHouseholdVisitInfoCmd cmd); + void updateGiftSentToFalse(SaveHouseholdVisitInfoCmd cmd); + } diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherDao.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherDao.java index d2e68579..32274c55 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherDao.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherDao.java @@ -67,6 +67,10 @@ public class ResearcherDao implements ResearcherPortOut { @Override @UpdateCommand public Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO) { + if(Boolean.TRUE.equals(reqVO.getIsGiftSent())) { + researcherMapper.updateGiftSentToFalse(reqVO); + } + return researcherMapper.updateVisitHousehold(reqVO); } diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherMapper.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherMapper.java index ad01f66c..809977dc 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherMapper.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/persistence/ResearcherMapper.java @@ -21,6 +21,7 @@ public interface ResearcherMapper { List visitHouseholdList(ResearchersDetailReqVO reqVO); ResearchersHouseholdVisitDto visitHouseholdDetail(Integer id); Long visitHouseholdListCountAll(ResearchersDetailReqVO reqVO); + void updateGiftSentToFalse(ResearchersVisitDetailReqVO reqVO); Integer updateVisitHousehold(ResearchersVisitDetailReqVO reqVO); VisitHouseholdPercentageDto selectVisitHouseholdPercentage(ResearchersDetailReqVO reqVO); Integer visitHouseholdDelete(@Param("selectIds") List selectIds,@Param("deletedBy") String deletedBy); diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java index 0aef8900..9e120802 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java @@ -12,8 +12,9 @@ import java.time.LocalDateTime; @Setter public class ResearchersVisitDetailReqVO extends AuditCommand { private Integer id; + private Long householdSeq; private LocalDate visitDate; private ManagementType managementType; private String content; - private String isGiftSent; + private Boolean isGiftSent; } diff --git a/admin/src/main/resources/mappers/household/CreateResearcherMappingMapper.xml b/admin/src/main/resources/mappers/household/CreateResearcherMappingMapper.xml index 2d5810f8..07dc5eb9 100644 --- a/admin/src/main/resources/mappers/household/CreateResearcherMappingMapper.xml +++ b/admin/src/main/resources/mappers/household/CreateResearcherMappingMapper.xml @@ -28,7 +28,7 @@ ( nextval('researcher_has_household_seq'), - #{researcherSeq}, + #{adminSeq}, #{householdSeq}, ) diff --git a/admin/src/main/resources/mappers/household/GetHouseholdVisitInfosMapper.xml b/admin/src/main/resources/mappers/household/GetHouseholdVisitInfosMapper.xml index f5186220..d7397d73 100644 --- a/admin/src/main/resources/mappers/household/GetHouseholdVisitInfosMapper.xml +++ b/admin/src/main/resources/mappers/household/GetHouseholdVisitInfosMapper.xml @@ -17,6 +17,6 @@ WHERE household_seq = #{householdSeq} AND TO_CHAR(visit_date, 'YYYYMM') = #{recordMonth} AND hv.is_deleted = false - ORDER BY hv.created_at + ORDER BY hv.visit_date \ No newline at end of file diff --git a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml index 4e078b48..b1f2c355 100644 --- a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml +++ b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml @@ -44,6 +44,7 @@ JOIN researcher_has_household rhh ON v.household_seq = rhh.household_seq WHERE TO_CHAR(v.visit_date, 'YYYYMM') = #{cmd.recordMonth} AND rhh.is_deleted = false + AND v.is_deleted = false ) sub WHERE rn <= 2 GROUP BY household_seq diff --git a/admin/src/main/resources/mappers/household/SaveHouseholdVisitInfoMapper.xml b/admin/src/main/resources/mappers/household/SaveHouseholdVisitInfoMapper.xml index b6f15d51..cd9f2cca 100644 --- a/admin/src/main/resources/mappers/household/SaveHouseholdVisitInfoMapper.xml +++ b/admin/src/main/resources/mappers/household/SaveHouseholdVisitInfoMapper.xml @@ -37,6 +37,17 @@ WHERE id = #{visitInfoId} + + /* updateGiftSentToFalse : 동일 household_seq 의 다른 방문 중 전달여부 true → false */ + UPDATE household_visit + SET is_gift_sent = false + WHERE household_seq = #{householdSeq} + AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(TO_DATE(#{visitDate}, 'YYYY-MM-DD'), 'YYYYMM') + AND is_gift_sent = true + AND (#{visitInfoId} IS NULL OR id != #{visitInfoId}) + AND is_deleted = false + + + + /* updateGiftSentToFalse : 동일 household_seq 의 다른 방문 중 전달여부 true → false */ + UPDATE household_visit + SET is_gift_sent = false + WHERE household_seq = #{householdSeq} + AND TO_CHAR(visit_date, 'YYYYMM') = TO_CHAR(#{visitDate}, 'YYYYMM') + AND is_gift_sent = true + AND (#{id} IS NULL OR id != #{id}) + AND is_deleted = false + + update household_visit set visit_date = #{visitDate}, diff --git a/admin/src/main/resources/templates/common/modal-household-mapping.html b/admin/src/main/resources/templates/common/modal-household-mapping.html index 5e250e2a..073890fb 100644 --- a/admin/src/main/resources/templates/common/modal-household-mapping.html +++ b/admin/src/main/resources/templates/common/modal-household-mapping.html @@ -121,7 +121,7 @@ -
+
@@ -133,7 +133,7 @@
- + @@ -215,7 +215,7 @@ `); }); // Pagination 구성하기 - const paging = $('.paging'); + const paging = $('.mapping-paging'); paging.empty(); paging.append( uiUtil.getPagingUI(pageNo, response.size, response.totalPages, @@ -257,6 +257,7 @@ function (response) { if (response === selectedIds.length) { alert('맵핑 완료되었습니다.'); + getHouseholdList(0); } document.querySelector(".modal01").ui.close(); }, diff --git a/admin/src/main/resources/templates/communication/notice/notices.html b/admin/src/main/resources/templates/communication/notice/notices.html index 9d463823..f620d145 100644 --- a/admin/src/main/resources/templates/communication/notice/notices.html +++ b/admin/src/main/resources/templates/communication/notice/notices.html @@ -20,27 +20,21 @@

- 검색필드 + 공지사항

-
- -
-
- -
-
-

- 검색필드 -

-
-
-
- +
+
+ +
+
+
+ +
@@ -48,18 +42,17 @@

- 검색필드 + 노출여부

-
-
diff --git a/admin/src/main/resources/templates/communication/suggestions/{id}.html b/admin/src/main/resources/templates/communication/suggestions/{id}.html index 77298298..78a0e569 100644 --- a/admin/src/main/resources/templates/communication/suggestions/{id}.html +++ b/admin/src/main/resources/templates/communication/suggestions/{id}.html @@ -54,7 +54,7 @@

내용

- +
diff --git a/admin/src/main/resources/templates/households/modal/modal-visit-info.html b/admin/src/main/resources/templates/households/modal/modal-visit-info.html index 5f5f997e..759b0f0d 100644 --- a/admin/src/main/resources/templates/households/modal/modal-visit-info.html +++ b/admin/src/main/resources/templates/households/modal/modal-visit-info.html @@ -36,7 +36,7 @@
+ placeholder="방문일을 입력해주세요" /> 달력 diff --git a/admin/src/main/resources/templates/households/tab/forest-product.html b/admin/src/main/resources/templates/households/tab/forest-product.html index a0f5778d..799922c9 100644 --- a/admin/src/main/resources/templates/households/tab/forest-product.html +++ b/admin/src/main/resources/templates/households/tab/forest-product.html @@ -218,22 +218,21 @@ document.querySelectorAll('input[name="forestRemoveIds"]:checked') ).map(el => Number(el.value)); - const totalRows = document.querySelectorAll('input[name="forestRemoveIds"]').length; - if(checkedIds.length <= 0) { alert("임산물을 선택해주세요."); return } - if (checkedIds.length === totalRows) { - alert("등록내용은 최소 1건이 남아있어야 합니다."); - return; - } - etUI.dialog.confirm({ title: '삭제 안내', message: '선택하신 내용을 삭제하시겠습니까?
삭제한 항목은 복구할 수 없습니다.', positiveCallback: function () { + const totalRows = document.querySelectorAll('.row-class').length; + + if (totalRows - checkedIds.length <= 0) { + alert("등록내용은 최소 1건이 남아 있어야 합니다."); + return; + } removeForestProduct(checkedIds); }, }); diff --git a/admin/src/main/resources/templates/households/tab/household-visit.html b/admin/src/main/resources/templates/households/tab/household-visit.html index 28398083..59b357cc 100644 --- a/admin/src/main/resources/templates/households/tab/household-visit.html +++ b/admin/src/main/resources/templates/households/tab/household-visit.html @@ -13,7 +13,7 @@ -
@@ -54,6 +54,7 @@ const tbody = $('.tab-content.household-visit tbody'); tbody.empty(); + $('#visitAddBtn').toggle(response.length < 2); if(response.length === 0) { tbody.append(`등록이 필요합니다.`); diff --git a/admin/src/main/resources/templates/researcher/detail.html b/admin/src/main/resources/templates/researcher/detail.html index 30c474ec..872f6851 100644 --- a/admin/src/main/resources/templates/researcher/detail.html +++ b/admin/src/main/resources/templates/researcher/detail.html @@ -177,6 +177,12 @@ + +
\ No newline at end of file diff --git a/core/src/main/java/app/module/core/usecase/daily/record/adapters/persistence/DailyRecordDao.java b/core/src/main/java/app/module/core/usecase/daily/record/adapters/persistence/DailyRecordDao.java index f2939121..ccc954ed 100644 --- a/core/src/main/java/app/module/core/usecase/daily/record/adapters/persistence/DailyRecordDao.java +++ b/core/src/main/java/app/module/core/usecase/daily/record/adapters/persistence/DailyRecordDao.java @@ -35,10 +35,15 @@ public class DailyRecordDao implements DailyRecordPortOut { if (detail.getStartDate().getMonth() != detail.getEndDate().getMonth()) { // 종료일의 달이 변경되면 시작일=종료일 처리 detail.setEndDate(detail.getStartDate()); + detail.setEndDay(dailyUtil.getLastDay(detail.getStartDate())); } } detail.setLastDay(dailyUtil.isLastDay(detail.getEndDate())); + if (detail.isLastDay()) { + detail.setEndDay(dailyUtil.getLastDay(detail.getStartDate())); + } + detail.setFarmingOpen(dailyUtil.isFarmingOpen(detail.getGroupNo(), detail.getEndDate())); detail.setRegistrable(dailyUtil.isRegisterPossible(detail.getStartDate(), detail.getEndDate())); detail.setModifiable(dailyUtil.isModifiable(detail.getStartDate(), detail.getEndDate())); diff --git a/core/src/main/resources/sql/data/04_second_open.sql b/core/src/main/resources/sql/data/04_second_open.sql index 9f17b874..bf55a707 100644 --- a/core/src/main/resources/sql/data/04_second_open.sql +++ b/core/src/main/resources/sql/data/04_second_open.sql @@ -91,6 +91,8 @@ DELETE FROM uri WHERE id = 'uri.admin.communication.sms'; -- 문자발송 메뉴 숨기기 -- update uri set show_on_navi = false, updated_at = now(), updated_by = 'INIT_DATA' where id ='uri.admin.communication.sms' ; +-- 은행자동이체 내역 칼럼 타입 크기 변경 +ALTER TABLE public.bank_auto_transfer ALTER COLUMN source_purpose TYPE varchar(100) USING source_purpose::varchar(100); -- ==================================================================================================================== -- 문자 발송 diff --git a/front/src/main/resources/templates/info/bank/banks.html b/front/src/main/resources/templates/info/bank/banks.html index 63f76ae1..ae5991fc 100644 --- a/front/src/main/resources/templates/info/bank/banks.html +++ b/front/src/main/resources/templates/info/bank/banks.html @@ -1,5 +1,5 @@ -
diff --git a/front/src/main/resources/templates/info/bank/input.html b/front/src/main/resources/templates/info/bank/input.html index be9ef383..d6988705 100644 --- a/front/src/main/resources/templates/info/bank/input.html +++ b/front/src/main/resources/templates/info/bank/input.html @@ -204,40 +204,41 @@ const clearAllItems = document.getElementById('clearAllItems'); if (ENV.data.editable) { - if(ENV.data.preEditable && ENV.data.pastBankList.length === 0 && ENV.data.currentMonth >= "202508"){ + if( ENV.data.pastBankList.length === 0) { callPastInfoBtn.disabled = true; - const handlePageShow = function(event) { - if ('sessionStorage' in window && window['sessionStorage'] !== null) { - // history.back으로 돌아온 경우 (navigation.type == 2) - if (event.persisted || (window.performance && window.performance.navigation.type === 2)) { - sessionStorage.removeItem('pastInputAlertShown'); // 플래그 제거 - return; // 알림창 표시하지 않음 - } + if (ENV.data.preEditable && ENV.data.pastBankList.length === 0 && ENV.data.currentMonth >= "202508") { + const handlePageShow = function (event) { + if ('sessionStorage' in window && window['sessionStorage'] !== null) { + // history.back으로 돌아온 경우 (navigation.type == 2) + if (event.persisted || (window.performance && window.performance.navigation.type === 2)) { + sessionStorage.removeItem('pastInputAlertShown'); // 플래그 제거 + return; // 알림창 표시하지 않음 + } - // 페이지가 처음 로드되었거나 새로고침된 경우 (navigation.type == 0 또는 1) - if (event.persisted || (window.performance && window.performance.navigation.type <= 1)) { - kri.isReturn = true; - const hasShownAlert = sessionStorage.getItem('pastInputAlertShown'); - if (!hasShownAlert && ENV.data.pastBankList.length === 0) { - callPastInfoBtn.disabled = true; - etUI.dialog.alert({ - title: '지난달 정보 등록하기', - message: '지난달 정보를 아직 입력하지 않으셨네요.\n정확한 조사를 위해 지난달 정보를 입력해주세요.\n\n확인 버튼을 누르시면 지난달 은행자동이체 내역등록으로 이동합니다.', - type: 'alert', - callback: function() { - sessionStorage.setItem('pastInputAlertShown', 'true'); - location.href = ENV.httpUrl.preMonth + "/" + ENV.data.pastBankId; - }, - }); + // 페이지가 처음 로드되었거나 새로고침된 경우 (navigation.type == 0 또는 1) + if (event.persisted || (window.performance && window.performance.navigation.type <= 1)) { + kri.isReturn = true; + const hasShownAlert = sessionStorage.getItem('pastInputAlertShown'); + if (!hasShownAlert && ENV.data.pastBankList.length === 0) { + etUI.dialog.alert({ + title: '지난달 정보 등록하기', + message: '지난달 정보를 아직 입력하지 않으셨네요.\n정확한 조사를 위해 지난달 정보를 입력해주세요.\n\n확인 버튼을 누르시면 지난달 은행자동이체 내역등록으로 이동합니다.', + type: 'alert', + callback: function () { + sessionStorage.setItem('pastInputAlertShown', 'true'); + location.href = ENV.httpUrl.preMonth + "/" + ENV.data.pastBankId; + }, + }); + } } } - } - }; + }; - // 초기 로드 시 실행 - handlePageShow({ persisted: false, performance: window.performance }); + // 초기 로드 시 실행 + handlePageShow({persisted: false, performance: window.performance}); + } } if (ENV.data.currentStatus == "NONE") { if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.length > 0) { @@ -474,15 +475,30 @@ const field = form.elements.namedItem(key); if (field) { field.value = val; - if(key == 'transferCategoryCode' && val == "code.bank.input.self"){ + if(key === 'transferCategoryCode' && (val === "code.bank.input.self" || val === "code.bank.input.1" || val === "code.bank.input.4")){ document.getElementById(val+"_value").value = product["transferCategory"]; } - if(key == 'unitCode' && val == "code.count.unit.self"){ + if(key === 'unitCode' && val === "code.count.unit.self"){ document.getElementById("unitDiv").style.display = ""; } } }); + if (product.transferCategoryCode === "code.bank.input.self") { + const transferCategoryInput = document.getElementById(product.transferCategoryCode + "_value"); + if (transferCategoryInput) { + transferCategoryInput.value = product.transferCategory || ""; + } + } + + // 단위 입력 필드 표시 여부 처리 + if (product.unitCode === "code.count.unit.self") { + const unitDiv = document.getElementById("unitDiv"); + if (unitDiv) { + unitDiv.style.display = ""; + } + } + ENV.elementRefs.select.cropCodeSelect.setValue(product.cropCode); ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode); ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode); diff --git a/front/src/main/resources/templates/info/main.html b/front/src/main/resources/templates/info/main.html index af85f24e..83bf0bdb 100644 --- a/front/src/main/resources/templates/info/main.html +++ b/front/src/main/resources/templates/info/main.html @@ -1,5 +1,5 @@ - @@ -41,20 +41,18 @@ 최근등록 :
등록된 일계부가 없습니다.
- - +

공지사항

+
- -
diff --git a/front/src/main/resources/templates/info/monthly/monthlys.html b/front/src/main/resources/templates/info/monthly/monthlys.html index b8fffdf1..69478689 100644 --- a/front/src/main/resources/templates/info/monthly/monthlys.html +++ b/front/src/main/resources/templates/info/monthly/monthlys.html @@ -1,5 +1,5 @@ -
diff --git a/front/src/main/resources/templates/info/notice/notices.html b/front/src/main/resources/templates/info/notice/notices.html index a91b045c..855484a1 100644 --- a/front/src/main/resources/templates/info/notice/notices.html +++ b/front/src/main/resources/templates/info/notice/notices.html @@ -1,5 +1,5 @@ -
diff --git a/front/src/main/resources/templates/info/notice/{id}.html b/front/src/main/resources/templates/info/notice/{id}.html index 7bdd7dc0..a56633a6 100644 --- a/front/src/main/resources/templates/info/notice/{id}.html +++ b/front/src/main/resources/templates/info/notice/{id}.html @@ -1,5 +1,5 @@ -
diff --git a/front/src/main/resources/templates/info/user/password.html b/front/src/main/resources/templates/info/user/password.html index e2662a72..c89a2692 100644 --- a/front/src/main/resources/templates/info/user/password.html +++ b/front/src/main/resources/templates/info/user/password.html @@ -1,5 +1,5 @@ - diff --git a/front/src/main/resources/templates/info/user/user.html b/front/src/main/resources/templates/info/user/user.html index b0f3084c..781f2718 100644 --- a/front/src/main/resources/templates/info/user/user.html +++ b/front/src/main/resources/templates/info/user/user.html @@ -61,6 +61,7 @@
    +
  • 선택
  • 02
  • 31
  • 033
  • @@ -135,7 +136,6 @@

-
@@ -150,7 +150,6 @@
-
    @@ -197,7 +196,7 @@
-
@@ -363,66 +362,73 @@ // selectboxInstance1.setValue($('input[name=regionMainCode]').val()); }, confirmPopup() { + //유효성 검사 + const form = document.getElementById('reqForm'); + kri.form.errorInit(form); + const selects = ['tel1', 'phone1', 'regionSubCode', 'regionDetailCode']; + selects.forEach(id => { + const sel = document.getElementById(id); + if (sel && sel.value) form[id].value = sel.value; + }); + + const errors = []; + if (!form.ownerName.value) errors.push({field: 'ownerName', message: '이름을 입력해 주세요.'}); + if (!form.ownerAge.value) errors.push({field: 'ownerAge', message: '연령을 입력해 주세요.'}); + if (form.ownerAge.value < 0 || form.ownerAge.value > 120) errors.push({field: 'ownerAge', message: '연령은 0세이상 120세 이하이어야 합니다.'}); + if (form.tel1.value || form.tel2.value || form.tel3.value) { + if (!form.tel1.value || !form.tel2.value || !form.tel3.value) { + errors.push({ field: 'tel1', message: '가구 연락처를 모두 입력해 주세요.' }); + } else { + const telRegex = /^(0[2-7][0-9]?)$/; // 지역번호 (예: 02, 031, 032 등) + if (!telRegex.test(form.tel1.value)) errors.push({ field: 'tel1', message: '가구 연락처를 입력해주세요' }); // 유효한 지역번호를 선택해 주세요. + if (form.tel2.value.length < 3 || form.tel2.value.length > 4) errors.push({ field: 'tel2', message: '가구 연락처를 입력해주세요.' });// 가구 연락처 중간 자리수는 3~4자리여야 합니다. + if (form.tel3.value.length !== 4) errors.push({ field: 'tel3', message: '가구 연락처를 입력해주세요.' }); // 가구 연락처 마지막 자리수는 4자리여야 합니다. + } + } + if (form.phone1.value || form.phone2.value || form.phone3.value) { + if (form.tel2.value.length === 3) errors.push({ field: 'tel1', message: '핸드폰 번호를 입력해 주세요.' }); + if (form.tel2.value.length < 3 || form.tel2.value.length > 4) errors.push({ field: 'tel2', message: '핸드폰 번호를 입력해 주세요.' }); + if (form.tel3.value.length !== 4) errors.push({ field: 'tel3', message: '핸드폰 번호를 입력해 주세요.' }); + } + if (!form.phone1.value ||!form.phone2.value || !form.phone3.value) errors.push({field: 'phone1', message: '휴대폰 번호를 입력해 주세요.'}); + if (form.phone1.value.length < 2 || form.phone2.value.length < 3 || form.phone2.value.length > 4 || form.phone3.value.length < 3 || form.phone3.value.length > 4) errors.push({field: 'phone1', message: '휴대폰 번호를 입력해 주세요.'}); + if (!form.regionSubCode.value) errors.push({field: 'regionSubCode', message: '지역을 선택해 주세요.'}); + if (!form.regionDetailCode.value) errors.push({field: 'regionDetailCode', message: '세부 지역를 선택해 주세요.'}); + if (!form.address.value) errors.push({field: 'address', message: '전체 주소를 입력해 주세요.'}); + + kri.form.error(errors); + if (errors.length > 0) return; + // 이름 변경 여부 처리 const currentName = document.querySelector('input[name="ownerName"]').value.trim(); const isNameChanged = currentName !== ENV.initialOwnerName; - - formControl.updateUserInfo(isNameChanged); + if(isNameChanged){ + ENV.module.confirmPopup.open(); + }else { + formControl.updateUserInfo(); + } }, confirmPopupOk() { ENV.module.confirmPopup.close(); - - setTimeout(() => { - ajaxUtil._alert('개인정보 변경이 완료되었습니다.', null, () => { - location.href = '/info'; - }); - }, 500); + formControl.updateUserInfo(); }, - updateUserInfo(showPopupIfValidNameChanged = false) { - + updateUserInfo() { const f = document.reqForm; - // // TODO 어쩔수 없이 이렇게 하는데..... 콤포넌트값 핸들링 방법 UX에서 지정하면 수정해야함. - // const tel1Element = document.getElementById('tel1Id'); - // const phone1IdElement = document.getElementById('phone1Id'); - // const regionMainCodeIdElement = document.getElementById('regionMainCodeId'); - // const regionSubCodeIdElement = document.getElementById('regionSubCodeId'); - // if (tel1Element && tel1Element.value) { - // f.tel1.value = tel1Element.value; - // } - // if (phone1IdElement && phone1IdElement.value) { - // f.phone1.value = phone1IdElement.value; - // } - // if (regionMainCodeIdElement && regionMainCodeIdElement.value) { - // f.regionMainCode.value = regionMainCodeIdElement.value; - // } - // if (regionSubCodeIdElement && regionSubCodeIdElement.value) { - // f.regionSubCode.value = regionSubCodeIdElement.value; - // } - f.regionSubCode.value = ENV.select.regionSelect.getParentValue(); f.regionDetailCode.value = ENV.select.regionSelect.getChildValue(); f.tel1.value = ENV.select.selectTel.getValue(); f.phone1.value = ENV.select.selectPhone.getValue(); - - - const obj = $(f).serializeObject(); - console.log(obj) ajaxUtil._ajaxAsync( ENV.httpUrl.user, - obj, + $(f).serializeObject(), function (rstData, status) { if (rstData.code === 'SUCCESS') { // 유효성 검사를 모두 통과한 후 - if (showPopupIfValidNameChanged) { - // 이름이 바뀐 경우만 팝업 - ENV.module.confirmPopup.open(); - } else { - ajaxUtil._alert('개인정보 변경이 완료되었습니다.', null, () => { - location.href = '/info'; - }); - } + ajaxUtil._alert('개인정보 변경이 완료되었습니다.', null, () => { + location.href = '/info'; + }); } else if (rstData.code === 'ERROR') { ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null); } diff --git a/front/src/main/resources/templates/layout/layout-error.html b/front/src/main/resources/templates/layout/layout-error.html index 9be74fac..867f5a37 100644 --- a/front/src/main/resources/templates/layout/layout-error.html +++ b/front/src/main/resources/templates/layout/layout-error.html @@ -23,7 +23,7 @@ body, html {height: 100%; font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;} #wrap {height: 100%;} .error-wrap {padding-top: 120px;} - .error-wrap main {display: flex; flex-direction: column; width: 310px; margin: 0 auto; padding-top: 88px; background:url('../../assets/images/common/ico_nodata.svg') center top / 64px no-repeat;} + .error-wrap main {display: flex; flex-direction: column; width: 310px; margin: 0 auto; padding-top: 88px; background:url('/static/assets/images/common/ico_nodata.svg') center top / 64px no-repeat;} .info-msg {display: flex; flex-direction: column; align-items: center;} .info-msg strong {display: block; font-size: 24px; font-weight: 700; color: #212529; line-height: 140%; text-align: center;} .info-msg span {display: block; margin-top: 8px; font-size: 15px; font-weight: 400; color: #495057; line-height: 140%; text-align: center;} diff --git a/front/src/main/resources/templates/layout/layout-subar.html b/front/src/main/resources/templates/layout/layout-subar.html deleted file mode 100644 index 0f987a7c..00000000 --- a/front/src/main/resources/templates/layout/layout-subar.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - -
- -
- -
- page content -
- -
-
- -
- -
-
- - -
-
- - - - -
- -
- - -