자동이체 수입/지출 기본로직 완성(직접입력 미구현)

This commit is contained in:
주우성
2025-06-18 10:17:28 +09:00
parent 1876c7ebb4
commit cc8647e6c8
9 changed files with 477 additions and 224 deletions

View File

@@ -13,4 +13,5 @@ public class GetBanksCmd {
private Long monthlyInputStatusId;
private Long householdSeq;
private String transferType;
}

View File

@@ -59,21 +59,27 @@ class CreateBankInputController {
if(currentMonthlyInfo!=null) {
//TODO 트렌젝션 고려
removeBanksPortIn.operate(new RemoveBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq(), "code.bank.input"));
removeBanksPortIn.operate(new RemoveBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq(), reqVO.getTransferType()));
if (!reqVO.getStatus() && reqVO.getBankList() != null && !reqVO.getBankList().isEmpty()) { // 등록없음 처리가 아님.
for (CreateBankInputProductReqVO item : reqVO.getBankList()) {
UICodeView code = uiCodeViewPortIn.connect(item.getTransferCategoryCode()).orElse(null);
if(code != null) {
String incomdeCode = null;
String expenseCode = null;
if(reqVO.getTransferType().equals("code.bank.input")){
incomdeCode = !code.getId().equals(reqVO.getTransferType()+".99") && code.getCodeType().equals("INPUT") ? code.getCodeValue() : null;
expenseCode = !code.getId().equals(reqVO.getTransferType()+".99") && code.getCodeType().equals("OUTPUT") ?code.getCodeValue() : null;
}
createBankPortIn.operate(new CreateBankCmd(
AuthUtil.getUserSeq(),
"code.bank.input",
reqVO.getTransferType(),
item.getCropCode(),
item.getTransferCategoryCode(),
item.getTransferCategory(),
code.getCodeType().equals("INPUT") ? code.getCodeValue() : null,
code.getCodeType().equals("OUTPUT") ?code.getCodeValue() : null,
incomdeCode,
expenseCode,
item.getSourcePurpose(),
item.getCount(),
item.getUnitCode(),
@@ -89,8 +95,8 @@ class CreateBankInputController {
AuthUtil.getUserSeq(),
currentMonthlyInfo.getMonth(),
currentMonthlyInfo.getBankAutoTransferInputStatus(),
MonthStatus.REGISTERED,
currentMonthlyInfo.getBankAutoTransferOutputStatus()
reqVO.getTransferType().equals("code.bank.input") ? MonthStatus.REGISTERED : currentMonthlyInfo.getBankAutoTransferInputStatus(),
reqVO.getTransferType().equals("code.bank.output") ? MonthStatus.REGISTERED : currentMonthlyInfo.getBankAutoTransferOutputStatus()
));
} else {
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
@@ -98,8 +104,8 @@ class CreateBankInputController {
AuthUtil.getUserSeq(),
currentMonthlyInfo.getMonth(),
currentMonthlyInfo.getBankAutoTransferInputStatus(),
MonthStatus.NOTHING,
currentMonthlyInfo.getBankAutoTransferOutputStatus()
reqVO.getTransferType().equals("code.bank.input") ? MonthStatus.NOTHING : currentMonthlyInfo.getBankAutoTransferInputStatus(),
reqVO.getTransferType().equals("code.bank.output") ? MonthStatus.NOTHING : currentMonthlyInfo.getBankAutoTransferOutputStatus()
));
}
return ResponseEntity.ok(ApiResponse.success(null));

View File

@@ -66,14 +66,14 @@ class GetBankInputUIController {
if (pastMonthlyInfo != null) {
pastList = getBanksPortIn.operate(
pageable,
new GetBanksCmd(pastMonthlyInfo.getId(), AuthUtil.getUserSeq()));
new GetBanksCmd(pastMonthlyInfo.getId(), AuthUtil.getUserSeq(),"code.bank.input"));
}
Page<GetBanks> currentList = Page.empty();
if (currentMonthlyInfo != null) {
currentList = getBanksPortIn.operate(
pageable,
new GetBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq()));
new GetBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq(),"code.bank.input"));
}

View File

