[BO] 일계부 수입 등록&수정
This commit is contained in:
@@ -3,9 +3,12 @@
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<form autocomplete="off" method="get" name="reqIncomeForm">
|
||||
<input type="hidden" name="visitInfoId">
|
||||
<form autocomplete="off" method="get" name="reqIncomeForm" data-modal-id=".modal-daily-income">
|
||||
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||
<input type="hidden" name="searchMonth">
|
||||
<input type="hidden" name="groupNo">
|
||||
<input type="hidden" name="id">
|
||||
<input type="hidden" name="dailyId">
|
||||
|
||||
<div class="component-modal mypage-wrap modal01 modal-daily-income" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
@@ -114,7 +117,7 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>현금(원)</th>
|
||||
<th>현금(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
@@ -123,7 +126,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>현물평가액</th>
|
||||
<th>현물평가액(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
@@ -155,7 +158,6 @@
|
||||
</form>
|
||||
|
||||
<script th:inline="javascript">
|
||||
const modalId = '.modal-daily-income';
|
||||
// form 초기화
|
||||
const resetIncomeForm = () => {
|
||||
const form = document.reqIncomeForm;
|
||||
@@ -171,40 +173,6 @@
|
||||
form.estimatedValue.value = '';
|
||||
document.getElementById('isCredit_N').checked = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 일계부 등록 모달창 띄우기
|
||||
const showDailyIncomeModal = (id) => {
|
||||
const mf = document.reqIncomeForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
|
||||
resetIncomeForm();
|
||||
|
||||
if(id != null) {
|
||||
mf.visitInfoId.value = id;
|
||||
|
||||
ajaxUtil._ajaxAsyncMethod(
|
||||
`/api/household/daily/income/${id}`,
|
||||
obj,
|
||||
function (rstData) {
|
||||
console.log("일계부 상세 응답값 : ", rstData);
|
||||
setIncomeFormData(rstData);
|
||||
|
||||
document.querySelector(modalId).ui.open();
|
||||
},
|
||||
function () {
|
||||
|
||||
},
|
||||
'get'
|
||||
);
|
||||
|
||||
} else {
|
||||
document.querySelector(modalId).ui.open();
|
||||
}
|
||||
}
|
||||
|
||||
// 일계부 상세 값 set
|
||||
const setIncomeFormData = (data) => {
|
||||
@@ -234,29 +202,58 @@
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// TODO : 임가방문정보 등록
|
||||
// 일계부 등록 모달창 띄우기
|
||||
const showDailyIncomeModal = (id) => {
|
||||
const mf = document.reqIncomeForm;
|
||||
mf.searchMonth.value = document.reqForm.recordMonth.value;
|
||||
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||
mf.id.value = (id === undefined) ? '' : id;
|
||||
|
||||
resetIncomeForm();
|
||||
|
||||
if (id !== null && id !== undefined) {
|
||||
const obj = $(f).serializeObject();
|
||||
obj.id = mf.id.value;
|
||||
obj.searchMonth = obj.recordMonth;
|
||||
|
||||
ajaxUtil._ajaxAsyncMethod(
|
||||
`/api/household/daily/income/${id}`,
|
||||
obj,
|
||||
function (rstData, status) {
|
||||
setIncomeFormData(rstData);
|
||||
|
||||
document.querySelector($(mf).data('modalId')).ui.open();
|
||||
},
|
||||
function () {
|
||||
console.error('Do nothing error.')
|
||||
},
|
||||
'get'
|
||||
);
|
||||
|
||||
} else {
|
||||
document.querySelector($(mf).data('modalId')).ui.open();
|
||||
}
|
||||
}
|
||||
|
||||
const saveDailyIncome = () => {
|
||||
const f = document.reqIncomeForm;
|
||||
let dataOj = $(f).serializeObject();
|
||||
const mf = document.reqIncomeForm;
|
||||
let obj = $(mf).serializeObject();
|
||||
obj.inputType = 'SELF';
|
||||
|
||||
console.log("dataOj", dataOj);
|
||||
return;
|
||||
ajaxUtil._ajaxAsyncNoWaiting(
|
||||
'/api/household/daily/income/' + (obj.id === '' ? '0' : obj.id),
|
||||
obj,
|
||||
function () {
|
||||
alert('등록이 완료되었습니다.');
|
||||
|
||||
ajaxUtil._ajaxMethod(
|
||||
'/api/household/daily/income/save',
|
||||
JSON.stringify(dataOj),
|
||||
(response) => { // 성공
|
||||
alert("등록이 완료되었습니다.");
|
||||
document.querySelector(modalId).ui.close();
|
||||
getVisitInfo();
|
||||
document.querySelector($(mf).data('modalId')).ui.close();
|
||||
|
||||
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||
},
|
||||
function (code, rstData) {
|
||||
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||
console.error('Do nothing. code: '+ code, rstData);
|
||||
},
|
||||
'post',
|
||||
'json',
|
||||
{ handle422Type: 'alert' }
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user