[FO] 마이페이지 수정 + [BO] 임가현황 작업 중 ..

This commit is contained in:
kangsunlee
2025-06-23 20:45:53 +09:00
parent 8d604014db
commit e8b2ee1bf1
6 changed files with 195 additions and 67 deletions

View File

@@ -4,8 +4,8 @@
<div class="layer-wrap" th:fragment="modalFragment"> <div class="layer-wrap" th:fragment="modalFragment">
<form autocomplete="off" method="get" name="reqVisitForm"> <form autocomplete="off" method="get" name="reqVisitForm">
<input name="page" value="0" type="hidden"/> <input type="hidden" name="visitInfoId">
<input name="size" value="10" type="hidden"> <input type="hidden" name="householdSeq">
<div class="component-modal mypage-wrap modal01 modal-visit-info" data-props-dimm-click="true" data-state="close"> <div class="component-modal mypage-wrap modal01 modal-visit-info" data-props-dimm-click="true" data-state="close">
<div class="modal-dimm"></div> <div class="modal-dimm"></div>
@@ -90,7 +90,7 @@
<div class="component-btns bottom-btn-group"> <div class="component-btns bottom-btn-group">
<div class="btns-row align-right"> <div class="btns-row align-right">
<button type="button" class="btn btn-primary" onclick=""> <button type="button" class="btn btn-primary" onclick="goVisitInfoSave();">
<span class="btn-txt">등록</span> <span class="btn-txt">등록</span>
</button> </button>
</div> </div>
@@ -106,27 +106,33 @@
</form> </form>
<script th:inline="javascript"> <script th:inline="javascript">
// form 초기화
const resetForm = () => { const resetForm = () => {
const form = document.forms['reqVisitForm']; const form = document.reqVisitForm;
if (!form) return; if (!form) return;
const today = new Date().toISOString().slice(0, 10); form.visitInfoId.value = '';
form.visitDate.value = today;
form.managementType.value = ''; form.managementType.value = '';
form.content.value = ''; form.content.value = '';
document.getElementById('isGiftSent_N').checked = true; document.getElementById('isGiftSent_N').checked = true;
if (datepickerInstance) {
datepickerInstance.setDate(new Date(), { render: true });
}
} }
</script> </script>
<script th:inline="javascript"> <script th:inline="javascript">
// 임가방문정보 모달창 띄우기
const showVisitInfoModal = (id) => { const showVisitInfoModal = (id) => {
document.querySelector(".modal-visit-info").ui.open(); const f = document.reqVisitForm;
resetForm(); resetForm();
if(id != null) { if(id != null) {
f.visitInfoId.value = id;
ajaxUtil._ajaxMethod( ajaxUtil._ajaxMethod(
'/api/visitInfo/' + id, `/api/visitInfo/${id}`,
{}, {},
(response) => { (response) => {
console.log("임가방문정보 상세 응답값 : ", response); console.log("임가방문정보 상세 응답값 : ", response);
@@ -139,21 +145,81 @@
'json' 'json'
); );
} }
document.querySelector(".modal-visit-info").ui.open();
} }
// 임가방문정보 상세 값 set
const setFormData = (data) => { const setFormData = (data) => {
const form = document.forms['reqVisitForm']; const form = document.reqVisitForm;
if (!form) return; if (!form) return;
// 폼에 값 세팅 // 폼에 값 세팅
form.visitDate.value = data.visitDate || '';
form.managementType.value = data.managementType || ''; form.managementType.value = data.managementType || '';
form.content.value = data.content || ''; form.content.value = data.content || '';
// 라디오 버튼 처리 // 라디오 버튼 처리
document.getElementById('isGiftSent_Y').checked = data.isGiftSent === true; document.getElementById('isGiftSent_Y').checked = data.isGiftSent === true;
document.getElementById('isGiftSent_N').checked = data.isGiftSent === false; document.getElementById('isGiftSent_N').checked = data.isGiftSent === false;
// 날짜 세팅
if (datepickerInstance && data.visitDate) {
datepickerInstance.setDate(new Date(data.visitDate), { render: true });
} }
}
</script>
<script>
// 임가방문정보 등록
const goVisitInfoSave = () => {
const f = document.reqVisitForm;
let dataOj = $(f).serializeObject();
console.log("dataOj", dataOj);
// ajaxUtil._ajaxMethod(
// '/api/visitInfo/create',
// JSON.stringify(dataOj),
// (response) => { // 성공
// alert("등록이 완료되었습니다.");
// location.href = '/households';
// },
// function (code, rstData) {
// if(code == 422) alert(rstData.responseText);
// if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
// },
// 'post',
// 'json',
// { handle422Type: 'alert' }
// );
}
</script>
<script>
let datepickerInstance = null;
document.addEventListener('DOMContentLoaded', function () {
const $el = document.querySelector('.component-datepicker');
const datepicker = etUI.components.DatepickerComp();
datepicker.core.init($el, {
dateSelectCallback: function (selectedDate) {
console.log('선택된 날짜:', selectedDate);
}
});
datepickerInstance = datepicker.getDatepickerInstance();
// 초기 상태 오늘 날짜로
if (datepickerInstance) {
datepickerInstance.setDate(new Date(), { render: true });
}
});
$(document).ready(() => {
const reqForm = document.reqForm;
document.reqVisitForm.householdSeq.value = reqForm.householdSeq.value;
});
</script> </script>
</div> </div>
</html> </html>

View File

@@ -618,7 +618,6 @@
<!-- 임가방문정보 모달 --> <!-- 임가방문정보 모달 -->
<div th:replace="households/modal/modal-visit-info :: modalFragment"></div> <div th:replace="households/modal/modal-visit-info :: modalFragment"></div>
</section> </section>
<section layout:fragment="script"> <section layout:fragment="script">

View File

@@ -7,7 +7,7 @@
<div class="inner"> <div class="inner">
<hgroup class="tit-group"> <hgroup class="tit-group">
<h3> <h3>
<strong>은행 자동이체(수입) 내역 <span>[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다. <strong>은행 자동이체(수입) 내역 <span id="totalItems">[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3> </h3>
<p>수입 내역을 등록해 주세요.</p> <p>수입 내역을 등록해 주세요.</p>
</hgroup> </hgroup>
@@ -246,7 +246,7 @@
clearAllItems.style.display = "none"; clearAllItems.style.display = "none";
} }
}, },
openAddForm() { openAddForm(callback) {
ajaxUtil._ajaxAsyncMethod( ajaxUtil._ajaxAsyncMethod(
"/api/front/info/bank/create/input/from", "/api/front/info/bank/create/input/from",
{}, {},
@@ -298,6 +298,9 @@
ENV.module.modalPopup.open(); ENV.module.modalPopup.open();
document.querySelector('.modal-content').scrollTop = 0; document.querySelector('.modal-content').scrollTop = 0;
// 모두 로드된 후 콜백 실행
if (typeof callback === 'function') callback();
}, },
function(code, rstData) { function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData); kri.logger.error('Do nothing. code: '+ code, rstData);
@@ -423,11 +426,9 @@
const product = ENV.data.bankList.find(p => p.id == id); const product = ENV.data.bankList.find(p => p.id == id);
if (!product) return; if (!product) return;
this.openAddForm(); this.openAddForm(() => {
setTimeout(function(){
const form = document.getElementById('popupForm'); const form = document.getElementById('popupForm');
if (!form) return;
Object.entries(product).forEach(([key, val]) => { Object.entries(product).forEach(([key, val]) => {
const field = form.elements.namedItem(key); const field = form.elements.namedItem(key);
@@ -446,20 +447,39 @@
ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode); ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode);
ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode); ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode);
document.getElementById("unit").value = product.unit; document.getElementById("unit").value = product.unit;
});
},100)
}, },
// 선택 아이템 삭제 // 선택 아이템 삭제
deleteItemById(id) { deleteItemById(id) {
etUI.dialog.alert({
title: '삭제 안내',
message: '등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.bankList = ENV.data.bankList.filter(p => p.id != id); ENV.data.bankList = ENV.data.bankList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`); const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove(); if (target) target.remove();
this.updateLayout(); formControl.updateLayout();
},
});
}, },
// 전체 초기화 // 전체 초기화
clearAllItems() { clearAllItems() {
location.reload(); etUI.dialog.alert({
title: '초기화 안내',
message: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.bankList = [];
document.getElementById('listBody').innerHTML = '';
formControl.updateLayout();
// TODO(ks): 선택 삭제 시 전체 count 미반영 중. 일단 전체 초기화에서만 count 갱신.
document.getElementById('totalItems').textContent = ENV.data.bankList.length;
},
});
}, },
goSave() { goSave() {

View File

@@ -7,7 +7,7 @@
<div class="inner"> <div class="inner">
<hgroup class="tit-group"> <hgroup class="tit-group">
<h3> <h3>
<strong>은행 자동이체(지출) 내역 <span>[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다. <strong>은행 자동이체(지출) 내역 <span id="totalItems">[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3> </h3>
<p>지출 내역을 등록해 주세요.</p> <p>지출 내역을 등록해 주세요.</p>
</hgroup> </hgroup>
@@ -245,7 +245,7 @@
clearAllItems.style.display = "none"; clearAllItems.style.display = "none";
} }
}, },
openAddForm() { openAddForm(callback) {
ajaxUtil._ajaxAsyncMethod( ajaxUtil._ajaxAsyncMethod(
"/api/front/info/bank/create/output/from", "/api/front/info/bank/create/output/from",
{}, {},
@@ -289,6 +289,9 @@
ENV.module.modalPopup.open(); ENV.module.modalPopup.open();
document.querySelector('.modal-content').scrollTop = 0; document.querySelector('.modal-content').scrollTop = 0;
// 모두 로드된 후 콜백 실행
if (typeof callback === 'function') callback();
}, },
function(code, rstData) { function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData); kri.logger.error('Do nothing. code: '+ code, rstData);
@@ -417,20 +420,18 @@
const product = ENV.data.bankList.find(p => p.id == id); const product = ENV.data.bankList.find(p => p.id == id);
if (!product) return; if (!product) return;
this.openAddForm(); this.openAddForm(() => {
setTimeout(function(){
const form = document.getElementById('popupForm'); const form = document.getElementById('popupForm');
if (!form) return;
Object.entries(product).forEach(([key, val]) => { Object.entries(product).forEach(([key, val]) => {
const field = form.elements.namedItem(key); const field = form.elements.namedItem(key);
if (field) { if (field) {
field.value = val; field.value = val;
if(key == 'transferCategoryCode' && val == "code.bank.input.self"){ if (key === 'transferCategoryCode' && val === "code.bank.input.self") {
document.getElementById(val + "_value").value = product["transferCategory"]; document.getElementById(val + "_value").value = product["transferCategory"];
} }
if(key == 'unitCode' && val == "code.record.unit.self"){ if (key === 'unitCode' && val === "code.record.unit.self") {
document.getElementById("unitDiv").style.display = ""; document.getElementById("unitDiv").style.display = "";
} }
} }
@@ -439,20 +440,40 @@
ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode); ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode);
ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode); ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode);
document.getElementById("unit").value = product.unit; document.getElementById("unit").value = product.unit;
});
},100)
}, },
// 선택 아이템 삭제 // 선택 아이템 삭제
deleteItemById(id) { deleteItemById(id) {
etUI.dialog.alert({
title: '삭제 안내',
message: '등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.bankList = ENV.data.bankList.filter(p => p.id != id); ENV.data.bankList = ENV.data.bankList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`); const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove(); if (target) target.remove();
this.updateLayout(); formControl.updateLayout();
},
});
}, },
// 전체 초기화 // 전체 초기화
clearAllItems() { clearAllItems() {
location.reload(); etUI.dialog.alert({
title: '초기화 안내',
message: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.bankList = [];
document.getElementById('listBody').innerHTML = '';
formControl.updateLayout();
// TODO(ks): 선택 삭제 시 전체 count 미반영 중. 일단 전체 초기화에서만 count 갱신.
document.getElementById('totalItems').textContent = ENV.data.bankList.length;
},
});
}, },
goSave() { goSave() {

View File

@@ -8,7 +8,7 @@
<hgroup class="tit-group"> <hgroup class="tit-group">
<h3> <h3>
[[${currentMonthlyInfo.koreanMonth}]]의 <br> [[${currentMonthlyInfo.koreanMonth}]]의 <br>
<strong>임산물 현황 <span>[[${currentList.totalElements}]]</span>건 등록</strong> 되었습니다. <strong>임산물 현황 <span id="totalItems">[[${currentList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3> </h3>
<p>임산물 현황을 등록해 주세요.</p> <p>임산물 현황을 등록해 주세요.</p>
</hgroup> </hgroup>
@@ -298,7 +298,7 @@
}, },
// 등록폼 추가 // 등록폼 추가
openAddForm() { openAddForm(callback) {
ajaxUtil._ajaxAsyncMethod( ajaxUtil._ajaxAsyncMethod(
"/api/front/info/monthly/create/from", "/api/front/info/monthly/create/from",
@@ -341,6 +341,9 @@
ENV.module.modalPopup.open(); ENV.module.modalPopup.open();
document.querySelector('.modal-content').scrollTop = 0; document.querySelector('.modal-content').scrollTop = 0;
// 모두 로드된 후 콜백 실행
if (typeof callback === 'function') callback();
}, },
function(code, rstData) { function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData); kri.logger.error('Do nothing. code: '+ code, rstData);
@@ -461,11 +464,10 @@
const product = ENV.data.productList.find(p => p.id == id); const product = ENV.data.productList.find(p => p.id == id);
if (!product) return; if (!product) return;
this.openAddForm(); this.openAddForm(() => {
setTimeout(function() {
const form = document.getElementById('forestForm'); const form = document.getElementById('forestForm');
if (!form) return;
Object.entries(product).forEach(([key, val]) => { Object.entries(product).forEach(([key, val]) => {
const field = form.elements.namedItem(key); const field = form.elements.namedItem(key);
if (field) { if (field) {
@@ -485,7 +487,6 @@
} }
}); });
ENV.elementRefs.select.mainYieldUnitCodeSelect.setValue(product.mainYieldUnitCode); ENV.elementRefs.select.mainYieldUnitCodeSelect.setValue(product.mainYieldUnitCode);
ENV.elementRefs.select.mainSaleUnitCodeSelect.setValue(product.mainSaleUnitCode); ENV.elementRefs.select.mainSaleUnitCodeSelect.setValue(product.mainSaleUnitCode);
ENV.elementRefs.select.subYieldUnitCodeSelect.setValue(product.subYieldUnitCode); ENV.elementRefs.select.subYieldUnitCodeSelect.setValue(product.subYieldUnitCode);
@@ -494,23 +495,39 @@
document.getElementById("mainSaleUnit").value = product.mainSaleUnit; document.getElementById("mainSaleUnit").value = product.mainSaleUnit;
document.getElementById("subYieldUnit").value = product.subYieldUnit; document.getElementById("subYieldUnit").value = product.subYieldUnit;
document.getElementById("subSaleUnit").value = product.subSaleUnit; document.getElementById("subSaleUnit").value = product.subSaleUnit;
});
},100);
}, },
// 선택 아이템 삭제 // 선택 아이템 삭제
deleteItemById(id) { deleteItemById(id) {
etUI.dialog.alert({
title: '삭제 안내',
message: '등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.productList = ENV.data.productList.filter(p => p.id != id); ENV.data.productList = ENV.data.productList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`); const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove(); if (target) target.remove();
this.updateLayout(); formControl.updateLayout();
},
});
}, },
// 전체 초기화 // 전체 초기화
clearAllItems() { clearAllItems() {
location.reload(); etUI.dialog.alert({
// ENV.data.productList = []; title: '초기화 안내',
// document.getElementById('listBody').innerHTML = ''; message: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
// this.updateListHeader(); type: 'confirm',
dialogType: 'confirm',
callback: function () {
ENV.data.productList = [];
document.getElementById('listBody').innerHTML = '';
formControl.updateLayout();
// TODO(ks): 선택 삭제 시 전체 count 미반영 중. 일단 전체 초기화에서만 count 갱신.
document.getElementById('totalItems').textContent = ENV.data.productList.length;
},
});
}, },
// 아이템 겟수 처리 아이템에 따른 레이아웃 정리 // 아이템 겟수 처리 아이템에 따른 레이아웃 정리

View File

@@ -20,7 +20,7 @@
</label> </label>
</div> </div>
<div class="input-field"> <div class="input-field">
<input type="text" id="temp_input_0001" placeholder="이름을 입력해 주세요" th:field="*{ownerName}" <input type="text" id="temp_input_0001" placeholder="이름을 입력해 주세요" name="ownerName" th:field="*{ownerName}"
maxlength="10"> maxlength="10">
</div> </div>
</div> </div>
@@ -281,10 +281,6 @@
<section layout:fragment="script"> <section layout:fragment="script">
<script th:inline="javascript"> <script th:inline="javascript">
$(function() {
//formControl.init();
});
let ENV = { let ENV = {
httpUrl: { httpUrl: {
root: /*[[#{uri.front.info.user.path}]]*/'rootUrl', root: /*[[#{uri.front.info.user.path}]]*/'rootUrl',
@@ -311,7 +307,7 @@
},300); },300);
//ajaxUtil._alert('select 010->10으로 노출\n 최초값 지정 및 값 취득 함수 필요\n 개인정보 작성 필요\n 모달 내부 스크롤 기능 추가 필요', null); //ajaxUtil._alert('select 010->10으로 노출\n 최초값 지정 및 값 취득 함수 필요\n 개인정보 작성 필요\n 모달 내부 스크롤 기능 추가 필요', null);
ENV.initialOwnerName = document.querySelector('input[name="ownerName"]').value;
}, },
_bindUI() { _bindUI() {
@@ -356,7 +352,15 @@
// selectboxInstance1.setValue($('input[name=regionMainCode]').val()); // selectboxInstance1.setValue($('input[name=regionMainCode]').val());
}, },
confirmPopup() { confirmPopup() {
const currentName = document.querySelector('input[name="ownerName"]').value;
// 사용자가 이름을 변경했을 경우에만 개인정보 변경 동의서 모달 띄우기
if (currentName !== ENV.initialOwnerName) {
ENV.module.confirmPopup.open(); ENV.module.confirmPopup.open();
} else {
// 이름 그대로면 바로 저장
formControl.updateUserInfo();
}
}, },
confirmPopupOk() { confirmPopupOk() {
ENV.module.confirmPopup.close(); ENV.module.confirmPopup.close();
@@ -406,7 +410,8 @@
* TODO * TODO
* 내정보에서만 들어온다는 가정하에서 back을 하게함 SB에는 내정보로 이동하게 되어 있음. * 내정보에서만 들어온다는 가정하에서 back을 하게함 SB에는 내정보로 이동하게 되어 있음.
*/ */
history.back() // history.back();
location.href = '/info';
}); });
} else if (rstData.code === 'ERROR') { } else if (rstData.code === 'ERROR') {
ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null); ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null);