@@ -15,6 +15,7 @@ public class CreateBankInputReqVO {
private Boolean status;
private Long id;
private String transferType;
private List<CreateBankInputProductReqVO> bankList;
public List<CreateBankInputProductReqVO> getBankList() {

View File

@@ -3,6 +3,9 @@ package app.module.front.usecase.info.bankUI.getBankOutputUI.adapters.web;
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.usecase.info.bank.getBanks.ports.GetBanksPortIn;
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanks;
import app.module.front.usecase.info.bank.getBanks.ports.application.domain.GetBanksCmd;
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;
@@ -33,14 +36,18 @@ import java.util.NoSuchElementException;
class GetBankOutputUIController {
private final GetPrevMonthlyInputStatusPortIn prevMonthlyInputStatusPortIn;
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
private final GetBanksPortIn getBanksPortIn;
private final UICodeListPortIn uiCodeListPortIn;
@GetMapping(path = "/info/bank/create/output/{id}")
String operate(Model model,
@PathVariable Long id) {
public String operate(Model model,
@PathVariable Long id
,@PageableDefault(sort = "createAt", direction = Sort.Direction.DESC, page = 0, size = 100) Pageable pageable) {
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM"));
@@ -59,6 +66,22 @@ class GetBankOutputUIController {
new GetMonthlyInputStatusCmd(
id, AuthUtil.getUserSeq())).orElse(null);
Page<GetBanks> pastList = Page.empty();
if (pastMonthlyInfo != null) {
pastList = getBanksPortIn.operate(
pageable,
new GetBanksCmd(pastMonthlyInfo.getId(), AuthUtil.getUserSeq(),"code.bank.output"));
}
Page<GetBanks> currentList = Page.empty();
if (currentMonthlyInfo != null) {
currentList = getBanksPortIn.operate(
pageable,
new GetBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq(),"code.bank.output"));
}
//수정 가능 여부 판단
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
@@ -71,14 +94,30 @@ class GetBankOutputUIController {
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
model.addAttribute("transferCategoryList", uiCodeListPortIn.connect("code.bank.input"));
model.addAttribute("pastBankList", pastList);
model.addAttribute("bankList", currentList);
model.addAttribute("transferCategoryList", uiCodeListPortIn.connect("code.bank.output"));
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";
}
@GetMapping(path = "/api/front/info/bank/create/output/from")
public String operateForm(Model model) {
model.addAttribute("transferCategoryList", uiCodeListPortIn.connect("code.bank.output"));
model.addAttribute("codeRecordCropList", uiCodeListPortIn.connect("code.record.crop"));
model.addAttribute("unitList", uiCodeListPortIn.connect("code.record.unit"));
return "info/bank/outputForm";
}
}

View File

@@ -38,6 +38,10 @@
AND a.household_seq = #{cmd.householdSeq}
</if>
<if test="cmd.transferType != null">
AND a.transfer_type = #{cmd.transferType}
</if>
<if test="pageable.sort != null and !pageable.sort.isEmpty()">
ORDER BY

View File

@@ -7,7 +7,7 @@
<div class="inner">
<hgroup class="tit-group">
<h3>
<strong>은행 자동이체(수입) 내역 0건 등록</strong> 되었습니다.
<strong>은행 자동이체(수입) 내역 <span>[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3>
<p>수입 내역을 등록해 주세요.</p>
</hgroup>
@@ -428,6 +428,7 @@
{
status: ENV.elementRefs.noDataCheckbox.checked,
id: ENV.data.id,
transferType:"code.bank.input",
bankList: ENV.data.bankList
},
function (rstData, status) {

View File

@@ -7,7 +7,7 @@
<div class="inner">
<hgroup class="tit-group">
<h3>
<strong>은행 자동이체(지출) 내역 0건 등록</strong> 되었습니다.
<strong>은행 자동이체(지출) 내역 <span>[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3>
<p>지출 내역을 등록해 주세요.</p>
</hgroup>
@@ -53,7 +53,7 @@
<div class="component-btns fixed">
<div class="btns-row">
<!-- 비활성화 스타일/ 버튼 속성 disabled 추가-->
<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>
@@ -78,199 +78,11 @@
<div class="modal-frame">
<div class="modal-container">
<div class="modal-header">
<h3 class="modal-tit">은행 자동이체(수입) 등록</h3>
<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>
@@ -285,7 +97,7 @@
</div>
</div>"/api/front/info/bank/create"
<section layout:fragment="script">
<script th:inline="javascript">
@@ -299,21 +111,21 @@
modalPopup: null
},
data: {
transferCategoryList: /*[[${transferCategoryList}]]*/ [],
transferCategoryCodeList: /*[[${transferCategoryList}]]*/ [],
codeRecordCropList: /*[[${codeRecordCropList}]]*/ [],
unitList: /*[[${unitList}]]*/ [],
bankList : [],
pastBankList : [],
bankList : /*[[${bankList.content}]]*/ [],
pastBankList : /*[[${pastBankList.content}]]*/ [],
id: /*[[${currentMonthlyInfo.id}]]*/'',
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferOutputStatus}]]*/'',
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferOutputStatus}]]*/'',
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferInputStatus}]]*/'',
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferInputStatus}]]*/'',
editable: /*[[${editable}]]*/,
},
elementRefs: {
noDataCheckbox: document.getElementById("forestProductStatus"),
addButton: {
button: null,
icon: null
select:{
transferCategoryCodeSelect : null,
unitCodeSelect : null,
}
},
isSubmitted: false
@@ -334,7 +146,6 @@
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('');
@@ -420,15 +231,49 @@
}
},
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)));
ajaxUtil._ajaxAsyncMethod(
"/api/front/info/bank/create/output/from",
{},
function(rstHtml, status) {
$('.addPopup').find('.modal-content-inner').html(rstHtml);
const $select2 = document.querySelector('#transferCategoryCodeSelect');
ENV.elementRefs.select.transferCategoryCodeSelect = new etUI.components.SelectBox();
ENV.elementRefs.select.transferCategoryCodeSelect.core.init($select2,{
selectItemCallback({selectValue, dataValue}){
// document.querySelector('#transferCategory').value=selectValue;
document.querySelector('#transferCategoryCode').value=dataValue;
document.querySelectorAll('div[data-option]').forEach(el => {
el.style.display = 'none';
});
const target = document.querySelector(`div[data-option="${selectValue}"]`);
if (target) {
target.style.display = 'block';
}
}
});
const $select3 = document.querySelector('#unitCodeSelect');
ENV.elementRefs.select.unitCodeSelect = new etUI.components.SelectBox();
ENV.elementRefs.select.unitCodeSelect.core.init($select3,{
selectItemCallback({selectValue, dataValue}){
document.querySelector('#unitCode').value=dataValue;
}
});
ENV.module.modalPopup.open();
},
function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData);
},
'get',
'html'
);
ENV.module.modalPopup.open();
},
handleNoDataToggle() {
if (!ENV.data.editable && ENV.data.currentStatus == "NOTHING") {
@@ -471,8 +316,200 @@
}
},
saveFormData() {
const form = document.getElementById('popupForm');
kri.form.errorInit(form);
const selects = [ 'transferCategoryCode', 'unitCode'];
selects.forEach(id => {
const sel = document.getElementById(id + 'Select');
if (sel && sel.value) form[id].value = sel.value;
});
const errors = [];
if (!form.transferCategoryCode.value) errors.push({field: 'transferCategoryCode', message: '지출종류를 선택해주세요.'});
if(document.getElementById(form.transferCategoryCode.value+"_value")){
if (form.transferCategoryCode.value && document.getElementById(form.transferCategoryCode.value+"_value")
&& !document.getElementById(form.transferCategoryCode.value+"_value").value){
errors.push({field: form.transferCategoryCode.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: '금액을 입력해주세요.'});
console.log(errors) //////////////////////////
kri.form.error(errors);
if (errors.length > 0) {
return;
}
if(document.getElementById(form.transferCategoryCode.value+"_value")){
form.transferCategory.value = document.getElementById(form.transferCategoryCode.value+"_value").value;//입력값
}
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.bankList.findIndex(item => item.id == product.id);
if (idx !== -1) ENV.data.bankList[idx] = product;
else ENV.data.bankList.push(product);
ENV.module.modalPopup.close();
setTimeout(() => productRenderer.addItem(product, true), 300);
},
getCategoryLabel(code) {
const found = ENV.data.transferCategoryCodeList.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 : '-';
},
editItemById(id) {
const product = ENV.data.bankList.find(p => p.id == id);
if (!product) return;
this.openAddForm();
setTimeout(function(){
const form = document.getElementById('popupForm');
Object.entries(product).forEach(([key, val]) => {
const field = form.elements.namedItem(key);
if (field) {
field.value = val;
if(key == 'transferCategoryCode' && val == "code.bank.input.99"){
document.getElementById(val+"_value").value = product["transferCategory"];
}
}
});
ENV.elementRefs.select.transferCategoryCodeSelect.setValue(product.transferCategoryCode);
ENV.elementRefs.select.unitCodeSelect.setValue(product.unitCode);
},100)
},
// 선택 아이템 삭제
deleteItemById(id) {
ENV.data.bankList = ENV.data.bankList.filter(p => p.id != id);
const target = document.querySelector(`#listBody div[data-id='${id}']`);
if (target) target.remove();
this.updateLayout();
},
// 전체 초기화
clearAllItems() {
location.reload();
},
goSave() {
ajaxUtil._ajaxAsync(
ENV.httpUrl.save,
{
status: ENV.elementRefs.noDataCheckbox.checked,
id: ENV.data.id,
transferType:"code.bank.output",
bankList: ENV.data.bankList
},
function (rstData, status) {
if (rstData.code === 'SUCCESS') {
ajaxUtil._alert('등록이 완료되었습니다.', null, function () {
history.back()
});
} else if (rstData.code === 'ERROR') {
ajaxUtil._alert('잠시 뒤에 다시 시도해 주세요.', null);
}
},
);
}
}
const productRenderer = {
//화면에 아이템 추가
addItem(product, isEdit) {
const listBody = document.getElementById('listBody');
listBody.style.display = '';
const format = val => {
const num = Number(val);
return isNaN(num) ? '-' : num.toLocaleString();
};
const getUnit = formControl.getUnitLabel;
const getCategory = formControl.getCategoryLabel;
const categoryCode = product.transferCategoryCode;
const categoryCodeInputValue = product.transferCategory;
const categoryValue = product[`${categoryCode}_value`] ? product[`${categoryCode}_value`] : categoryCodeInputValue;
const tagTitle = categoryCode === 'code.bank.output.99'
? categoryCodeInputValue
: `${getCategory(categoryCode)}`;
const tagCount = product.count
? `<li><p>수량</p><span>${format(product.count)}${getUnit(product.unitCode)}</span></li>`
: '';
const buttonGroupHtml = isEdit
? `
<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 itemHtml = `
<div class="item-tit-group">
<p class="item-name">${tagTitle}</p>
${buttonGroupHtml}
</div>
<ul class="detail-list">
<li><p>용도</p><span>${product.sourcePurpose}</span></li>
${tagCount}
<li><p>현금</p><span>${format(product.price)}원</span></li>
</ul>
`;
const item = document.createElement('div');
item.className = 'list-item';
item.dataset.id = product.id;
item.innerHTML = itemHtml;
const existing = listBody.querySelector(`[data-id="${product.id}"]`);
existing ? listBody.replaceChild(item, existing) : listBody.appendChild(item);
formControl.updateLayout();
}
};
</script>
`
</section>

View File

@@ -0,0 +1,164 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<th:block>
<form id="popupForm">
<input type="hidden" name="id" id="id">
<p class="form-desc">필수입력</p>
<section class="form-group">
<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="transferCategoryCodeSelect" class="component-select bottom-sheet" data-props-default="지출 종류를 선택해 주세요"
data-props-type="bottomSheet">
<input type="hidden" name="transferCategoryCode" id="transferCategoryCode" data-type="select"/>
<input type="hidden" name="transferCategory" id="transferCategory" data-type="select"/>
<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>
<th:block th:each="item : ${transferCategoryList}">
<div class="component-input " th:if="${item.id == 'code.bank.output.99'}" 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" data-type="select">
<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" onclick="formControl.saveFormData()">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</form>
</th:block>
</html>