임산물현황 완료일거에요.

This commit is contained in:
주우성
2025-06-16 14:07:05 +09:00
parent 3ac0e7b0dd
commit c9085a6e91
14 changed files with 433 additions and 86 deletions

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<div layout:fragment="content" th:classappend="'mypage-wrap'">
<main id="content" role="main">
<div class="inner">
<hgroup class="tit-group">
<h3>
이번달의 <br>
<strong>은행 자동이체 내역 입력 현황</strong>을
확인하세요.
</h3>
</hgroup>
<ul class="product-col-list">
<li>
<a href="">
<p class="list-tit">수입</p>
<span class="tag">미등록</span>
</a>
</li>
<li class="complete">
<a href="">
<p class="list-tit">지출</p>
<span class="tag">등록완료</span>
</a>
</li>
</ul>
</div>
</main>
</div>
<section layout:fragment="script">
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
},
module:{
confirmPopup : null
},
submitted: false,
};
let formControl = {
init(){
}
}
</script>
</section>
</html>

View File

@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org">
<div layout:fragment="content" th:classappend="'mypage-wrap'">
<main id="content" role="main">
<div class="inner">
<hgroup class="tit-group">
<h3>
이번달의 <br>
<strong>은행 자동이체 내역 입력 현황</strong>을
확인하세요.
</h3>
</hgroup>
<ul class="product-col-list">
<li>
<a href="">
<p class="list-tit">수입</p>
<span class="tag">미등록</span>
</a>
</li>
<li class="complete">
<a href="">
<p class="list-tit">지출</p>
<span class="tag">등록완료</span>
</a>
</li>
</ul>
</div>
</main>
</div>
<section layout:fragment="script">
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
},
module:{
confirmPopup : null
},
submitted: false,
};
let formControl = {
init(){
}
}
</script>
</section>
</html>

View File

