[FO] 일계부 자가농업 CRUD, 공통 수정
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?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.front.usecase.daily.farming.adapters.persistence.DailyFarmingMapper">
|
||||
|
||||
<select id="getDailyFarmingList"
|
||||
resultType="app.module.front.usecase.daily.farming.adapters.persistence.model.DailyFarmingDto">
|
||||
select ds.id, ds.daily_record_seq
|
||||
, ds.product_code, ds.product_self, ds.usage
|
||||
, ds.quantity, ds.unit_code, ds.unit_self, ds.estimated_value
|
||||
from daily_farming ds
|
||||
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
<if test="id != null and id != '0'">
|
||||
and ds.id = ${id}
|
||||
</if>
|
||||
order by
|
||||
ds.id desc
|
||||
</select>
|
||||
|
||||
<select id="getRecordExistCount" resultType="int">
|
||||
select count(1)
|
||||
from daily_farming ds
|
||||
<include refid="app.module.front.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="createDailyFarming" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_farming (
|
||||
daily_record_seq, income_mark, expense_mark
|
||||
, product_code, product_self, usage
|
||||
, quantity, unit_code, unit_self, estimated_value
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}, #{incomeMark}, #{expenseMark}
|
||||
, #{productCode}, #{productSelf}, #{usage}
|
||||
, #{quantity}, #{unitCode}, #{unitSelf}, #{estimatedValue}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDailyFarming">
|
||||
update daily_farming set <include refid="common.fields.UpdateBaseSet"/>
|
||||
, income_mark = #{incomeMark}
|
||||
, expense_mark = #{expenseMark}
|
||||
, product_code = #{productCode}
|
||||
, product_self = #{productSelf}
|
||||
, usage = #{usage}
|
||||
, quantity = #{quantity}
|
||||
, unit_code = #{unitCode}
|
||||
, unit_self = #{unitSelf}
|
||||
, estimated_value = #{estimatedValue}
|
||||
where is_deleted = false
|
||||
and daily_record_seq = #{dailyRecordSeq}
|
||||
and id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="removeDailyFarming">
|
||||
update daily_farming set
|
||||
<include refid="common.fields.DeleteBaseSet"/>
|
||||
where is_deleted = false
|
||||
and daily_record_seq = #{dailyRecordSeq}
|
||||
<if test="id != null and id != ''">
|
||||
and id = #{id}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -6,7 +6,7 @@
|
||||
resultType="app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto">
|
||||
select ddg.group_no, ddg.start_day, ddg.end_day
|
||||
, dr.id, dr.record_month, dr.day_group_no, dr.start_date, dr.end_date
|
||||
, dr.all_status, dr.income_status, dr.work_status, dr.expense_status, dr.power_status, dr.forestry_status
|
||||
, dr.all_status, dr.income_status, dr.work_status, dr.expense_status, dr.power_status, dr.forestry_status, dr.farming_status
|
||||
from daily_day_group ddg
|
||||
left join
|
||||
daily_record dr on dr.day_group_no = ddg.group_no and dr.is_deleted = false
|
||||
|
||||
@@ -42,6 +42,7 @@ uri.front.record.expense.{{pathVar}}=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
uri.front.record.work.{{pathVar}}=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
uri.front.record.power.{{pathVar}}=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
uri.front.record.forestry.{{pathVar}}=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
uri.front.record.farming.{{pathVar}}=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
uri.front.record.daily.done=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
|
||||
# \uAE30\uD0C0
|
||||
|
||||
@@ -132,7 +132,23 @@
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
<!--/* TODO 농업생산물 중 자가소비량 */-->
|
||||
<!--/* 농업생산물 중 자가소비량 */-->
|
||||
<ul class="detail-list"
|
||||
th:if="${item.name eq 'FARMING'}"
|
||||
>
|
||||
<th:block th:if="${#lists.isEmpty(farmingList)}">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</th:block>
|
||||
<th:block th:each="child, childStatus : ${farmingList}">
|
||||
<li>
|
||||
<p>[[${child.productLabel}]]</p>
|
||||
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
|
||||
th:text="|${#numbers.formatInteger(child.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<!--/* [정책] 자가농업 생산물 중 자가소비량은 7일차 등록일에만 노출 및 선택, 21일 이후는 마지막 날 */-->
|
||||
<!--/*<div class="component-input"
|
||||
<div class="component-input"
|
||||
th:if="${reqVO.groupNo eq 4 or reqVO.groupNo eq 8 or reqVO.groupNo eq 12
|
||||
or reqVO.groupNo eq 16 or reqVO.groupNo eq 17}">
|
||||
<label class="switch-inner type-txt">
|
||||
@@ -92,7 +92,7 @@
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>*/-->
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
145
front/src/main/resources/templates/record/farming/form.html
Normal file
145
front/src/main/resources/templates/record/farming/form.html
Normal file
@@ -0,0 +1,145 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||
|
||||
<th:block>
|
||||
<div class="modal-content-inner">
|
||||
<p class="form-desc">필수입력</p>
|
||||
<form name="reqModalForm">
|
||||
<input type="hidden" name="id" th:value="${detail.id}">
|
||||
<section class="form-group">
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
생산물
|
||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||
</p>
|
||||
</div>
|
||||
<div id="productCode" class="component-select bottom-sheet" data-props-default="생산물을 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="productCode" th:value="${detail.productCode}">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>생산물</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<li class="option" th:each="uiCode : ${recordFarming}"
|
||||
th:data-value="${uiCode.id}"
|
||||
th:text="${uiCode.codeText}"
|
||||
th:selected="${uiCode.id eq detail.productCode ? 'current' : ''}"
|
||||
></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input" data-option="직접 입력">
|
||||
<div class="input-field">
|
||||
<input type="text" name="productSelf" th:value="${detail.productSelf}" maxlength="30" placeholder="생산물을 입력해 주세요">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="usage" class="label-txt">
|
||||
용도
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="usage" name="usage" th:value="${detail.usage}" maxlength="30" placeholder="용도를 입력해 주세요">
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="quantity" class="label-txt">
|
||||
수량
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity"
|
||||
th:value="${detail.quantity}" maxlength="10" placeholder="수량을 입력해 주세요">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 2, 2.5</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="select-group">
|
||||
<div class="select-label">
|
||||
<p class="label-txt">
|
||||
단위
|
||||
</p>
|
||||
</div>
|
||||
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||
<input type="hidden" name="unitCode" th:value="${detail.unitCode}">
|
||||
<button type="button" class="select-box">
|
||||
<span class="select-txt"></span>
|
||||
</button>
|
||||
<div class="select-options">
|
||||
<div class="select-header">
|
||||
<p>단위</p>
|
||||
<button type="button" class="select-close">
|
||||
<span class="hide-txt">닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="select-scroll">
|
||||
<ul class="">
|
||||
<li class="option" th:each="uiCode : ${recordUnit}"
|
||||
th:data-value="${uiCode.id}"
|
||||
th:text="${uiCode.codeText}"
|
||||
th:selected="${uiCode.id eq detail.unitCode ? 'current' : ''}"
|
||||
></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input" data-option="직접 입력">
|
||||
<div class="input-field">
|
||||
<input type="text" name="unitSelf" th:value="${detail.unitSelf}" maxlength="30" placeholder="단위를 입력해 주세요">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<hr>
|
||||
|
||||
<section class="form-group">
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="estimatedValue" class="label-txt">
|
||||
현물평가액
|
||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field type-price">
|
||||
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue"
|
||||
th:value="${detail.estimatedValue}" maxlength="10" placeholder="금액을 입력해 주세요">
|
||||
<span class="input-field-txt">원</span>
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 30000</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="component-btns">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn btn-full btn-l btn-primary" onclick="modalControl.createVaild();">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</th:block>
|
||||
|
||||
</html>
|
||||
219
front/src/main/resources/templates/record/farming/index.html
Normal file
219
front/src/main/resources/templates/record/farming/index.html
Normal file
@@ -0,0 +1,219 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||
|
||||
<div layout:fragment="content" th:classappend="acco-wrap">
|
||||
<main id="content" role="main">
|
||||
<div class="inner">
|
||||
<hgroup class="tit-group">
|
||||
<h3>
|
||||
<th:block th:if="${dailyRecord.startDay eq dailyRecord.endDay}">
|
||||
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]], <br>
|
||||
</th:block>
|
||||
<th:block th:if="not ${dailyRecord.startDay eq dailyRecord.endDay}">
|
||||
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]]~[[${#temporals.format(dailyRecord.endDate, 'd일')}]], <br>
|
||||
</th:block>
|
||||
<strong>농업생산물 중 자가소비량 내역 [[${#lists.isEmpty(farmingList) ? 0 : #lists.size(farmingList)}]]건 등록</strong>
|
||||
되었습니다.
|
||||
</h3>
|
||||
<p th:if="${#lists.isEmpty(farmingList)}">자가농업생산물 중 자가소비량 내역을 등록해 주세요.</p>
|
||||
<p th:unless="${#lists.isEmpty(farmingList)}">등록 내용을 확인하거나 다음 단계로 이동하세요.</p>
|
||||
</hgroup>
|
||||
|
||||
<!--/* 신규 등록 */-->
|
||||
<th:block th:if="${#lists.isEmpty(farmingList)}">
|
||||
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
||||
th:disabled="${#strings.equals(dailyRecord.farmingStatus, 'TODAY_NONE')}">
|
||||
<i class="ico-small" aria-hidden="true"
|
||||
th:classappend="${#strings.equals(dailyRecord.farmingStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
|
||||
<span class="btn-txt">추가 등록</span>
|
||||
</button>
|
||||
<div class="component-input align-center">
|
||||
<label class="checkbox-inner" id="todayNone">
|
||||
<input type="checkbox" name="todayNone"
|
||||
data-type="FARMING"
|
||||
th:checked="${#strings.equals(dailyRecord.farmingStatus, 'TODAY_NONE')}">
|
||||
<span class="checkbox-item">
|
||||
<span class="checkbox-txt">금일 등록내용 없음</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<ul class="info-bullet-list">
|
||||
<li>
|
||||
다른 임가가 생산한 것을 취득하거나 외부로부터의 구입 • 증여한 것은 제외해 주세요.
|
||||
</li>
|
||||
</ul>
|
||||
</th:block>
|
||||
<!--/* 목록 */-->
|
||||
<th:block th:unless="${#lists.isEmpty(farmingList)}">
|
||||
<section class="regist-item-area">
|
||||
<p class="total">
|
||||
<span>총 <strong>[[${#lists.size(farmingList)}]]</strong>건</span>
|
||||
<button type="button" class="btn-reset" onclick="krip.daily.resetConfirm()">
|
||||
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||
<span>초기화</span>
|
||||
</button>
|
||||
</p>
|
||||
<div class="item-list">
|
||||
<div class="list-item"
|
||||
th:each="item, itemStatus : ${farmingList}">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">[[${item.productLabel}]]</p>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="delete" th:onclick="krip.daily.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
|
||||
<button type="button" class="edit" th:onclick="krip.daily.createModal([[${item.id}]])"><span class="hide-txt">수정</span></button>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li th:if="${not #strings.isEmpty(item.usage)}">
|
||||
<p>용도</p>
|
||||
<span th:text="${item.usage}">0시간</span>
|
||||
</li>
|
||||
<li th:if="${not #strings.isEmpty(item.quantity)}">
|
||||
<p>수량</p>
|
||||
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
|
||||
</li>
|
||||
<li th:if="${not #strings.isEmpty(item.estimatedValue)}">
|
||||
<p>현물평가액</p>
|
||||
<span th:text="|${#numbers.formatInteger(item.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01">
|
||||
<i class="ico-add ico-small" aria-hidden="true"></i>
|
||||
<span class="btn-txt">추가 등록</span>
|
||||
</button>
|
||||
<ul class="info-bullet-list">
|
||||
<li>
|
||||
다른 임가가 생산한 것을 취득하거나 외부로부터의 구입 • 증여한 것은 제외해 주세요.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</th:block>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- 하단 고정 버튼 -->
|
||||
<div class="component-btns fixed"
|
||||
th:if="${moveStep}">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn btn-l btn-secondary" onclick="krip.daily.goToPrev();">
|
||||
<span class="btn-txt">이전 단계로 이동</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-l btn-primary"
|
||||
th:disabled="${not #strings.equals(dailyRecord.farmingStatus, 'TODAY_NONE') and #lists.isEmpty(farmingList)}"
|
||||
th:onclick="krip.daily.goToNext([[${nextStep}]], [[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
|
||||
<span class="btn-txt">다음 단계로 이동</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 모달 팝업 -->
|
||||
<div class="layer-wrap">
|
||||
<div class="component-modal acco-wrap formModal" data-props-dimm-click="true">
|
||||
<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">
|
||||
<!--/* form */-->
|
||||
</div>
|
||||
<button type="button" class="modal-close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //모달 팝업 -->
|
||||
<!-- /* 건의사항 모달 팝업 */ -->
|
||||
<th:block th:replace="~{/record/comment-modal}"></th:block>
|
||||
<!-- /* //건의사항 모달 팝업 */ -->
|
||||
</div>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:src="@{/static/ui/page/daily-record.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
$(function() {
|
||||
formControl.init();
|
||||
});
|
||||
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[|/record/farming/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
|
||||
form: /*[[|/record/farming/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
|
||||
create: /*[[|/api/record/farming/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'createUrl',
|
||||
remove: /*[[|/api/record/farming/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
|
||||
reset: /*[[|/api/record/farming/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
|
||||
},
|
||||
modal: {
|
||||
// 등록 버튼
|
||||
selectorId: '.button-modal01',
|
||||
// 등록 영역
|
||||
selector: '.formModal',
|
||||
},
|
||||
month: /*[[${reqVO.searchMonth}]]*/'month',
|
||||
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
|
||||
submitted: false,
|
||||
};
|
||||
|
||||
let formControl = {
|
||||
init() {
|
||||
krip.daily.baseBindUI();
|
||||
},
|
||||
};
|
||||
|
||||
let modalControl = {
|
||||
_bindModelUI() {
|
||||
const $select1 = document.querySelector('#productCode');
|
||||
const selectboxInstance1 = new etUI.components.SelectBox();
|
||||
selectboxInstance1.core.init($select1, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="productCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
}
|
||||
});
|
||||
|
||||
const $select2 = document.querySelector('#unitCode');
|
||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||
selectboxInstance2.core.init($select2, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="unitCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
}
|
||||
});
|
||||
|
||||
const $formWrap = $(ENV.modal.selector).find('form');
|
||||
|
||||
// data set
|
||||
selectboxInstance1.setValue($formWrap.find('input[name="productCode"]').val());
|
||||
selectboxInstance2.setValue($formWrap.find('input[name="unitCode"]').val());
|
||||
},
|
||||
createVaild() {
|
||||
modalControl.create();
|
||||
},
|
||||
create() {
|
||||
const f = document.reqModalForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
|
||||
obj,
|
||||
function (rstData, status) {
|
||||
location.reload();
|
||||
},
|
||||
);
|
||||
},
|
||||
};
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user