[BO] 일계부 노동투입 등록, 수정
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.SaveDailyWorkMapper">
|
||||
|
||||
<select id="getDailyWork"
|
||||
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto">
|
||||
select ds.id, ds.daily_record_seq
|
||||
, ds.item_name, ds.work_name
|
||||
, ds.work_land_area, ds.area_unit_code, ds.area_unit_self, ds.harvest_quantity, ds.harvest_unit_code, ds.harvest_unit_self
|
||||
, ds.owner_time, ds.spouse_time, ds.family_m_hours, ds.family_f_hours, ds.hired_m_hours
|
||||
, ds.hired_f_hours, ds.shared_m_hours, ds.shared_f_hours, ds.volunteer_m_hours, ds.volunteer_f_hours
|
||||
from daily_work ds
|
||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
and ds.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getRecordExistCount" resultType="int">
|
||||
select count(1)
|
||||
from daily_work ds
|
||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
<if test="id != null and id != '0'">
|
||||
and ds.id = #{id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="createDailyWork" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_work (
|
||||
daily_record_seq
|
||||
, item_name, work_name
|
||||
, work_land_area, area_unit_code, area_unit_self, harvest_quantity, harvest_unit_code, harvest_unit_self
|
||||
, owner_time, spouse_time, family_m_hours, family_f_hours, hired_m_hours, hired_f_hours, shared_m_hours, shared_f_hours, volunteer_m_hours, volunteer_f_hours
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}
|
||||
, #{itemName}, #{workName}
|
||||
, #{workLandArea}, #{areaUnitCode}, #{areaUnitSelf}, #{harvestQuantity}, #{harvestUnitCode}, #{harvestUnitSelf}
|
||||
, #{ownerTime}, #{spouseTime}, #{familyMHours}, #{familyFHours}, #{hiredMHours}, #{hiredFHours}, #{sharedMHours}, #{sharedFHours}, #{volunteerMHours}, #{volunteerFHours}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDailyWork">
|
||||
update daily_work set <include refid="common.fields.UpdateBaseSet"/>
|
||||
, item_name = #{itemName}
|
||||
, work_name = #{workName}
|
||||
, work_land_area = #{workLandArea}
|
||||
, area_unit_code = #{areaUnitCode}
|
||||
, area_unit_self = #{areaUnitSelf}
|
||||
, harvest_quantity = #{harvestQuantity}
|
||||
, harvest_unit_code = #{harvestUnitCode}
|
||||
, harvest_unit_self = #{harvestUnitSelf}
|
||||
, owner_time = #{ownerTime}
|
||||
, spouse_time = #{spouseTime}
|
||||
, family_m_hours = #{familyMHours}
|
||||
, family_f_hours = #{familyFHours}
|
||||
, hired_m_hours = #{hiredMHours}
|
||||
, hired_f_hours = #{hiredFHours}
|
||||
, shared_m_hours = #{sharedMHours}
|
||||
, shared_f_hours = #{sharedFHours}
|
||||
, volunteer_m_hours = #{volunteerMHours}
|
||||
, volunteer_f_hours = #{volunteerFHours}
|
||||
where is_deleted = false
|
||||
and daily_record_seq = #{dailyRecordSeq}
|
||||
and id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -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