@@ -16,7 +16,7 @@
<section class="regist-item-area">
<p class="total" style="display: none" id="listHeader"><!-- th:style="${currentList.totalElements == 0 ? 'display:none':''}"-->
<span>총 <strong id="listCount">0</strong>건</span>
<button type="button" class="btn-reset" onclick="formControl.clearAllItems()">
<button type="button" class="btn-reset" onclick="formControl.clearAllItems()" id="clearAllItems">
<i class="ico-reset ico-small" aria-hidden="true"></i>
<span>초기화</span>
</button>
@@ -30,12 +30,12 @@
<span class="btn-txt">추가 등록</span>
</button>
<button type="button" class="btn btn-m btn-link btn-full" th:style="${pastMonthlyInfo != null && currentList.totalElements == 0 ? '':'display:none'}" id="callPastInfoBtn">
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn"> <!-- th:style="${pastMonthlyInfo != null && currentList.totalElements == 0 ? '':'display:none'}"-->
<span class="btn-txt">이전 정보 불러오기</span>
</button>
<div class="component-input align-center" th:style="${currentList.totalElements == 0 ? '':'display:none'}" id="forestProductStatusDiv">
<div class="component-input align-center" id="forestProductStatusDiv"> <!-- th:style="${currentList.totalElements == 0 ? '':'display:none'}"-->
<label class="checkbox-inner">
<input type="checkbox" id="forestProductStatus" name="forestProductStatus" th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
<span class="checkbox-item">
@@ -428,9 +428,12 @@
purposeList: /*[[${purposeList}]]*/ [],
unitList: /*[[${unitList}]]*/ [],
// productList: /*[[${currentList.content}]]*/ [],
productList: [],
productList: /*[[${currentList.content}]]*/[],
pastProductList : /*[[${pastList.content}]]*/ [],
id: /*[[${currentMonthlyInfo.id}]]*/''
id: /*[[${currentMonthlyInfo.id}]]*/'',
currentStatus: /*[[${currentMonthlyInfo.forestProductStatus}]]*/'',
pastStatus: /*[[${pastMonthlyInfo?.forestProductStatus}]]*/'',
editable : /*[[${editable}]]*/,
},
elementRefs: {
noDataCheckbox: document.getElementById("forestProductStatus"),
@@ -447,13 +450,126 @@
init() {
this.cacheElements();
this.bindDecimalLimit();
this.setting();
ajaxUtil._alert('select 초기화/지정 방법?\n 6월의 카운트와 추가등록의 카운터의 차이?\n 신규 작성 이후 재진입시의 로직?\n 일단 저장데이터 뿌리는것은 막아둠',null);
// this.updateLayout();
this.loadingLayout();
// this.checkUsePastData();
// ajaxUtil._alert('select 초기화/지정 방법?\n 6월의 카운트와 추가등록의 카운터의 차이?\n 신규 작성 이후 재진입시의 로직?\n 일단 저장데이터 뿌리는것은 막아둠',null);
},
checkUsePastData(){
etUI.dialog.alert({
title: "이전 정보 불러오기",
message: "이번달 정보를 아직 입력하지 않으셨네요.\n지난달 정보를 불러와 수정하여 등록하시겠어요?\n\n‘예’ 를 선택하시면 지난달 정보를 불러오고\n‘아니오’를 선택하시면 신규 등록이 가능합니다.\n계속 진행하시겠습니까?",
type: "confirm",
dialogType: "confirm",
positiveText:"예",
negativeText:"아니오",
callback: function () {
ENV.data.productList = JSON.parse(JSON.stringify(ENV.data.pastProductList));
ENV.data.productList.forEach(data => productRenderer.addItem(data,true));
formControl.updateLayout();
},
});
},
//모달창
cacheElements() {
ENV.module.modalPopup = document.querySelector(".addPopup").ui;
},
// 스크립트 단순화/고도화 필요.
loadingLayout(){
//아이템 추가 버튼
const addItemBtn = document.getElementById("addItemBtn");
const icon = addItemBtn.querySelector("i");
//이전 데이터 취득 버튼
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
//데이터 없음 버튼
const forestProductStatus = document.getElementById("forestProductStatus");
//등록 완료 버튼
const next = document.getElementById('complateBtn');
const clearAllItems = document.getElementById('clearAllItems');
if(ENV.data.pastProductList.length == 0) {
callPastInfoBtn.disabled = true;
}
if(ENV.data.editable) {
if (ENV.data.currentStatus == "NONE") {
if(ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastProductList.length > 0){
this.checkUsePastData();
}
} else if (ENV.data.currentStatus == "NOTHING") {
addItemBtn.disabled = true;
icon.classList.toggle("ico-add", false);
icon.classList.toggle("ico-add-disabled", true);
callPastInfoBtn.disabled = true;
forestProductStatus.checked = true;
next.disabled = true;
} else if (ENV.data.currentStatus == "REGISTERED") {
if(ENV.data.productList.length > 0) {
ENV.data.productList.forEach(data => productRenderer.addItem(data,true));
this.updateLayout();
} else {
}
}
} else {
if (ENV.data.currentStatus == "REGISTERED") {
if(ENV.data.productList.length > 0) {
ENV.data.productList.forEach(data => productRenderer.addItem(data,false));
const header = document.getElementById('listHeader');
const count = document.getElementById('listCount');
const total = ENV.data.productList.length;
header.style.display = total > 0 ? '' : 'none';
count.textContent = total;
}
}
addItemBtn.disabled = true;
icon.classList.toggle("ico-add", false);
icon.classList.toggle("ico-add-disabled", true);
callPastInfoBtn.disabled = true;
forestProductStatus.disabled = true;
next.disabled = true;
next.style.display="none";
clearAllItems.style.display = "none";
}
},
updateLayout() {
const isChecked = ENV.elementRefs.noDataCheckbox.checked;
const btn = document.getElementById("addItemBtn");
const icon = btn.querySelector("i");
const status = document.getElementById('forestProductStatusDiv');
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
const next = document.getElementById('complateBtn');
const header = document.getElementById('listHeader');
const count = document.getElementById('listCount');
const total = ENV.data.productList.length;
header.style.display = total > 0 ? '' : 'none';
status.style.display = total > 0 ? 'none' : '';
callPastInfoBtn.style.display = total > 0 ? 'none' : '';
count.textContent = total;
btn.disabled = isChecked;
icon.classList.toggle("ico-add", !isChecked);
icon.classList.toggle("ico-add-disabled", isChecked);
if(isChecked) {
next.disabled = !isChecked;
} else {
next.disabled = total <= 0;
}
},
//숫자입력
bindDecimalLimit() {
document.addEventListener("DOMContentLoaded", () => {
@@ -471,9 +587,9 @@
},
setting(){
if(ENV.data.productList.length > 0) {
ENV.data.productList.forEach(data => productRenderer.addItem(data));
ENV.data.productList.forEach(data => productRenderer.addItem(data,true));
}
this.updateListHeader();
this.updateLayout();
},
pastMonthlyDataPopup(){
//pastProductList 출력하면도미.
@@ -488,14 +604,19 @@
},
//등록없음 버튼
handleNoDataToggle() {
this.updateListHeader();
if(!ENV.data.editable && ENV.data.currentStatus == "NOTHING") {
ENV.elementRefs.noDataCheckbox.checked = true;
return;
}
this.updateLayout();
},
// 등록폼 추가
openAddForm() {
const modalContent = document.querySelector('.modal-content');
setTimeout(() => { modalContent.scrollTop = 0; }, 0);
//초기화 안됨
['landTypeSelect', 'mainYieldUnitCodeSelect', 'mainSaleUnitCodeSelect', 'subYieldUnitCodeSelect', 'subSaleUnitCodeSelect']
.forEach(id => etUI.components.SelectBox().core.init(document.getElementById(id)));
@@ -544,7 +665,7 @@
else ENV.data.productList.push(product);
ENV.module.modalPopup.close();
setTimeout(() => productRenderer.addItem(product), 300);
setTimeout(() => productRenderer.addItem(product,true), 300);
},
// 선택 아이템 수정 (폼 노출)
editItemById(id) {
@@ -573,7 +694,7 @@
ENV.data.productList = ENV.data.productList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove();
this.updateListHeader();
this.updateLayout();
},
// 전체 초기화
clearAllItems() {
@@ -583,34 +704,7 @@
// this.updateListHeader();
},
// 아이템 겟수 처리 아이템에 따른 레이아웃 정리
updateListHeader() {
const isChecked = ENV.elementRefs.noDataCheckbox.checked;
const btn = document.getElementById("addItemBtn");
const icon = btn.querySelector("i");
const status = document.getElementById('forestProductStatusDiv');
const next = document.getElementById('complateBtn');
const header = document.getElementById('listHeader');
const count = document.getElementById('listCount');
const total = ENV.data.productList.length;
header.style.display = total > 0 ? '' : 'none';
status.style.display = total > 0 ? 'none' : '';
count.textContent = total;
btn.disabled = isChecked;
icon.classList.toggle("ico-add", !isChecked);
icon.classList.toggle("ico-add-disabled", isChecked);
if(isChecked) {
next.disabled = !isChecked;
} else {
next.disabled = total <= 0;
}
},
// 지목 코드
getPurposeLabel(code) {
const found = ENV.data.purposeList.find(i => i.id === code);
@@ -651,7 +745,7 @@
const productRenderer = {
//화면에 아이템 추가
addItem(product) {
addItem(product, isEdit) {
const listBody = document.getElementById('listBody');
const form = document.getElementById('forestForm');
form.reset();
@@ -689,23 +783,30 @@
tag6 = `<li><p>부생산물 판매량</p><span>${format(product.subSaleAmount)}${getUnit(product.subSaleUnitCode)}</span></li>`;
}
let buttonGroupHtml = '';
if (isEdit) {
buttonGroupHtml = `
<div class="btn-group">
<button type="button" class="delete" onclick="formControl.deleteItemById(${product.id})"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" onclick="formControl.editItemById(${product.id})"><span class="hide-txt">수정</span></button>
</div>
`;
}
const div = document.createElement('div');
div.className = 'list-item';
div.dataset.id = product.id;
div.innerHTML = `
<div class="item-tit-group">
<p class="item-name">${product.cropName} ${tag1}</p>
<div class="btn-group">
<button type="button" class="delete" onclick="formControl.deleteItemById(${product.id})"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" onclick="formControl.editItemById(${product.id})"><span class="hide-txt">수정</span></button>
</div>
${buttonGroupHtml}
</div>
<ul class="detail-list">${tag2}${tag3}${tag4}${tag5}${tag6}</ul>
`;
const existing = listBody.querySelector(`[data-id="${product.id}"]`);
existing ? listBody.replaceChild(div, existing) : listBody.appendChild(div);
formControl.updateListHeader();
formControl.updateLayout();
}
};