[BO] 임가현황 > 은행자동이체 내역 탭 작업

This commit is contained in:
kangsunlee
2025-07-02 16:08:31 +09:00
parent 4b96128b30
commit 529599d40a
55 changed files with 1288 additions and 1415 deletions

View File

@@ -12,7 +12,7 @@
<h3>수입 <strong>(<span id="bankIncomeCount">0</span>건)</strong></h3>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" data-remove-type="INCOME" onclick="removeBankConfirm(this);">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary" onclick="showBankIncomeModal();">
@@ -46,10 +46,10 @@
<h3>지출 <strong>(<span id="bankExpenseCount">0</span>건)</strong></h3>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" data-remove-type="EXPENSE" onclick="removeBankConfirm(this);">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<button type="button" class="btn small btn-primary" onclick="showBankExpenseModal();">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -118,7 +118,7 @@
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
<input type="checkbox" id="income_removeIds_${item.id}" name="removeIds" value="${item.id}">
</label>
</div>
</td>
@@ -155,11 +155,11 @@
<td>
<div class="component-input">
<label class="checkbox-inner">
<input type="checkbox" id="temp_checkbox_000${item.id}" name="temp_checkbox_000${item.id}" value="${item.id}">
<input type="checkbox" id="expense_removeIds_${item.id}" name="removeIds" value="${item.id}">
</label>
</div>
</td>
<td class="underline">${ifNullHyphen(item.categoryText)}</td> <!-- 지출의 종류 -->
<td class="underline"><a href="javascript:void(0);" onclick="showBankExpenseModal(${item.id})">${ifNullHyphen(item.categoryText)}</a></td> <!-- 지출의 종류 -->
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
<td class="align-right">${ifNullHyphen(item.count)}</td><!-- 수량 -->
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
@@ -170,6 +170,54 @@
tbody.append(tmpl);
}
// 은행자동이체내역 삭제 Confirm
const removeBankConfirm = (el) => {
const section = el.closest('section');
const checkedInputs = section.querySelectorAll('input[name="removeIds"]:checked');
const checkedIds = Array.from(checkedInputs).map(input => Number(input.value));
const removeType = el.dataset.removeType;
const removeTypeText = el.dataset.removeType === 'INCOME' ? '수입' : '지출';
if(checkedIds.length <= 0) {
alert(`은행자동이체내역(${removeTypeText})을 선택해주세요.`);
return;
}
etUI.dialog.confirm({
title: '삭제 안내',
message: '선택하신 내용을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
positiveCallback: function () {
removeBank(checkedIds, removeType, removeTypeText);
},
});
}
// 은행자동이체내역 삭제
const removeBank = (checkedIds, removeType, removeTypeText) => {
const f = document.reqForm;
ajaxUtil._ajaxMethod(
'/api/household/bank/delete',
JSON.stringify({
householdSeq: f.householdSeq.value,
recordMonth: f.recordMonth.value,
removeType: removeType,
removeIds: checkedIds
}),
() => { // 성공
alert(`은행자동이체내역(${removeTypeText})이 삭제되었습니다.`);
getBankAutoTransfer();
},
function (code, rstData) {
if(code == 422) alert(rstData.responseText);
if(code == 400) alert(rstData.responseJSON.message);
},
'delete',
'json',
);
}
</script>
</div>
</html>

View File

@@ -22,7 +22,7 @@
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary" style="display: none;" onclick="showDeleteForestProductConfirm();">
<button type="button" class="btn small btn-secondary" style="display: none;" onclick="removeForestProductConfirm();">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary" style="display: none;" onclick="showForestProductModal();">
@@ -78,23 +78,27 @@
(response) => { // 성공
console.log("임산물 현황 리스트 조회 : ", response);
// 임산물 현황 등록 상태 id set
f.monthlyInputStatusId.value = response.monthlyStatus.id;
// 이번달 등록내용 없음 체크 - NONE : 미등록, NOTHING : 이번달 등록내용 없음 , REGISTERED : 등록완료
$('#forestProductStatus').attr('checked', response.monthlyStatus.forestStatus === 'NOTHING');
// 이번달 등록내용 없음 에 따라 버튼 hide 처리
showForestProductNoneBtn();
const tbody = $('.tab-content.forest-product tbody');
tbody.empty();
if(response.forestProducts.length === 0) {
// TODO(ks) : monthlyStatus 없을 경우 처리 추가... 일단 .. 이렇게 처리 하지만.. 또 다른 방안이 있을지...
if (!response.monthlyStatus || !response.monthlyStatus.status) {
noDataMonthly(tbody, null, 15);
return;
}
if (!response.forestProducts || response.forestProducts.length === 0) {
noDataMonthly(tbody, response.monthlyStatus.status, 15);
return;
}
// 임산물 현황 등록 상태 id set
f.monthlyInputStatusId.value = response.monthlyStatus.id;
// 이번달 등록내용 없음 체크 - NONE : 미등록, NOTHING : 이번달 등록내용 없음 , REGISTERED : 등록완료
$('#forestProductStatus').attr('checked', response.monthlyStatus.forestStatus === 'NOTHING');
// 이번달 등록내용 없음 에 따라 버튼 hide 처리
showForestProductNoneBtn();
let tmpl = '';
$(response.forestProducts).each((idx, item) => {
tmpl +=
@@ -209,7 +213,7 @@
}
// 임산물현황 삭제 Confirm
const showDeleteForestProductConfirm = () => {
const removeForestProductConfirm = () => {
const checkedIds = Array.from(
document.querySelectorAll('input[name="forestRemoveIds"]:checked')
).map(el => Number(el.value));
@@ -223,13 +227,13 @@
title: '삭제 안내',
message: '선택하신 내용을 삭제하시겠습니까?<br>삭제한 항목은 복구할 수 없습니다.',
positiveCallback: function () {
goDeleteForestProduct(checkedIds);
removeForestProduct(checkedIds);
},
});
}
// 임산물현황 삭제
const goDeleteForestProduct = (checkedIds) => {
const removeForestProduct = (checkedIds) => {
const f = document.reqForm;
ajaxUtil._ajaxMethod(