임산물현황 완료일거에요.
This commit is contained in:
@@ -9,6 +9,8 @@ import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMont
|
||||
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
|
||||
import app.module.core.usecase.product.createForestProduct.ports.CreateForestProductPortIn;
|
||||
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProductCmd;
|
||||
import app.module.core.usecase.product.removeMonthForestProducts.ports.RemoveMonthForestProductsPortIn;
|
||||
import app.module.core.usecase.product.removeMonthForestProducts.ports.application.domain.RemoveMonthForestProductsCmd;
|
||||
import app.module.front.config.application.response.ApiResponse;
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.info.monthly.createMonthlyUI.adapters.web.model.CreateMonthlyProductReqVO;
|
||||
@@ -29,6 +31,8 @@ class CreateMonthlyController {
|
||||
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||
private final CreateForestProductPortIn createForestProductPortIn;
|
||||
private final UpdateMonthlyInputStatusPortIn updateMonthlyInputStatusPortIn;
|
||||
private final RemoveMonthForestProductsPortIn removeMonthForestProductsPortIn;
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
|
||||
@PostMapping(path = "/api/front/info/monthly/create")
|
||||
@@ -41,50 +45,57 @@ class CreateMonthlyController {
|
||||
new GetMonthlyInputStatusCmd(
|
||||
reqVO.getId(), AuthUtil.getUserSeq())).orElse(null);
|
||||
|
||||
if(!reqVO.getStatus() && reqVO.getProductList()!=null && !reqVO.getProductList().isEmpty()){ // 등록없음 처리가 아님.
|
||||
for(CreateMonthlyProductReqVO item : reqVO.getProductList()){
|
||||
createForestProductPortIn.operate(new CreateForestProductCmd(
|
||||
AuthUtil.getUserSeq(),
|
||||
item.getStreetNum(),
|
||||
item.getLandType(),
|
||||
item.getTown(),
|
||||
item.getAvailableArea(),
|
||||
item.getCropName(),
|
||||
null,
|
||||
item.getLandArea(),
|
||||
|
||||
if(currentMonthlyInfo!=null) {
|
||||
//TODO 트렌젝션 고려
|
||||
removeMonthForestProductsPortIn.operate(new RemoveMonthForestProductsCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||
|
||||
if (!reqVO.getStatus() && reqVO.getProductList() != null && !reqVO.getProductList().isEmpty()) { // 등록없음 처리가 아님.
|
||||
for (CreateMonthlyProductReqVO item : reqVO.getProductList()) {
|
||||
createForestProductPortIn.operate(new CreateForestProductCmd(
|
||||
AuthUtil.getUserSeq(),
|
||||
item.getStreetNum(),
|
||||
item.getLandType(),
|
||||
item.getTown(),
|
||||
item.getAvailableArea(),
|
||||
item.getCropName(),
|
||||
null,
|
||||
item.getLandArea(),
|
||||
currentMonthlyInfo.getMonth(),
|
||||
item.getMainYield(),
|
||||
item.getMainYieldUnitCode(),
|
||||
item.getMainSaleAmount(),
|
||||
item.getMainSaleUnitCode(),
|
||||
item.getSubYield(),
|
||||
item.getSubYieldUnitCode(),
|
||||
item.getSubSaleAmount(),
|
||||
item.getSubSaleUnitCode(),
|
||||
currentMonthlyInfo.getId()
|
||||
));
|
||||
}
|
||||
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
||||
currentMonthlyInfo.getId(),
|
||||
AuthUtil.getUserSeq(),
|
||||
currentMonthlyInfo.getMonth(),
|
||||
item.getMainYield(),
|
||||
item.getMainYieldUnitCode(),
|
||||
item.getMainSaleAmount(),
|
||||
item.getMainSaleUnitCode(),
|
||||
item.getSubYield(),
|
||||
item.getSubYieldUnitCode(),
|
||||
item.getSubSaleAmount(),
|
||||
item.getSubSaleUnitCode(),
|
||||
currentMonthlyInfo.getId()
|
||||
MonthStatus.REGISTERED,
|
||||
currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||
currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||
));
|
||||
} else {
|
||||
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
||||
currentMonthlyInfo.getId(),
|
||||
AuthUtil.getUserSeq(),
|
||||
currentMonthlyInfo.getMonth(),
|
||||
MonthStatus.NOTHING,
|
||||
currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||
currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||
));
|
||||
}
|
||||
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
||||
currentMonthlyInfo.getId(),
|
||||
AuthUtil.getUserSeq(),
|
||||
currentMonthlyInfo.getMonth(),
|
||||
MonthStatus.REGISTERED,
|
||||
currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||
currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||
));
|
||||
return ResponseEntity.ok(ApiResponse.success(null));
|
||||
} else {
|
||||
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
||||
currentMonthlyInfo.getId(),
|
||||
AuthUtil.getUserSeq(),
|
||||
currentMonthlyInfo.getMonth(),
|
||||
MonthStatus.NOTHING,
|
||||
currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||
currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||
));
|
||||
return ResponseEntity.ok(ApiResponse.failure(null));
|
||||
}
|
||||
|
||||
|
||||
|
||||
return ResponseEntity.ok(ApiResponse.success(null));
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,9 @@ import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@@ -50,7 +53,7 @@ class CreateMonthlyUIController {
|
||||
new GetPrevMonthlyInputStatusCmd(
|
||||
id, AuthUtil.getUserSeq())).orElse(null);
|
||||
|
||||
//현재 달 입력 상태 취득
|
||||
//이번달 달 입력 상태 취득
|
||||
GetMonthlyInputStatus currentMonthlyInfo =
|
||||
getMonthlyInputStatusPortIn.operate(
|
||||
new GetMonthlyInputStatusCmd(
|
||||
@@ -75,6 +78,11 @@ class CreateMonthlyUIController {
|
||||
currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
|
||||
}
|
||||
|
||||
//수정 가능 여부 판단
|
||||
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth());
|
||||
LocalDate maxMonth = yearMonth.plusMonths(1).atDay(15);
|
||||
LocalDate today = LocalDate.now();
|
||||
boolean editable = !today.isAfter(maxMonth);
|
||||
|
||||
|
||||
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
|
||||
@@ -87,6 +95,7 @@ class CreateMonthlyUIController {
|
||||
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
|
||||
|
||||
model.addAttribute("MonthStatus", MonthStatus.class);
|
||||
model.addAttribute("editable", editable);
|
||||
|
||||
return "info/monthly/{id}";
|
||||
}
|
||||
|
||||
@@ -55,7 +55,6 @@ var ajaxUtil = {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
_alertId : function (alertId, afterEvent) {
|
||||
ajaxUtil._alertMethod({
|
||||
|
||||
53
front/src/main/resources/templates/info/bank/input.html
Normal file
53
front/src/main/resources/templates/info/bank/input.html
Normal 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>
|
||||
53
front/src/main/resources/templates/info/bank/output.html
Normal file
53
front/src/main/resources/templates/info/bank/output.html
Normal 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>
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user