[FO] 일계부 동력 사용시간 CRUD, 일계부 공통 수정

This commit is contained in:
김현주
2025-06-18 16:44:21 +09:00
parent 5e59e1ba9c
commit ae3652c852
27 changed files with 1283 additions and 84 deletions

View File

@@ -12,26 +12,140 @@
</div>
</th:block>
<main id="content" role="main">
일계부 등록이
모두 완료 되었습니다.
<div class="inner">
<hgroup class="tit-group">
<i class="ico-alert-lightgreen ico-xlarge" aria-hidden="true"></i>
<h3>
일계부 등록이 <br>
모두 완료 되었습니다.
</h3>
<p>
입력하신 내용은 자동으로 등록되었습니다. <br>
항목에 대한 '추가/수정/삭제'는 일계부에서 가능합니다.
</p>
</hgroup>
<section class="regist-item-area complete">
<div class="item-list">
<div class="list-item"
th:each="item, itemStatus : ${dailyRecord.targetList}"
th:classappend="${(item.name eq 'INCOME' && #lists.isEmpty(incomeList))
|| (item.name eq 'EXPENSE' && #lists.isEmpty(expenseList))
|| (item.name eq 'POWER' && #lists.isEmpty(powerList))} ? 'no-data'"
>
<div class="item-tit-group">
<p class="item-name">[[${item.desc}]]</p>
</div>
<!--/* 수입 */-->
<ul class="detail-list"
th:if="${item.name eq 'INCOME'}"
>
<th:block th:if="${#lists.isEmpty(incomeList)}">
<li>
<p>없음</p>
</li>
</th:block>
<th:block th:each="child, childStatus : ${incomeList}">
<li>
<p>[[${child.categorySelf}]]</p>
<span th:if="${not #strings.isEmpty(child.price)}"
th:text="|${#numbers.formatInteger(child.price, 1, 'COMMA')}원|">302,000원</span>
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
th:text="|${#numbers.formatInteger(child.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
</li>
</th:block>
</ul>
<!--/* 지출 */-->
<ul class="detail-list"
th:if="${item.name eq 'EXPENSE'}"
>
<th:block th:if="${#strings.isEmpty(expenseList)}">
<li>
<p>없음</p>
</li>
</th:block>
<th:block th:each="child, childStatus : ${expenseList}">
<li>
<p>[[${child.categorySelf}]]</p>
<span th:if="${not #strings.isEmpty(child.price)}"
th:text="|${#numbers.formatInteger(child.price, 1, 'COMMA')}원|">302,000원</span>
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
th:text="|${#numbers.formatInteger(child.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
</li>
</th:block>
</ul>
<!--/* TODO 임업노동 투입 */-->
<!--/*<ul class="detail-list"
th:if="${item.name eq 'WORK'}"
>
<th:block th:if="${#strings.isEmpty(workList)}">
<li>
<p>없음</p>
</li>
</th:block>
<th:block th:each="child, childStatus : ${workList}">
<li>
<p>호두</p>
<span>
<span>수확</span>
<span>총 23시간</span>
</span>
</li>
<li>
<p>밤</p>
<span>
<span>줍기</span>
<span>총 12시간</span>
</span>
</li>
<li>
<p>밤</p>
<span>
<span>선별</span>
<span>총 2시간</span>
</span>
</li>
</th:block>
</ul>*/-->
<!--/* 동력 사용시간 */-->
<ul class="detail-list"
th:if="${item.name eq 'POWER'}"
>
<th:block th:if="${#strings.isEmpty(powerList)}">
<li>
<p>없음</p>
</li>
</th:block>
<th:block th:each="child, childStatus : ${powerList}">
<li>
<p>[[${child.equipmentName}]]</p>
<span th:if="${not #strings.isEmpty(child.ownedHours)}"
th:text="|총${#numbers.formatInteger(child.ownedHours, 1, 'COMMA')}시간|">총8시간</span>
<span th:if="${not #strings.isEmpty(child.leasedHours)}"
th:text="|총${#numbers.formatInteger(child.leasedHours, 1, 'COMMA')}시간|">총8시간</span>
</li>
</th:block>
</ul>
<!--/* TODO 임업생산물 중 자가소비량 */-->
<!--/* TODO 농업생산물 중 자가소비량 */-->
</div>
</div>
</section>
</div>
</main>
<div class="component-btns fixed">
<div class="btns-row">
<button type="button" class="btn btn-l btn-primary" onclick="krip.daily.goToMain();">
<span class="btn-txt">확인</span>
</button>
</div>
</div>
</div>
<section layout:fragment="script">
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
let ENV = {
httpUrl: {
create: /*[[|/api/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'createUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
submitted: false,
};
let formControl = {
};
</script>
</section>
</html>

View File

@@ -30,56 +30,6 @@
</li>
</ul>
</div>
<div class="list-item no-data">
<div class="item-tit-group">
<p class="item-name">임업노동 투입</p>
</div>
<ul class="detail-list">
<li>
<p>없음</p>
</li>
</ul>
</div>
<div class="list-item no-data">
<div class="item-tit-group">
<p class="item-name">지출</p>
</div>
<ul class="detail-list">
<li>
<p>없음</p>
</li>
</ul>
</div>
<div class="list-item no-data">
<div class="item-tit-group">
<p class="item-name">동력 사용시간</p>
</div>
<ul class="detail-list">
<li>
<p>없음</p>
</li>
</ul>
</div>
<div class="list-item no-data">
<div class="item-tit-group">
<p class="item-name">임업생산물 중 자가소비량</p>
</div>
<ul class="detail-list">
<li>
<p>없음</p>
</li>
</ul>
</div>
<div class="list-item no-data">
<div class="item-tit-group">
<p class="item-name">농업생산물 중 자가소비량</p>
</div>
<ul class="detail-list">
<li>
<p>없음</p>
</li>
</ul>
</div>
</div>
</section>

View File

@@ -60,7 +60,7 @@
</span>
</label>
</div>
<!--/*<div class="component-input">
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">동력 사용시간</span>
<input type="checkbox" name="powerStatus" value="TARGET" data-target="power"
@@ -70,7 +70,7 @@
</span>
</label>
</div>
<div class="component-input">
<!--/*<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">자가임업 생산물 중 자가소비량</span>
<input type="checkbox" name="forestryStatus" value="TARGET" data-target="forestry"
@@ -114,7 +114,7 @@
</div>
<section layout:fragment="script">
<script th:src="@{/ui/page/daily-record.js}"></script>
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
let ENV = {
httpUrl: {
@@ -164,7 +164,8 @@
create() {
const f = document.reqForm;
if ($(f).find('input:checked').length === 0) {
const $checked = $(f).find('input:checked');
if ($checked.length === 0) {
f.todayNone.value = 'Y';
}
@@ -179,6 +180,8 @@
} else {
krip.daily.goToDone(ENV.month, ENV.groupNo);
}
} else if ($checked.data('target') !== undefined) {
krip.daily.goToNext($checked.data('target'), ENV.month, ENV.groupNo);
} else {
krip.daily.goToMain();
}

View File

@@ -108,7 +108,7 @@
<!-- 모달 팝업 -->
<div class="layer-wrap">
<div class="component-modal acco-wrap modal01" data-props-dimm-click="true">
<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">
@@ -148,7 +148,7 @@
// 등록 버튼
selectorId: '.button-modal01',
// 등록 영역
selector: '.modal01',
selector: '.formModal',
},
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',

View File

@@ -112,7 +112,7 @@
<!-- 모달 팝업 -->
<div class="layer-wrap">
<div class="component-modal acco-wrap modal01" data-props-dimm-click="true">
<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">
@@ -152,7 +152,7 @@
// 등록 버튼
selectorId: '.button-modal01',
// 등록 영역
selector: '.modal01',
selector: '.formModal',
},
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',

View File

@@ -0,0 +1,77 @@
<!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="component-input">
<div class="input-label">
<label for="equipmentName" class="label-txt">
명칭
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field">
<input type="text" id="equipmentName" name="equipmentName" th:value="${detail.equipmentName}" maxlength="30" placeholder="사용 기계 이름을 입력해 주세요">
</div>
<ul class="guide-info">
<li>예 : 예초기</li>
</ul>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-segment">
<div class="segment-label">
<p class="label-txt">
동력 사용시간 <i class="ico-required-mark" role="img" aria-label="필수">*</i>
</p>
<span class="label-sub-txt">
동력 사용시간은 자가와 임차로 구분해 입력해 주세요.
</span>
</div>
</div>
<div class="component-input type-sub">
<div class="input-label">
<label for="ownedHours" class="label-txt">
자가 사용시간
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field type-hour">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="ownedHours" name="ownedHours" th:value="${detail.ownedHours}" maxlength="10" placeholder="자가에서 사용한 동력 사용시간을 입력해 주세요">
<span class="input-field-txt">시간</span>
</div>
</div>
<div class="component-input type-sub">
<div class="input-label">
<label for="leasedHours" class="label-txt">
임차 사용시간
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field type-hour">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="leasedHours" name="ownedHours" th:value="${detail.ownedHours}" maxlength="10" placeholder="임차해서 사용한 동력 사용시간을 입력해 주세요">
<span class="input-field-txt">시간</span>
</div>
</div>
</section>
</form>
<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>
</div>
</th:block>
</html>

View File

@@ -0,0 +1,251 @@
<!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(incomeList) ? 0 : #lists.size(incomeList)}]]건 등록</strong> <br>
되었습니다.
</h3>
<p>동력 사용내역을 등록해 주세요.</p>
</hgroup>
<!--/* 신규 등록 */-->
<th:block th:if="${#lists.isEmpty(incomeList)}">
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
th:disabled="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
<i class="ico-small" aria-hidden="true"
th:classappend="${#strings.equals(dailyRecord.incomeStatus, '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="INCOME"
th:checked="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
<span class="checkbox-item">
<span class="checkbox-txt">금일 등록내용 없음</span>
</span>
</label>
</div>
</th:block>
<!--/* 목록 */-->
<th:block th:unless="${#lists.isEmpty(incomeList)}">
<section class="regist-item-area">
<p class="total">
<span>총 <strong>[[${#lists.size(incomeList)}]]</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 : ${incomeList}">
<div class="item-tit-group">
<p class="item-name">[[${item.categorySelf}]]</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="${item.credit != null}">
<p>외상판매</p>
<span th:text="${item.credit ? '예' : '아니오'}">아니오</span>
</li>
<li th:if="${not #strings.isEmpty(item.cropLabel)}">
<p>재배형태</p>
<span th:text="${item.cropLabel}">재배형태</span>
</li>
<li th:if="${not #strings.isEmpty(item.sourcePurpose)}">
<p>수입원</p>
<span th:text="${item.sourcePurpose}">소비자</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.price)}">
<p>현금 </p>
<span th:text="|${#numbers.formatInteger(item.price, 1, 'COMMA')}원|">302,000원</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>
</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.incomeStatus, 'TODAY_NONE') and #lists.isEmpty(incomeList)}"
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/power/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
form: /*[[|/record/power/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
create: /*[[|/api/record/power/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'createUrl',
remove: /*[[|/api/record/power/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/power/${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('#cropCode');
const selectboxInstance1 = new etUI.components.SelectBox();
selectboxInstance1.core.init($select1, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="cropCode"]').val(dataValue)
}
});
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');
const $price = $(ENV.modal.selector).find('form input[name="price"]');
const $estimatedValue = $(ENV.modal.selector).find('form input[name="estimatedValue"]');
$price.on('keyup', function() {
if ($(this).val() === '') {
modalControl._priceActive($estimatedValue);
} else {
modalControl._priceDisabled($estimatedValue);
}
});
$estimatedValue.on('keyup', function() {
if ($(this).val() === '') {
modalControl._priceActive($price);
} else {
modalControl._priceDisabled($price);
}
});
// data set
selectboxInstance1.setValue($formWrap.find('input[name="cropCode"]').val());
//selectboxInstance1.update();
selectboxInstance2.setValue($formWrap.find('input[name="unitCode"]').val());
//selectboxInstance2.update();
if ($price.val() === '' && $estimatedValue.val() !== '') {
modalControl._priceDisabled($price);
} else if ($price.val() !== '' && $estimatedValue.val() === '') {
modalControl._priceDisabled($estimatedValue);
}
},
_priceActive($input) {
$input.val('').attr('disabled', false);
$input.parent().parent().closest('.component-input').removeClass('input-disabled');
},
_priceDisabled($input) {
$input.val('').attr('disabled', true);
$input.parent().parent().closest('.component-input').addClass('input-disabled');
},
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>