[BO] 일계부 노동투입 등록, 수정
This commit is contained in:
@@ -159,7 +159,7 @@
|
||||
|
||||
<script th:inline="javascript">
|
||||
// form 초기화
|
||||
const resetIncomeForm = () => {
|
||||
const resetDailyIncomeForm = () => {
|
||||
const form = document.reqIncomeForm;
|
||||
if (!form) return;
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
}
|
||||
|
||||
// 일계부 상세 값 set
|
||||
const setIncomeFormData = (data) => {
|
||||
const setDailyIncomeFormData = (data) => {
|
||||
const form = document.reqIncomeForm;
|
||||
if (!form) return;
|
||||
|
||||
@@ -213,7 +213,7 @@
|
||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||
mf.id.value = (id === undefined) ? '' : id;
|
||||
|
||||
resetIncomeForm();
|
||||
resetDailyIncomeForm();
|
||||
|
||||
if (id !== null && id !== undefined) {
|
||||
const obj = $(f).serializeObject();
|
||||
@@ -224,7 +224,7 @@
|
||||
`/api/household/daily/income/${id}`,
|
||||
obj,
|
||||
function (rstData, status) {
|
||||
setIncomeFormData(rstData);
|
||||
setDailyIncomeFormData(rstData);
|
||||
|
||||
document.querySelector($(mf).data('modalId')).ui.open();
|
||||
},
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<form autocomplete="off" method="get" name="reqWorkForm" data-modal-id=".modal-daily-work">
|
||||
<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-work" data-props-dimm-click="true" data-state="close">
|
||||
<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">
|
||||
<table class="type-form confirm">
|
||||
<colgroup>
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
<col width="8%" />
|
||||
<col width="25.3%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>품목명<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="itemName" name="itemName" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>작업명<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="workName" name="workName" maxlength="30">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>작업 면적</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="workLandArea" name="workLandArea" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>단위</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="areaUnitCode" onchange="selectedUnit(this);" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${recordArea}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input unit-self-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="areaUnitSelf" name="areaUnitSelf" maxlength="30" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>수확량</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="harvestQuantity" name="harvestQuantity" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>단위</th>
|
||||
<td colspan="2">
|
||||
<div class="d-flex">
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="harvestUnitCode" onchange="selectedUnit(this);" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${recordUnit}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-input unit-self-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="harvestUnitSelf" name="harvestUnitSelf" maxlength="30" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="6">노동투입시간<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>경영주</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="ownerTime" name="ownerTime" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>배우자</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="spouseTime" name="spouseTime" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>가족노동(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="familyMHours" name="familyMHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>가족노동(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="familyFHours" name="familyFHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>고용노동(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="hiredMHours" name="hiredMHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>고용노동(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="hiredFHours" name="hiredFHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>품앗이(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="sharedMHours" name="sharedMHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>품앗이(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="sharedFHours" name="sharedFHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>일손돕기(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="volunteerMHours" name="volunteerMHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<th>일손돕기(남)</th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="volunteerFHours" name="volunteerFHours" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this);">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="saveDailyWork();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// form 초기화
|
||||
const resetDailyWorkForm = () => {
|
||||
const form = document.reqWorkForm;
|
||||
if (!form) return;
|
||||
|
||||
form.itemName.value = '';
|
||||
form.workName.value = '';
|
||||
form.workLandArea.value = '';
|
||||
form.areaUnitCode.value = '';
|
||||
form.areaUnitSelf.value = '';
|
||||
form.harvestQuantity.value = '';
|
||||
form.harvestUnitCode.value = '';
|
||||
form.harvestUnitSelf.value = '';
|
||||
form.ownerTime.value = '';
|
||||
form.spouseTime.value = '';
|
||||
form.familyMHours.value = '';
|
||||
form.familyFHours.value = '';
|
||||
form.hiredMHours.value = '';
|
||||
form.hiredFHours.value = '';
|
||||
form.sharedMHours.value = '';
|
||||
form.sharedFHours.value = '';
|
||||
form.volunteerMHours.value = '';
|
||||
form.volunteerFHours.value = '';
|
||||
|
||||
document.getElementById('isCredit_N').checked = true;
|
||||
}
|
||||
|
||||
// 일계부 상세 값 set
|
||||
const setDailyWorkFormData = (data) => {
|
||||
const form = document.reqWorkForm;
|
||||
if (!form) return;
|
||||
|
||||
// 폼에 값 세팅
|
||||
form.itemName.value = data.itemName || '';
|
||||
form.workName.value = data.workName || '';
|
||||
form.workLandArea.value = data.workLandArea || '';
|
||||
form.areaUnitCode.value = data.areaUnitCode || '';
|
||||
form.areaUnitSelf.value = data.areaUnitSelf || '';
|
||||
form.harvestQuantity.value = data.harvestQuantity || '';
|
||||
form.harvestUnitCode.value = data.harvestUnitCode || '';
|
||||
form.harvestUnitSelf.value = data.harvestUnitSelf || '';
|
||||
form.ownerTime.value = data.ownerTime || '';
|
||||
form.spouseTime.value = data.spouseTime || '';
|
||||
form.familyMHours.value = data.familyMHours || '';
|
||||
form.familyFHours.value = data.familyFHours || '';
|
||||
form.hiredMHours.value = data.hiredMHours || '';
|
||||
form.hiredFHours.value = data.hiredFHours || '';
|
||||
form.sharedMHours.value = data.sharedMHours || '';
|
||||
form.sharedFHours.value = data.sharedFHours || '';
|
||||
form.volunteerMHours.value = data.volunteerMHours || '';
|
||||
form.volunteerFHours.value = data.volunteerFHours || '';
|
||||
|
||||
// 기타 UI 처리
|
||||
selectedUnit(form.areaUnitCode);
|
||||
selectedUnit(form.harvestUnitCode);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 일계부 등록 모달창 띄우기
|
||||
const showDailyWorkModal = (id) => {
|
||||
const mf = document.reqWorkForm;
|
||||
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;
|
||||
|
||||
resetDailyWorkForm();
|
||||
|
||||
if (id !== null && id !== undefined) {
|
||||
const obj = $(f).serializeObject();
|
||||
obj.id = mf.id.value;
|
||||
obj.searchMonth = obj.recordMonth;
|
||||
|
||||
ajaxUtil._ajaxAsyncMethod(
|
||||
`/api/household/daily/work/${id}`,
|
||||
obj,
|
||||
function (rstData, status) {
|
||||
setDailyWorkFormData(rstData);
|
||||
|
||||
document.querySelector($(mf).data('modalId')).ui.open();
|
||||
},
|
||||
function () {
|
||||
console.error('Do nothing error.')
|
||||
},
|
||||
'get'
|
||||
);
|
||||
|
||||
} else {
|
||||
document.querySelector($(mf).data('modalId')).ui.open();
|
||||
}
|
||||
}
|
||||
|
||||
const saveDailyWork = () => {
|
||||
const mf = document.reqWorkForm;
|
||||
let obj = $(mf).serializeObject();
|
||||
obj.inputType = 'SELF';
|
||||
obj.id = (obj.id === '' ? '0' : obj.id);
|
||||
|
||||
ajaxUtil._ajaxAsyncNoWaiting(
|
||||
'/api/household/daily/work/save',
|
||||
obj,
|
||||
function () {
|
||||
alert('등록이 완료되었습니다.');
|
||||
|
||||
document.querySelector($(mf).data('modalId')).ui.close();
|
||||
|
||||
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||
},
|
||||
function (code, rstData) {
|
||||
console.error('Do nothing. code: '+ code, rstData);
|
||||
},
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</html>
|
||||
@@ -548,7 +548,7 @@
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
<td class="underline">${ifNullHyphen(item.itemName)}</td><!-- 품목명 -->
|
||||
<td class="underline"><a href="javascript:void(0);" onclick="showDailyWorkModal(${item.id});">${ifNullHyphen(item.itemName)}</a></td> <!-- 품목명 -->
|
||||
<td>${ifNullHyphen(item.workName)}</td><!-- 작업명 -->
|
||||
<td class="align-right">${ifNullHyphen(item.workLandArea)}</td><!-- 작업면적 -->
|
||||
<td>${ifNullHyphen(item.areaUnitText)}</td><!-- 작업면적 단위 -->
|
||||
@@ -810,6 +810,8 @@
|
||||
|
||||
if (currentStep === 'INCOME') {
|
||||
showDailyIncomeModal();
|
||||
} else if (currentStep === 'WORK') {
|
||||
showDailyWorkModal();
|
||||
} else {
|
||||
alert('TODO : 추가');
|
||||
}
|
||||
|
||||
@@ -177,6 +177,7 @@
|
||||
|
||||
<!-- 일계부 모달 -->
|
||||
<th:block th:replace="households/modal/modal-daily-income :: modalFragment"/>
|
||||
<th:block th:replace="households/modal/modal-daily-work :: modalFragment"/>
|
||||
|
||||
<!-- 조사원 매핑 모달 -->
|
||||
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
|
||||
@@ -315,7 +316,7 @@
|
||||
const unitArea = tr.querySelector('.unit-self-input');
|
||||
const unitInput = tr.querySelector('.unit-self-input input');
|
||||
|
||||
if (el.value === 'code.record.unit.self') {
|
||||
if (el.value.indexOf('.self') !== -1) {
|
||||
unitInput.disabled = false;
|
||||
unitArea.classList.remove('input-disabled');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user