에러날것임. 소스 보존을 위해
This commit is contained in:
@@ -35,8 +35,7 @@ class GetBankInputUIController {
|
|||||||
|
|
||||||
@GetMapping(path = "/info/bank/create/input/{id}")
|
@GetMapping(path = "/info/bank/create/input/{id}")
|
||||||
String operate(Model model,
|
String operate(Model model,
|
||||||
@PathVariable Long id,
|
@PathVariable Long id) {
|
||||||
@PageableDefault(sort = "createAt", direction = Sort.Direction.DESC, page = 0, size = 100) Pageable pageable) {
|
|
||||||
|
|
||||||
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
|
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
package app.module.front.usecase.info.bankUI.getBankOutputUI.adapters.web;
|
package app.module.front.usecase.info.bankUI.getBankOutputUI.adapters.web;
|
||||||
|
|
||||||
import app.module.core.config.application.enums.MonthStatus;
|
import app.module.core.config.application.enums.MonthStatus;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.front.config.application.util.AuthUtil;
|
import app.module.front.config.application.util.AuthUtil;
|
||||||
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
|
||||||
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
|
||||||
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
|
||||||
import app.module.front.usecase.info.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
|
||||||
import app.module.front.usecase.info.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
|
||||||
import app.module.front.usecase.info.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
import app.module.front.usecase.info.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
|
||||||
|
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortIn;
|
||||||
|
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
|
||||||
|
import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
@@ -17,6 +24,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.YearMonth;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
@@ -25,15 +33,51 @@ import java.util.NoSuchElementException;
|
|||||||
class GetBankOutputUIController {
|
class GetBankOutputUIController {
|
||||||
|
|
||||||
|
|
||||||
private final GetMonthlyInputStatussPortIn portIn;
|
private final GetPrevMonthlyInputStatusPortIn prevMonthlyInputStatusPortIn;
|
||||||
|
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||||
|
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/info/bank/create/output/{id}")
|
@GetMapping(path = "/info/bank/create/output/{id}")
|
||||||
String operate(Model model,
|
String operate(Model model,
|
||||||
@PathVariable Long id,
|
@PathVariable Long id) {
|
||||||
@PageableDefault(sort = "createAt", direction = Sort.Direction.DESC, page = 0, size = 100) Pageable pageable) {
|
|
||||||
|
|
||||||
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
|
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
|
||||||
|
|
||||||
|
|
||||||
|
// 전달 입력 상태 취득 , 데이터가 없을 경우 null
|
||||||
|
// 이전달 입력상태:NONE일 경우도 null
|
||||||
|
|
||||||
|
GetPrevMonthlyInputStatus pastMonthlyInfo =
|
||||||
|
prevMonthlyInputStatusPortIn.operate(
|
||||||
|
new GetPrevMonthlyInputStatusCmd(
|
||||||
|
id, AuthUtil.getUserSeq())).orElse(null);
|
||||||
|
|
||||||
|
//이번달 달 입력 상태 취득
|
||||||
|
GetMonthlyInputStatus currentMonthlyInfo =
|
||||||
|
getMonthlyInputStatusPortIn.operate(
|
||||||
|
new GetMonthlyInputStatusCmd(
|
||||||
|
id, AuthUtil.getUserSeq())).orElse(null);
|
||||||
|
|
||||||
|
//수정 가능 여부 판단
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
||||||
|
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
|
||||||
|
|
||||||
|
LocalDate maxMonth = yearMonth.plusMonths(1).atDay(15);
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
boolean editable = !today.isAfter(maxMonth);
|
||||||
|
|
||||||
|
|
||||||
|
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
|
||||||
|
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
|
||||||
|
|
||||||
|
model.addAttribute("transferCategoryList", uiCodeListPortIn.connect("code.bank.input"));
|
||||||
|
model.addAttribute("codeRecordCropList", uiCodeListPortIn.connect("code.record.crop"));
|
||||||
|
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
|
||||||
|
|
||||||
|
model.addAttribute("MonthStatus", MonthStatus.class);
|
||||||
|
model.addAttribute("editable", editable);
|
||||||
|
|
||||||
return "info/bank/output";
|
return "info/bank/output";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,14 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="component-input align-center" id="forestProductStatusDiv">
|
||||||
|
<label class="checkbox-inner">
|
||||||
|
<input type="checkbox" id="forestProductStatus" name="forestProductStatus"
|
||||||
|
th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
|
||||||
|
<span class="checkbox-item"><span class="checkbox-txt">이번달 등록내용 없음</span></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -45,7 +53,7 @@
|
|||||||
<div class="component-btns fixed">
|
<div class="component-btns fixed">
|
||||||
<div class="btns-row">
|
<div class="btns-row">
|
||||||
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
||||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn">
|
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
||||||
<span class="btn-txt">등록 완료</span>
|
<span class="btn-txt">등록 완료</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -74,7 +82,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-content-inner">
|
<div class="modal-content-inner">
|
||||||
<form id="forestForm">
|
<form id="popupForm">
|
||||||
<input type="hidden" name="id" id="id">
|
<input type="hidden" name="id" id="id">
|
||||||
<input type="hidden" name="transferType" id="transferType">
|
<input type="hidden" name="transferType" id="transferType">
|
||||||
|
|
||||||
@@ -257,7 +265,7 @@
|
|||||||
|
|
||||||
<div class="component-btns">
|
<div class="component-btns">
|
||||||
<div class="btns-row">
|
<div class="btns-row">
|
||||||
<button type="button" class="btn btn-full btn-l btn-primary">
|
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.saveFormData()">
|
||||||
<span class="btn-txt">등록</span>
|
<span class="btn-txt">등록</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -302,7 +310,11 @@
|
|||||||
editable: /*[[${editable}]]*/,
|
editable: /*[[${editable}]]*/,
|
||||||
},
|
},
|
||||||
elementRefs: {
|
elementRefs: {
|
||||||
|
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||||
|
addButton: {
|
||||||
|
button: null,
|
||||||
|
icon: null
|
||||||
|
}
|
||||||
},
|
},
|
||||||
isSubmitted: false
|
isSubmitted: false
|
||||||
};
|
};
|
||||||
@@ -320,7 +332,6 @@
|
|||||||
ENV.module.modalPopup = document.querySelector(".addPopup").ui;
|
ENV.module.modalPopup = document.querySelector(".addPopup").ui;
|
||||||
},
|
},
|
||||||
bindDecimalLimit() {
|
bindDecimalLimit() {
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
|
||||||
document.querySelectorAll(".limitDecimalLength").forEach(input => {
|
document.querySelectorAll(".limitDecimalLength").forEach(input => {
|
||||||
input.addEventListener("input", () => {
|
input.addEventListener("input", () => {
|
||||||
alert('22');
|
alert('22');
|
||||||
@@ -332,24 +343,17 @@
|
|||||||
input.value = parts.join('.');
|
input.value = parts.join('.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
bindAmountLimit() {
|
bindAmountLimit() {
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
|
||||||
document.querySelectorAll(".limitAmountLength").forEach(input => {
|
document.querySelectorAll(".limitAmountLength").forEach(input => {
|
||||||
input.addEventListener("input", () => {
|
input.addEventListener("input", () => {
|
||||||
// 숫자 이외 문자 제거
|
|
||||||
let val = input.value.replace(/[^0-9]/g, '');
|
let val = input.value.replace(/[^0-9]/g, '');
|
||||||
|
|
||||||
// 최대 10자리 제한
|
|
||||||
if (val.length > 10) {
|
if (val.length > 10) {
|
||||||
val = val.slice(0, 10);
|
val = val.slice(0, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
input.value = val;
|
input.value = val;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
loadingLayout() {
|
loadingLayout() {
|
||||||
//아이템 추가 버튼
|
//아이템 추가 버튼
|
||||||
@@ -357,6 +361,10 @@
|
|||||||
const icon = addItemBtn.querySelector("i");
|
const icon = addItemBtn.querySelector("i");
|
||||||
//이전 데이터 취득 버튼
|
//이전 데이터 취득 버튼
|
||||||
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
||||||
|
|
||||||
|
//데이터 없음 버튼
|
||||||
|
const forestProductStatus = document.getElementById("forestProductStatus");
|
||||||
|
|
||||||
//등록 완료 버튼
|
//등록 완료 버튼
|
||||||
const next = document.getElementById('complateBtn');
|
const next = document.getElementById('complateBtn');
|
||||||
|
|
||||||
@@ -382,8 +390,8 @@
|
|||||||
next.disabled = true;
|
next.disabled = true;
|
||||||
|
|
||||||
} else if (ENV.data.currentStatus == "REGISTERED") {
|
} else if (ENV.data.currentStatus == "REGISTERED") {
|
||||||
if (ENV.data.productList.length > 0) {
|
if (ENV.data.bankList.length > 0) {
|
||||||
ENV.data.productList.forEach(data => productRenderer.addItem(data, true));
|
ENV.data.bankList.forEach(data => productRenderer.addItem(data, true));
|
||||||
this.updateLayout();
|
this.updateLayout();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -392,11 +400,11 @@
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (ENV.data.currentStatus == "REGISTERED") {
|
if (ENV.data.currentStatus == "REGISTERED") {
|
||||||
if (ENV.data.productList.length > 0) {
|
if (ENV.data.bankList.length > 0) {
|
||||||
ENV.data.productList.forEach(data => productRenderer.addItem(data, false));
|
ENV.data.bankList.forEach(data => productRenderer.addItem(data, false));
|
||||||
const header = document.getElementById('listHeader');
|
const header = document.getElementById('listHeader');
|
||||||
const count = document.getElementById('listCount');
|
const count = document.getElementById('listCount');
|
||||||
const total = ENV.data.productList.length;
|
const total = ENV.data.bankList.length;
|
||||||
header.style.display = total > 0 ? '' : 'none';
|
header.style.display = total > 0 ? '' : 'none';
|
||||||
count.textContent = total;
|
count.textContent = total;
|
||||||
}
|
}
|
||||||
@@ -422,8 +430,201 @@
|
|||||||
|
|
||||||
ENV.module.modalPopup.open();
|
ENV.module.modalPopup.open();
|
||||||
},
|
},
|
||||||
|
handleNoDataToggle() {
|
||||||
|
if (!ENV.data.editable && ENV.data.currentStatus == "NOTHING") {
|
||||||
|
ENV.elementRefs.noDataCheckbox.checked = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.updateLayout();
|
||||||
|
|
||||||
|
},
|
||||||
|
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.bankList.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
saveFormData() {
|
||||||
|
const form = document.getElementById('popupForm');
|
||||||
|
const selects = ['cropCode', 'transferCategory', 'unitCode'];
|
||||||
|
selects.forEach(id => {
|
||||||
|
const sel = document.getElementById(id + 'Select');
|
||||||
|
if (sel && sel.value) form[id].value = sel.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
const errors = [];
|
||||||
|
if (!form.transferCategory.value) errors.push({field: 'transferCategory', message: '수입종류를 선택해주세요.'});
|
||||||
|
if (form.transferCategory.value && document.getElementsByName(form.transferCategory.value+"_value")
|
||||||
|
&& !document.getElementsByName(form.transferCategory.value+"_value").value){
|
||||||
|
errors.push({field: form.transferCategory.value+"_value", message: '수입대상을 입력해주세요.'});
|
||||||
|
}
|
||||||
|
if (!form.sourcePurpose.value) errors.push({field: 'sourcePurpose', message: '수입원을 입력해주세요.'});
|
||||||
|
|
||||||
|
if (form.count.value && !form.unitCode.value) errors.push({
|
||||||
|
field: 'unitCode',
|
||||||
|
message: '단위를 선택해주세요.'
|
||||||
|
});
|
||||||
|
if (!form.price.value) errors.push({field: 'price', message: '금액을 입력해주세요.'});
|
||||||
|
|
||||||
|
kri.form.error(errors);
|
||||||
|
if (errors.length > 0) return;
|
||||||
|
|
||||||
|
const formData = new FormData(form);
|
||||||
|
const product = {};
|
||||||
|
formData.forEach((value, key) => product[key] = value);
|
||||||
|
product.id = product.id ? Number(product.id) : Math.floor(Math.random() * 1000000) + 1;
|
||||||
|
|
||||||
|
const idx = ENV.data.productList.findIndex(item => item.id == product.id);
|
||||||
|
if (idx !== -1) ENV.data.productList[idx] = product;
|
||||||
|
else ENV.data.productList.push(product);
|
||||||
|
|
||||||
|
ENV.module.modalPopup.close();
|
||||||
|
setTimeout(() => productRenderer.addItem(product, true), 300);
|
||||||
|
},
|
||||||
|
|
||||||
|
getCategoryLabel(code) {
|
||||||
|
const found = ENV.data.transferCategoryList.find(i => i.id === code);
|
||||||
|
return found ? found.codeText : '-';
|
||||||
|
},
|
||||||
|
// 단위 코드
|
||||||
|
getUnitLabel(code) {
|
||||||
|
const found = ENV.data.unitList.find(i => i.id === code);
|
||||||
|
return found ? found.codeText : '-';
|
||||||
|
},
|
||||||
|
// 재배형태
|
||||||
|
getCropLabel(code) {
|
||||||
|
const found = ENV.data.codeRecordCropList.find(i => i.id === code);
|
||||||
|
return found ? found.codeText : '-';
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const productRenderer = {
|
||||||
|
//화면에 아이템 추가
|
||||||
|
addItem(product, isEdit) {
|
||||||
|
const listBody = document.getElementById('listBody');
|
||||||
|
const form = document.getElementById('popupForm');
|
||||||
|
form.reset();
|
||||||
|
listBody.style.display = '';
|
||||||
|
|
||||||
|
const format = val => Number(val).toLocaleString() || '-';
|
||||||
|
const getUnit = formControl.getUnitLabel;
|
||||||
|
const getCategory = formControl.getCategoryLabel;
|
||||||
|
const getCrop = formControl.getCropLabel;
|
||||||
|
|
||||||
|
const tag01 = product.transferCategory == 'code.bank.input.99' ? product[`${product.transferCategory}_value`] :getCategory(product.transferCategory) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const tag1 = product.landArea ? `<span>${format(product.landArea)}평</span>` : '';
|
||||||
|
|
||||||
|
let tag2 = '';
|
||||||
|
if (product.town && product.streetNum) tag2 = `<li><span>${product.town} ${product.streetNum}</span></li>`;
|
||||||
|
else if (product.town) tag2 = `<li><span>${product.town}</span></li>`;
|
||||||
|
else if (product.streetNum) tag2 = `<li><span>${product.streetNum}</span></li>`;
|
||||||
|
|
||||||
|
const tag3 = product.landType ? `<li><p>지목</p><span>${getPurpose(product.landType)}</span></li>` : '';
|
||||||
|
const tag4 = product.availableArea ? `<li><p>가능면적</p><span>${format(product.availableArea)}평</span></li>` : '';
|
||||||
|
|
||||||
|
let tag5 = '';
|
||||||
|
if (product.mainYield && product.mainSaleAmount) {
|
||||||
|
tag5 = `<li><p>주생산물 수확량 / 판매량</p><span>${format(product.mainYield)}${getUnit(product.mainYieldUnitCode)} / ${format(product.mainSaleAmount)}${getUnit(product.mainSaleUnitCode)}</span></li>`;
|
||||||
|
} else if (product.mainYield) {
|
||||||
|
tag5 = `<li><p>주생산물 수확량</p><span>${format(product.mainYield)}${getUnit(product.mainYieldUnitCode)}</span></li>`;
|
||||||
|
} else if (product.mainSaleAmount) {
|
||||||
|
tag5 = `<li><p>주생산물 판매량</p><span>${format(product.mainSaleAmount)}${getUnit(product.mainSaleUnitCode)}</span></li>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let tag6 = '';
|
||||||
|
if (product.subYield && product.subSaleAmount) {
|
||||||
|
tag6 = `<li><p>부생산물 수확량 / 판매량</p><span>${format(product.subYield)}${getUnit(product.subYieldUnitCode)} / ${format(product.subSaleAmount)}${getUnit(product.subSaleUnitCode)}</span></li>`;
|
||||||
|
} else if (product.subYield) {
|
||||||
|
tag6 = `<li><p>부생산물 수확량</p><span>${format(product.subYield)}${getUnit(product.subYieldUnitCode)}</span></li>`;
|
||||||
|
} else if (product.subSaleAmount) {
|
||||||
|
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>
|
||||||
|
${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.updateLayout();
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
`<div class="list-item">
|
||||||
|
<div class="item-tit-group">
|
||||||
|
<p class="item-name">${tag01} <span>(${product.sourcePurpose})</span></p>
|
||||||
|
${buttonGroupHtml}
|
||||||
|
</div>`
|
||||||
|
<ul class="detail-list">
|
||||||
|
<li>
|
||||||
|
<p>재배형태</p>
|
||||||
|
<span>${getCrop(product.cropCode)}</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>수입원</p>
|
||||||
|
<span>회사</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>수량</p>
|
||||||
|
<span>1대</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>현금</p>
|
||||||
|
<span>1,100,000원</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
xmlns:th="http://www.thymeleaf.org">
|
xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<div layout:fragment="content" th:classappend="'mypage-wrap'">
|
<div layout:fragment="content" th:classappend="'mypage'">
|
||||||
<main id="content" role="main">
|
<main id="content" role="main">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<hgroup class="tit-group">
|
<hgroup class="tit-group">
|
||||||
@@ -12,17 +12,39 @@
|
|||||||
<p>지출 내역을 등록해 주세요.</p>
|
<p>지출 내역을 등록해 주세요.</p>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
|
|
||||||
<div class="component-btns">
|
<section class="regist-item-area">
|
||||||
<div class="btns-col">
|
<p class="total" style="display: none" id="listHeader">
|
||||||
<button type="button" class="btn btn-m btn-secondary btn-full">
|
<span>총 <strong id="listCount">0</strong>건</span>
|
||||||
|
<button type="button" class="btn-reset" onclick="formControl.clearAllItems()" id="clearAllItems">
|
||||||
|
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||||
|
<span>초기화</span>
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
<div class="item-list" style="display: none" id="listBody">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="btn btn-m btn-secondary btn-full" style="margin-bottom:1.2rem"
|
||||||
|
id="addItemBtn" onclick="formControl.openAddForm()">
|
||||||
<i class="ico-add ico-small" aria-hidden="true"></i>
|
<i class="ico-add ico-small" aria-hidden="true"></i>
|
||||||
<span class="btn-txt">추가 등록</span>
|
<span class="btn-txt">추가 등록</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-m btn-link btn-full">
|
|
||||||
|
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn">
|
||||||
<span class="btn-txt">이전 정보 불러오기</span>
|
<span class="btn-txt">이전 정보 불러오기</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="component-input align-center" id="forestProductStatusDiv">
|
||||||
|
<label class="checkbox-inner">
|
||||||
|
<input type="checkbox" id="forestProductStatus" name="forestProductStatus"
|
||||||
|
th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
|
||||||
|
<span class="checkbox-item"><span class="checkbox-txt">이번달 등록내용 없음</span></span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
@@ -31,7 +53,7 @@
|
|||||||
<div class="component-btns fixed">
|
<div class="component-btns fixed">
|
||||||
<div class="btns-row">
|
<div class="btns-row">
|
||||||
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
||||||
<button type="button" class="btn btn-l btn-primary" disabled>
|
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
||||||
<span class="btn-txt">등록 완료</span>
|
<span class="btn-txt">등록 완료</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,54 +71,120 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 모달 팝업 -->
|
<!-- 모달 팝업 -->
|
||||||
<div class="layer-wrap">
|
<div class="layer-wrap">
|
||||||
<div class="component-modal mypage-wrap modal01" data-props-dimm-click="true" data-state="open">
|
<div class="component-modal mypage-wrap addPopup" data-props-dimm-click="true" >
|
||||||
<div class="modal-dimm"></div>
|
<div class="modal-dimm"></div>
|
||||||
<div class="modal-frame">
|
<div class="modal-frame">
|
||||||
<div class="modal-container">
|
<div class="modal-container">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h3 class="modal-tit">은행 자동이체(지출) 등록</h3>
|
<h3 class="modal-tit">은행 자동이체(수입) 등록</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-content-inner">
|
<div class="modal-content-inner">
|
||||||
|
<form id="forestForm">
|
||||||
|
<input type="hidden" name="id" id="id">
|
||||||
|
<input type="hidden" name="transferType" id="transferType">
|
||||||
|
|
||||||
<p class="form-desc">필수입력</p>
|
<p class="form-desc">필수입력</p>
|
||||||
|
|
||||||
<section class="form-group">
|
<section class="form-group">
|
||||||
<!-- 지출의 종류 -->
|
<!-- 재배형태 -->
|
||||||
<!-- 에러케이스 input-invalid 클래스 -->
|
<div class="select-group">
|
||||||
<div class="component-input input-invalid">
|
<div class="select-label">
|
||||||
<div class="input-label">
|
<p class="label-txt">
|
||||||
<label for="temp_input_0001" class="label-txt">
|
재배형태
|
||||||
지출의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
</p>
|
||||||
</label>
|
<span class="label-sub-txt">임산물 수입이 있는 경우, 등록해 주세요.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div id="cropCodeSelect" class="component-select bottom-sheet" data-props-default="재배형태를 선택해 주세요"
|
||||||
<input type="text" id="temp_input_0001" placeholder="지출 종류를 입력해 주세요">
|
data-props-type="bottomSheet">
|
||||||
|
<input type="hidden" name="cropCode" id="cropCode"/>
|
||||||
|
<button type="button" class="select-box">
|
||||||
|
<span class="select-txt">재배형태를 선택해 주세요</span>
|
||||||
|
</button>
|
||||||
|
<div class="select-options">
|
||||||
|
<div class="select-header">
|
||||||
|
<p>재배형태</p>
|
||||||
|
<button type="button" class="select-close">
|
||||||
|
<span class="hide-txt">닫기</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<ul class="input-info">
|
<div class="select-scroll">
|
||||||
<li>지출 종류를 입력해주세요.</li>
|
<ul class="">
|
||||||
|
<th:block th:each="item : ${codeRecordCropList}">
|
||||||
|
<li class="option" th:data-value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</li>
|
||||||
|
</th:block>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- 용도 -->
|
</div>
|
||||||
<div class="component-input input-invalid">
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<section class="form-group">
|
||||||
|
<!-- 수입의 종류 -->
|
||||||
|
<div class="select-group">
|
||||||
|
<div class="select-label">
|
||||||
|
<p class="label-txt">
|
||||||
|
수입의 종류
|
||||||
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div id="transferCategorySelect" class="component-select bottom-sheet" data-props-default="수입 종류를 선택해 주세요"
|
||||||
|
data-props-type="bottomSheet">
|
||||||
|
<input type="hidden" name="transferCategory" id="transferCategory"/>
|
||||||
|
<button type="button" class="select-box">
|
||||||
|
<span class="select-txt"></span>
|
||||||
|
</button>
|
||||||
|
<div class="select-options">
|
||||||
|
<div class="select-header">
|
||||||
|
<p>수입의 종류</p>
|
||||||
|
<button type="button" class="select-close">
|
||||||
|
<span class="hide-txt">닫기</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="select-scroll">
|
||||||
|
<ul class="">
|
||||||
|
<th:block th:each="item : ${transferCategoryList}">
|
||||||
|
<li class="option" th:data-value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</li>
|
||||||
|
</th:block>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- 수당 인풋 -->
|
||||||
|
<!-- transferCategory+Text-->
|
||||||
|
<th:block th:each="item : ${transferCategoryList}">
|
||||||
|
|
||||||
|
<div class="component-input " th:data-option="${item.codeText}">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" th:id="${item.id}+'_value'" th:name="${item.id}+'_value'" value="" placeholder="수입 대상을 입력해 주세요." maxlength="30">
|
||||||
|
</div>
|
||||||
|
<ul class="input-info">
|
||||||
|
<li style="display:none">수입 대상을 입력해 주세요.</li>
|
||||||
|
<li class="txt-blue" th:if="${item.msgCode}" th:text="${item.msgCode}"></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</div>
|
||||||
|
<!-- 수입원 -->
|
||||||
|
<div class="component-input">
|
||||||
<div class="input-label">
|
<div class="input-label">
|
||||||
<label for="temp_input_0001" class="label-txt">
|
<label for="sourcePurpose" class="label-txt">
|
||||||
용도
|
수입원
|
||||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input type="text" id="temp_input_0001" placeholder="용도를 입력해 주세요">
|
<input type="text" id="sourcePurpose" placeholder="수입원을 입력해 주세요" name="sourcePurpose" maxlength="30">
|
||||||
</div>
|
</div>
|
||||||
<ul class="input-info">
|
|
||||||
<li>용도를 입력해 주세요.</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -106,12 +194,12 @@
|
|||||||
<!-- 수량 -->
|
<!-- 수량 -->
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="input-label">
|
<div class="input-label">
|
||||||
<label for="temp_input_0001" class="label-txt">
|
<label for="count" class="label-txt">
|
||||||
수량
|
수량
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input type="nubmer" id="temp_input_0001" placeholder="수량을 입력해 주세요">
|
<input type="number" id="count" placeholder="수량을 입력해 주세요" name="count" class="limitDecimalLength">
|
||||||
</div>
|
</div>
|
||||||
<ul class="guide-info">
|
<ul class="guide-info">
|
||||||
<li>예 : 2, 2.5</li>
|
<li>예 : 2, 2.5</li>
|
||||||
@@ -124,8 +212,9 @@
|
|||||||
단위
|
단위
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="select3" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요"
|
<div id="unitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요"
|
||||||
data-props-type="bottomSheet">
|
data-props-type="bottomSheet">
|
||||||
|
<input type="hidden" name="unitCode" id="unitCode">
|
||||||
<button type="button" class="select-box">
|
<button type="button" class="select-box">
|
||||||
<span class="select-txt">선택</span>
|
<span class="select-txt">선택</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -138,13 +227,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="select-scroll">
|
<div class="select-scroll">
|
||||||
<ul class="">
|
<ul class="">
|
||||||
<li class="option" data-value="option1">option1</li>
|
<th:block th:each="item : ${unitList}">
|
||||||
<li class="option" data-value="option2">option2</li>
|
<li class="option" th:data-value="${item.id}"
|
||||||
<li class="option" data-value="option3">option3</li>
|
th:text="${item.codeText}">option1
|
||||||
<li class="option" data-value="option4">option4</li>
|
</li>
|
||||||
<li class="option" data-value="option5">option5</li>
|
</th:block>
|
||||||
<li class="option" data-value="option6">option6</li>
|
|
||||||
<li class="option" data-value="option7">option7</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -156,18 +243,18 @@
|
|||||||
|
|
||||||
<section class="form-group">
|
<section class="form-group">
|
||||||
<!-- 현금 -->
|
<!-- 현금 -->
|
||||||
<div class="component-input input-invalid">
|
<div class="component-input ">
|
||||||
<div class="input-label">
|
<div class="input-label">
|
||||||
<label for="temp_input_0001" class="label-txt">
|
<label for="price" class="label-txt">
|
||||||
현금
|
현금
|
||||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field type-price">
|
<div class="input-field type-price">
|
||||||
<input type="text" id="temp_input_0001" placeholder="금액을 입력해 주세요">
|
<input type="number" id="price" placeholder="금액을 입력해 주세요" name="price" class="limitAmountLength">
|
||||||
<span class="input-field-txt">원</span>
|
<span class="input-field-txt">원</span>
|
||||||
</div>
|
</div>
|
||||||
<ul class="input-info">
|
<ul class="input-info" style="display:none">
|
||||||
<li>금액을 입력해 주세요.</li>
|
<li>금액을 입력해 주세요.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="guide-info">
|
<ul class="guide-info">
|
||||||
@@ -183,6 +270,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="modal-close"></button>
|
<button type="button" class="modal-close"></button>
|
||||||
@@ -193,24 +281,197 @@
|
|||||||
<!-- //모달 팝업 -->
|
<!-- //모달 팝업 -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
// ✅ ENV 구조 (전역 설정 및 상태)
|
||||||
let ENV = {
|
let ENV = {
|
||||||
httpUrl: {
|
httpUrl: {
|
||||||
root: /*[[#{uri.front.info.monthly.path}]]*/'rootUrl'
|
root: /*[[#{uri.front.info.bank.path}]]*/ 'rootUrl',
|
||||||
|
save: /*[[|/api/front#{uri.front.info.bank.path}/create|]]*/ 'saveUrl'
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
confirmPopup: null
|
modalPopup: null
|
||||||
},
|
},
|
||||||
submitted: false,
|
data: {
|
||||||
|
transferCategoryList: /*[[${transferCategoryList}]]*/ [],
|
||||||
|
codeRecordCropList: /*[[${codeRecordCropList}]]*/ [],
|
||||||
|
unitList: /*[[${unitList}]]*/ [],
|
||||||
|
bankList : [],
|
||||||
|
pastBankList : [],
|
||||||
|
id: /*[[${currentMonthlyInfo.id}]]*/'',
|
||||||
|
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferOutputStatus}]]*/'',
|
||||||
|
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferOutputStatus}]]*/'',
|
||||||
|
editable: /*[[${editable}]]*/,
|
||||||
|
},
|
||||||
|
elementRefs: {
|
||||||
|
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||||
|
addButton: {
|
||||||
|
button: null,
|
||||||
|
icon: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isSubmitted: false
|
||||||
};
|
};
|
||||||
let formControl = {
|
|
||||||
|
const formControl = {
|
||||||
init() {
|
init() {
|
||||||
|
this.cacheElements();
|
||||||
|
this.bindDecimalLimit();
|
||||||
|
this.bindAmountLimit();
|
||||||
|
|
||||||
|
this.loadingLayout();
|
||||||
|
|
||||||
|
},
|
||||||
|
cacheElements() {
|
||||||
|
ENV.module.modalPopup = document.querySelector(".addPopup").ui;
|
||||||
|
},
|
||||||
|
bindDecimalLimit() {
|
||||||
|
document.querySelectorAll(".limitDecimalLength").forEach(input => {
|
||||||
|
input.addEventListener("input", () => {
|
||||||
|
alert('22');
|
||||||
|
let val = input.value.replace(/[^0-9.]/g, '');
|
||||||
|
const parts = val.split('.');
|
||||||
|
if (parts.length > 2) val = parts[0] + '.' + parts.slice(1).join('');
|
||||||
|
if (parts[1]) parts[1] = parts[1].slice(0, 2);
|
||||||
|
if (val.length > 10) val = val.slice(0, 10);
|
||||||
|
input.value = parts.join('.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
bindAmountLimit() {
|
||||||
|
document.querySelectorAll(".limitAmountLength").forEach(input => {
|
||||||
|
input.addEventListener("input", () => {
|
||||||
|
let val = input.value.replace(/[^0-9]/g, '');
|
||||||
|
if (val.length > 10) {
|
||||||
|
val = val.slice(0, 10);
|
||||||
|
}
|
||||||
|
input.value = val;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
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.pastBankList.length == 0) {
|
||||||
|
callPastInfoBtn.disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ENV.data.editable) {
|
||||||
|
if (ENV.data.currentStatus == "NONE") {
|
||||||
|
if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.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.bankList.length > 0) {
|
||||||
|
ENV.data.bankList.forEach(data => productRenderer.addItem(data, true));
|
||||||
|
this.updateLayout();
|
||||||
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (ENV.data.currentStatus == "REGISTERED") {
|
||||||
|
if (ENV.data.bankList.length > 0) {
|
||||||
|
ENV.data.bankList.forEach(data => productRenderer.addItem(data, false));
|
||||||
|
const header = document.getElementById('listHeader');
|
||||||
|
const count = document.getElementById('listCount');
|
||||||
|
const total = ENV.data.bankList.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";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openAddForm() {
|
||||||
|
const modalContent = document.querySelector('.modal-content');
|
||||||
|
setTimeout(() => {
|
||||||
|
modalContent.scrollTop = 0;
|
||||||
|
}, 0);
|
||||||
|
//초기화 안됨
|
||||||
|
['cropCodeSelect', 'transferCategorySelect', 'unitCodeSelect']
|
||||||
|
.forEach(id => etUI.components.SelectBox().core.init(document.getElementById(id)));
|
||||||
|
|
||||||
|
ENV.module.modalPopup.open();
|
||||||
|
},
|
||||||
|
handleNoDataToggle() {
|
||||||
|
if (!ENV.data.editable && ENV.data.currentStatus == "NOTHING") {
|
||||||
|
ENV.elementRefs.noDataCheckbox.checked = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateLayout();
|
||||||
|
|
||||||
|
},
|
||||||
|
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.bankList.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user