[BO] 임가현황 > 은행자동이체 내역 탭 작업
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user