Merge branch 'bo_daily' into dev
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?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.createDailyIncome.adapters.persistence.CreateDailyIncomeMapper">
|
||||
|
||||
<select id="getDailyIncome"
|
||||
resultType="app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto">
|
||||
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
||||
, ds.crop_code, ds.income_kind, ds.source_purpose
|
||||
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
|
||||
from daily_income 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_income 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="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_income (
|
||||
daily_record_seq, input_type, category, expense_mark
|
||||
, is_credit, crop_code, income_kind, source_purpose
|
||||
, quantity, unit_code, unit_self, price, estimated_value
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}, #{inputType}, #{category}, #{expenseMark}
|
||||
, #{credit}, #{cropCode}, #{incomeKind}, #{sourcePurpose}
|
||||
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDailyIncome">
|
||||
update daily_income set <include refid="common.fields.UpdateBaseSet"/>
|
||||
, is_credit = #{credit}
|
||||
, expense_mark = #{expenseMark}
|
||||
, crop_code = #{cropCode}
|
||||
, income_kind = #{incomeKind}
|
||||
, source_purpose = #{sourcePurpose}
|
||||
, quantity = #{quantity}
|
||||
, unit_code = #{unitCode}
|
||||
, unit_self = #{unitSelf}
|
||||
, price = #{price}
|
||||
, estimated_value = #{estimatedValue}
|
||||
where is_deleted = false
|
||||
and daily_record_seq = #{dailyRecordSeq}
|
||||
and id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -25,47 +25,17 @@ var ajaxUtil = {
|
||||
},
|
||||
|
||||
_alertError : function (code) {
|
||||
var message = ajaxUtil._msg500;
|
||||
if (code == '400') {
|
||||
let message = ajaxUtil._msg500;
|
||||
if (code === '400') {
|
||||
message = ajaxUtil._msg400;
|
||||
}
|
||||
|
||||
ajaxUtil._alert(message, '오류 안내');
|
||||
},
|
||||
_alert : function (alertMessage, alertTitle, afterEvent) {
|
||||
etUI.dialog.alert({
|
||||
title: alertTitle,
|
||||
message: alertMessage,
|
||||
type: "alert",
|
||||
callback: function() {
|
||||
console.log("alert callback");
|
||||
},
|
||||
});
|
||||
},
|
||||
_alertId : function (alertId, afterEvent) {
|
||||
ajaxUtil._alertMethod({
|
||||
id: alertId,
|
||||
title: null,
|
||||
message: null,
|
||||
after: afterEvent !== undefined ? (afterEvent ? 'Y' : 'N') : 'N',
|
||||
});
|
||||
},
|
||||
_alertMethod : function (jsonObj) {
|
||||
ajaxUtil._ajaxSyncNoWaiting(
|
||||
'/m/common/alert',
|
||||
jsonObj,
|
||||
function(rstData) {
|
||||
var $wrap = $('#bindWrap');
|
||||
if ($wrap.find('.ui-popup-common-alert').length != 0) {
|
||||
$wrap.find('.ui-popup-common-alert').remove();
|
||||
}
|
||||
_alert : function (alertMessage, alertTitle) {
|
||||
console.warn(alertTitle)
|
||||
|
||||
$wrap.append(rstData);
|
||||
uxgFn.popup.bind('.ui-popup-common-alert').open();
|
||||
},
|
||||
function(code, rstData) {
|
||||
kri.logger.error('Do nothing. code: '+ code, rstData);
|
||||
},
|
||||
'html');
|
||||
alert(alertMessage);
|
||||
},
|
||||
|
||||
|
||||
@@ -130,22 +100,22 @@ var ajaxUtil = {
|
||||
contentType : 'application/json; charset=UTF-8',
|
||||
async: async,
|
||||
statusCode : {
|
||||
400:function(){
|
||||
ajaxUtil._alertError(ajaxUtil.$400);
|
||||
},
|
||||
404:function(rstData){
|
||||
ajaxUtil._hideWaiting();
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
errorCallback(ajaxUtil.$404, rstData);
|
||||
} else {
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 404');
|
||||
console.error('statusCode: 404');
|
||||
}
|
||||
},
|
||||
401:function(){
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 401');
|
||||
console.error('statusCode: 401');
|
||||
},
|
||||
403:function(rstData){
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 403');
|
||||
console.error('statusCode: 403');
|
||||
},
|
||||
422:function(rstData, status) {
|
||||
console.log(rstData);
|
||||
@@ -195,13 +165,15 @@ var ajaxUtil = {
|
||||
},
|
||||
success : function(rstData, status) {
|
||||
ajaxUtil._hideWaiting();
|
||||
console.log('succ', rstData)
|
||||
if (typeof successCallback !== 'undefined') {
|
||||
successCallback(rstData, status);
|
||||
}
|
||||
},
|
||||
error : function(rstData) {
|
||||
ajaxUtil._hideWaiting();
|
||||
if (!(rstData.status == 500 || rstData.status == 422)) {
|
||||
console.log('error')
|
||||
if (!(rstData.status == 500 || rstData.status == 422 || rstData.status == 400)) {
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
errorCallback(rstData.status, rstData);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
<!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="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>
|
||||
<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>외상판매 여부</th>
|
||||
<td class="radio-group">
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="isCredit_N" name="credit" value="false" checked>
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">N</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="radio-inner">
|
||||
<input type="radio" id="isCredit_Y" name="credit" value="true">
|
||||
<span class="radio-item">
|
||||
<span class="radio-txt">Y</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<th>재배형태</th>
|
||||
<td>
|
||||
<div class="component-select">
|
||||
<select class="select-list" name="cropCode" required>
|
||||
<option value="">선택</option>
|
||||
<option th:each="item : ${recordCrop}"
|
||||
th:value="${item.id}"
|
||||
th:text="${item.codeText}">
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<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="incomeKind" name="incomeKind" 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="sourcePurpose" name="sourcePurpose" 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="quantity" name="quantity" 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="unitCode" 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="unitSelf" name="unitSelf" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>현금(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="numeric" pattern="[0-9]*" id="price" name="price" step="0" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.estimatedValue)">
|
||||
</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="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue" step="0" min="1" max="9999999999"
|
||||
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.price)">
|
||||
</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="saveDailyIncome();">
|
||||
<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 resetIncomeForm = () => {
|
||||
const form = document.reqIncomeForm;
|
||||
if (!form) return;
|
||||
|
||||
form.cropCode.value = '';
|
||||
form.incomeKind.value = '';
|
||||
form.sourcePurpose.value = '';
|
||||
form.quantity.value = '';
|
||||
form.unitCode.value = '';
|
||||
form.unitSelf.value = '';
|
||||
form.price.value = '';
|
||||
form.estimatedValue.value = '';
|
||||
document.getElementById('isCredit_N').checked = true;
|
||||
}
|
||||
|
||||
// 일계부 상세 값 set
|
||||
const setIncomeFormData = (data) => {
|
||||
const form = document.reqIncomeForm;
|
||||
if (!form) return;
|
||||
|
||||
// 폼에 값 세팅
|
||||
form.cropCode.value = data.cropCode || '';
|
||||
form.incomeKind.value = data.incomeKind || '';
|
||||
form.sourcePurpose.value = data.sourcePurpose || '';
|
||||
form.quantity.value = data.quantity || '';
|
||||
form.unitCode.value = data.unitCode || '';
|
||||
form.unitSelf.value = data.unitSelf || '';
|
||||
form.price.value = data.price || '';
|
||||
form.estimatedValue.value = data.estimatedValue || '';
|
||||
|
||||
if (form.price.value !== '') {
|
||||
priceDisabled(form.price, form.estimatedValue)
|
||||
} else {
|
||||
priceDisabled(form.estimatedValue, form.price)
|
||||
}
|
||||
|
||||
// 라디오 버튼 처리
|
||||
document.getElementById('isCredit_Y').checked = data.credit === true;
|
||||
document.getElementById('isCredit_N').checked = data.credit === false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 일계부 등록 모달창 띄우기
|
||||
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 mf = document.reqIncomeForm;
|
||||
let obj = $(mf).serializeObject();
|
||||
obj.inputType = 'SELF';
|
||||
|
||||
ajaxUtil._ajaxAsyncNoWaiting(
|
||||
'/api/household/daily/income/' + (obj.id === '' ? '0' : obj.id),
|
||||
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>
|
||||
@@ -508,7 +508,7 @@
|
||||
</td>
|
||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
||||
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
|
||||
<td class="underline">${ifNullHyphen(item.incomeKind)}</td><!-- 수입의 종류 -->
|
||||
<td class="underline"><a href="javascript:void(0);" onclick="showDailyIncomeModal(${item.id});">${ifNullHyphen(item.incomeKind)}</a></td> <!-- 수입의 종류 -->
|
||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||
<td class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
|
||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||
@@ -806,9 +806,13 @@
|
||||
const saveDaily = (el) => {
|
||||
const currentStep = $(el).data('step');
|
||||
const currentModalId = $(el).data('modalId');
|
||||
console.log('removeDaily', currentStep, currentModalId);
|
||||
console.log('saveDaily', currentStep, currentModalId);
|
||||
|
||||
alert('TODO : 추가')
|
||||
if (currentStep === 'INCOME') {
|
||||
showDailyIncomeModal();
|
||||
} else {
|
||||
alert('TODO : 추가');
|
||||
}
|
||||
}
|
||||
|
||||
// 일계부 삭제 처리
|
||||
|
||||
@@ -175,6 +175,9 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- 일계부 모달 -->
|
||||
<th:block th:replace="households/modal/modal-daily-income :: modalFragment"/>
|
||||
|
||||
<!-- 조사원 매핑 모달 -->
|
||||
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
|
||||
|
||||
@@ -321,6 +324,22 @@
|
||||
unitArea.classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
|
||||
// 금액 1개 입력시 다른 금액 input disable
|
||||
const priceDisabled = (el, disableEl) => {
|
||||
const wrap = disableEl.closest('td');
|
||||
const disableArea = wrap.querySelector('.component-input');
|
||||
const disableInput = wrap.querySelector('input');
|
||||
|
||||
if (el.value === '') {
|
||||
disableInput.disabled = false;
|
||||
disableArea.classList.remove('input-disabled');
|
||||
} else {
|
||||
disableInput.disabled = true;
|
||||
disableInput.value = '';
|
||||
disableArea.classList.add('input-disabled');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user