월별임산물
This commit is contained in:
@@ -14,14 +14,14 @@
|
||||
</hgroup>
|
||||
|
||||
<section class="regist-item-area">
|
||||
<p class="total" th:style="${currentList.totalElements == 0 ? 'display:none':''}" id="listHeader">
|
||||
<span>총 <strong id="listCount">1</strong>건</span>
|
||||
<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()">
|
||||
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||
<span>초기화</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="item-list" th:style="${currentList.totalElements == 0 ? 'display:none':''}" id="listBody">
|
||||
<div class="item-list" style="display: none" id="listBody"> <!-- th:style="${currentList.totalElements == 0 ? 'display:none':''}"-->
|
||||
|
||||
</div>
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
<span class="btn-txt">추가 등록</span>
|
||||
</button>
|
||||
|
||||
<button type="button" class="btn btn-m btn-link btn-full" th:if="${pastMonthlyInfo != null && currentList.totalElements == 0}" id="callPastInfoBtn">
|
||||
<button type="button" class="btn btn-m btn-link btn-full" th:style="${pastMonthlyInfo != null && currentList.totalElements == 0 ? '':'display:none'}" id="callPastInfoBtn">
|
||||
<span class="btn-txt">이전 정보 불러오기</span>
|
||||
</button>
|
||||
|
||||
|
||||
<div class="component-input align-center" th:if="${currentList.totalElements == 0}" id="forestProductStatusDiv">
|
||||
<div class="component-input align-center" th:style="${currentList.totalElements == 0 ? '':'display:none'}" id="forestProductStatusDiv">
|
||||
<label class="checkbox-inner">
|
||||
<input type="checkbox" id="forestProductStatus" name="forestProductStatus" th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
|
||||
<span class="checkbox-item">
|
||||
@@ -60,7 +60,7 @@
|
||||
<div class="component-btns fixed">
|
||||
<div class="btns-row">
|
||||
<!-- 비활성화 스타일/ 버튼 속성 disable 추가-->
|
||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
||||
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled onclick="formControl.goSave()">
|
||||
<span class="btn-txt">등록 완료</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -417,15 +417,20 @@
|
||||
// ✅ ENV 구조 (전역 설정 및 상태)
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[#{uri.front.info.monthly.path}]]*/ 'rootUrl'
|
||||
root: /*[[#{uri.front.info.monthly.path}]]*/ 'rootUrl',
|
||||
save: /*[[|/api/front#{uri.front.info.monthly.path}/create|]]*/ 'rootUrl'
|
||||
},
|
||||
module: {
|
||||
modalPopup: null
|
||||
},
|
||||
|
||||
data: {
|
||||
purposeList: /*[[${purposeList}]]*/ [],
|
||||
unitList: /*[[${unitList}]]*/ [],
|
||||
productList: []
|
||||
// productList: /*[[${currentList.content}]]*/ [],
|
||||
productList: [],
|
||||
pastProductList : /*[[${pastList.content}]]*/ [],
|
||||
id: /*[[${currentMonthlyInfo.id}]]*/''
|
||||
},
|
||||
elementRefs: {
|
||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||
@@ -442,6 +447,8 @@
|
||||
init() {
|
||||
this.cacheElements();
|
||||
this.bindDecimalLimit();
|
||||
this.setting();
|
||||
ajaxUtil._alert('select 초기화/지정 방법?\n 6월의 카운트와 추가등록의 카운터의 차이?\n 신규 작성 이후 재진입시의 로직?\n 일단 저장데이터 뿌리는것은 막아둠',null);
|
||||
},
|
||||
//모달창
|
||||
cacheElements() {
|
||||
@@ -462,6 +469,15 @@
|
||||
});
|
||||
});
|
||||
},
|
||||
setting(){
|
||||
if(ENV.data.productList.length > 0) {
|
||||
ENV.data.productList.forEach(data => productRenderer.addItem(data));
|
||||
}
|
||||
this.updateListHeader();
|
||||
},
|
||||
pastMonthlyDataPopup(){
|
||||
//pastProductList 출력하면도미.
|
||||
},
|
||||
//등록없음 선택에 따른 추가하기 버튼 잠금
|
||||
toggleAddButtonState(isEnabled) {
|
||||
const btn = document.getElementById("addItemBtn");
|
||||
@@ -472,8 +488,8 @@
|
||||
},
|
||||
//등록없음 버튼
|
||||
handleNoDataToggle() {
|
||||
const isChecked = ENV.elementRefs.noDataCheckbox.checked;
|
||||
this.toggleAddButtonState(!isChecked);
|
||||
this.updateListHeader();
|
||||
|
||||
},
|
||||
// 등록폼 추가
|
||||
openAddForm() {
|
||||
@@ -566,13 +582,34 @@
|
||||
// document.getElementById('listBody').innerHTML = '';
|
||||
// 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) {
|
||||
@@ -583,6 +620,30 @@
|
||||
getUnitLabel(code) {
|
||||
const found = ENV.data.unitList.find(i => i.id === code);
|
||||
return found ? found.codeText : '-';
|
||||
},
|
||||
|
||||
|
||||
|
||||
goSave(){
|
||||
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.save,
|
||||
{status : ENV.elementRefs.noDataCheckbox.checked, id:ENV.data.id, productList : ENV.data.productList},
|
||||
function (rstData, status) {
|
||||
if(rstData.code ==='SUCCESS'){
|
||||
ajaxUtil._alert('등록이 완료되었습니다.', null, function () {
|
||||
/**
|
||||
* TODO
|
||||
* 내정보에서만 들어온다는 가정하에서 back을 하게함 SB에는 내정보로 이동하게 되어 있음.
|
||||
*/
|
||||
history.back()
|
||||
});
|
||||
} else if (rstData.code === 'ERROR'){
|
||||
ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user