479 lines
15 KiB
HTML
479 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
|
xmlns:th="http://www.thymeleaf.org">
|
|
|
|
<div layout:fragment="content" th:classappend="'mypage'">
|
|
<main id="content" role="main">
|
|
<div class="inner">
|
|
<hgroup class="tit-group">
|
|
<h3>
|
|
<strong>은행 자동이체(지출) 내역 0건 등록</strong> 되었습니다.
|
|
</h3>
|
|
<p>지출 내역을 등록해 주세요.</p>
|
|
</hgroup>
|
|
|
|
<section class="regist-item-area">
|
|
<p class="total" style="display: none" id="listHeader">
|
|
<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>
|
|
<span class="btn-txt">추가 등록</span>
|
|
</button>
|
|
|
|
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn">
|
|
<span class="btn-txt">이전 정보 불러오기</span>
|
|
</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>
|
|
|
|
</div>
|
|
</main>
|
|
|
|
<!-- 하단 고정 버튼 -->
|
|
<div class="component-btns fixed">
|
|
<div class="btns-row">
|
|
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
|
|
<button type="button" class="btn btn-l btn-primary" id="complateBtn" disabled>
|
|
<span class="btn-txt">등록 완료</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 모달 팝업 -->
|
|
<div class="layer-wrap">
|
|
<div class="component-modal mypage-wrap addPopup" data-props-dimm-click="true" >
|
|
<div class="modal-dimm"></div>
|
|
<div class="modal-frame">
|
|
<div class="modal-container">
|
|
<div class="modal-header">
|
|
<h3 class="modal-tit">은행 자동이체(수입) 등록</h3>
|
|
</div>
|
|
<div class="modal-content">
|
|
<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>
|
|
|
|
<section class="form-group">
|
|
<!-- 재배형태 -->
|
|
<div class="select-group">
|
|
<div class="select-label">
|
|
<p class="label-txt">
|
|
재배형태
|
|
</p>
|
|
<span class="label-sub-txt">임산물 수입이 있는 경우, 등록해 주세요.</span>
|
|
</div>
|
|
<div id="cropCodeSelect" class="component-select bottom-sheet" data-props-default="재배형태를 선택해 주세요"
|
|
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 class="select-scroll">
|
|
<ul class="">
|
|
<th:block th:each="item : ${codeRecordCropList}">
|
|
<li class="option" th:data-value="${item.id}"
|
|
th:text="${item.codeText}">
|
|
</li>
|
|
</th:block>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</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">
|
|
<label for="sourcePurpose" class="label-txt">
|
|
수입원
|
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
|
</label>
|
|
</div>
|
|
<div class="input-field">
|
|
<input type="text" id="sourcePurpose" placeholder="수입원을 입력해 주세요" name="sourcePurpose" maxlength="30">
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<hr>
|
|
|
|
<section class="form-group">
|
|
<!-- 수량 -->
|
|
<div class="component-input">
|
|
<div class="input-label">
|
|
<label for="count" class="label-txt">
|
|
수량
|
|
</label>
|
|
</div>
|
|
<div class="input-field">
|
|
<input type="number" id="count" placeholder="수량을 입력해 주세요" name="count" class="limitDecimalLength">
|
|
</div>
|
|
<ul class="guide-info">
|
|
<li>예 : 2, 2.5</li>
|
|
</ul>
|
|
</div>
|
|
<!-- 단위 -->
|
|
<div class="select-group">
|
|
<div class="select-label">
|
|
<p class="label-txt">
|
|
단위
|
|
</p>
|
|
</div>
|
|
<div id="unitCodeSelect" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요"
|
|
data-props-type="bottomSheet">
|
|
<input type="hidden" name="unitCode" id="unitCode">
|
|
<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 : ${unitList}">
|
|
<li class="option" th:data-value="${item.id}"
|
|
th:text="${item.codeText}">option1
|
|
</li>
|
|
</th:block>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<hr>
|
|
|
|
<section class="form-group">
|
|
<!-- 현금 -->
|
|
<div class="component-input ">
|
|
<div class="input-label">
|
|
<label for="price" class="label-txt">
|
|
현금
|
|
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
|
</label>
|
|
</div>
|
|
<div class="input-field type-price">
|
|
<input type="number" id="price" placeholder="금액을 입력해 주세요" name="price" class="limitAmountLength">
|
|
<span class="input-field-txt">원</span>
|
|
</div>
|
|
<ul class="input-info" style="display:none">
|
|
<li>금액을 입력해 주세요.</li>
|
|
</ul>
|
|
<ul class="guide-info">
|
|
<li>예 : 30000</li>
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="component-btns">
|
|
<div class="btns-row">
|
|
<button type="button" class="btn btn-full btn-l btn-primary">
|
|
<span class="btn-txt">등록</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="modal-close"></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- //모달 팝업 -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<section layout:fragment="script">
|
|
<script th:inline="javascript">
|
|
// ✅ ENV 구조 (전역 설정 및 상태)
|
|
let ENV = {
|
|
httpUrl: {
|
|
root: /*[[#{uri.front.info.bank.path}]]*/ 'rootUrl',
|
|
save: /*[[|/api/front#{uri.front.info.bank.path}/create|]]*/ 'saveUrl'
|
|
},
|
|
module: {
|
|
modalPopup: null
|
|
},
|
|
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
|
|
};
|
|
|
|
const formControl = {
|
|
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>
|
|
|
|
</section>
|
|
|
|
</html> |