[BO] 일계부 등록 현황의 금일 데이터 없음

This commit is contained in:
김현주
2025-06-26 13:49:24 +09:00
parent 7e8c489ff5
commit 1f689376de
18 changed files with 537 additions and 33 deletions

View File

@@ -34,6 +34,7 @@
)
SELECT
dr.id AS id,
ddg.group_no AS day_group_no,
/* 해당 월의 말일을 기준으로 종료일을 제한하여 일자 그룹 표시 */
ddg.start_day ||
CASE

View File

@@ -0,0 +1,68 @@
<?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.updateDailyNone.adapters.persistence.UpdateDailyNoneMapper">
<select id="getDailyRecordSeq">
select id
from daily_record
where is_deleted = false
and record_month = #{searchMonth}
and day_group_no = #{groupNo}
and household_seq = #{householdSeq}
</select>
<select id="removeDailyIncome">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_income set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyWork">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_work set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyExpense">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_expense set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyPower">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_power set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyForestry">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_forestry set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyFarming">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_farming set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
</mapper>

View File

@@ -4,6 +4,10 @@
<div class="layer-wrap" th:fragment="tabFragment">
<div class="tab-content daily-record" data-tab-value="tab1" >
<input type="hidden" name="dailyId">
<input type="hidden" name="groupNo">
<input type="hidden" name="dayGroupText">
<!-- 일계부 등록 현황 리스트 -->
<div class="daily-record-content daily-record-list">
<div class="content-inner">
@@ -11,23 +15,23 @@
<ul>
<li>
<p>작성완료</p>
<span><strong id="doneCount">6</strong>건</span>
<span><strong id="doneCount">0</strong>건</span>
</li>
<li>
<p>미작성</p>
<span><strong id="emptyCount">6</strong>건</span>
<span><strong id="emptyCount">0</strong>건</span>
</li>
<li>
<p>미완료</p>
<span><strong id="incompleteCount">6</strong>건</span>
<span><strong id="incompleteCount">0</strong>건</span>
</li>
<li>
<p>대기</p>
<span><strong id="waitingCount">6</strong>건</span>
<span><strong id="waitingCount">0</strong>건</span>
</li>
<li>
<p>완료율</p>
<span><strong id="progressPercent">56.12</strong>%</span>
<span><strong id="progressPercent">0</strong>%</span>
</li>
</ul>
</article>
@@ -53,8 +57,21 @@
<!-- 일계부 등록 현황 상세 -->
<div class="daily-record-content daily-record-detail" style="display: none;">
<div class="content-inner">
<!-- 현황 -->
<section class="table-group">
<div class="table-tit-group">
<h3 class="_selectedGroupNo">현황</h3>
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn small" onclick="getDailyRecordsList()">
<span class="btn-txt">등록 현황 목록</span>
</button>
</div>
</div>
</div>
</section>
<!-- 수입 -->
<section class="table-group">
<div class="table-tit-group">
@@ -65,12 +82,19 @@
<span class="btn-txt">영수증 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn small">
<span class="btn-txt">등록여부</span>
<span class="btn-txt">
<label class="radio-inner">
<span class="radio-item">
<span class="radio-txt">금일 데이터 없음</span>
</span>
<input type="checkbox" id="incomeStatus" data-step="INCOME" onclick="showDailyNoneConfirm(this)">
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" style="display: none;" data-step="INCOME" data-list-id="table-income" onclick="removeDaily(this)">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<button type="button" class="btn small btn-primary" style="display: none;" data-step="INCOME" data-modal-id="modal-income" onclick="saveDaily(this)">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -104,12 +128,19 @@
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn small">
<span class="btn-txt">등록여부</span>
<span class="btn-txt">
<label class="radio-inner">
<span class="radio-item">
<span class="radio-txt">금일 데이터 없음</span>
</span>
<input type="checkbox" id="workStatus" data-step="WORK" onclick="showDailyNoneConfirm(this)">
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" style="display: none;" data-step="WORK" data-list-id="table-work" onclick="removeDaily(this)">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<button type="button" class="btn small btn-primary" style="display: none;" data-step="WORK" data-modal-id="modal-work" onclick="saveDaily(this)">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -159,12 +190,19 @@
<span class="btn-txt">영수증 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn small">
<span class="btn-txt">등록여부</span>
<span class="btn-txt">
<label class="radio-inner">
<span class="radio-item">
<span class="radio-txt">금일 데이터 없음</span>
</span>
<input type="checkbox" id="expenseStatus" data-step="EXPENSE" onclick="showDailyNoneConfirm(this)">
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" style="display: none;" data-step="EXPENSE" data-list-id="table-expense" onclick="removeDaily(this)">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<button type="button" class="btn small btn-primary" style="display: none;" data-step="EXPENSE" data-modal-id="modal-expense" onclick="saveDaily(this)">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -197,12 +235,19 @@
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn small">
<span class="btn-txt">등록여부</span>
<span class="btn-txt">
<label class="radio-inner">
<span class="radio-item">
<span class="radio-txt">금일 데이터 없음</span>
</span>
<input type="checkbox" id="powerStatus" data-step="POWER" onclick="showDailyNoneConfirm(this)">
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" style="display: none;" data-step="POWER" data-list-id="table-power" onclick="removeDaily(this)">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<button type="button" class="btn small btn-primary" style="display: none;" data-step="POWER" data-modal-id="modal-power" onclick="saveDaily(this)">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -231,12 +276,19 @@
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn small">
<span class="btn-txt">등록여부</span>
<span class="btn-txt">
<label class="radio-inner">
<span class="radio-item">
<span class="radio-txt">금일 데이터 없음</span>
</span>
<input type="checkbox" id="forestryStatus" data-step="FORESTRY" onclick="showDailyNoneConfirm(this)">
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" style="display: none;" data-step="FORESTRY" data-list-id="table-forestry" onclick="removeDaily(this)">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<button type="button" class="btn small btn-primary" style="display: none;" data-step="FORESTRY" data-modal-id="modal-forestry" onclick="saveDaily(this)">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -267,12 +319,19 @@
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn small">
<span class="btn-txt">등록여부</span>
<span class="btn-txt">
<label class="radio-inner">
<span class="radio-item">
<span class="radio-txt">금일 데이터 없음</span>
</span>
<input type="checkbox" id="farmingStatus" data-step="FARMING" onclick="showDailyNoneConfirm(this)">
</label>
</span>
</button>
<button type="button" class="btn small btn-secondary">
<button type="button" class="btn small btn-secondary" style="display: none;" data-step="FARMING" data-list-id="table-farming" onclick="removeDaily(this)">
<span class=" btn-txt">삭제</span>
</button>
<button type="button" class="btn small btn-primary">
<button type="button" class="btn small btn-primary" style="display: none;" data-step="FARMING" data-modal-id="modal-farming" onclick="saveDaily(this)">
<span class="btn-txt">추가</span>
</button>
</div>
@@ -300,10 +359,10 @@
</div>
<script th:inline="javascript">
const f = document.reqForm;
// 일계부 등록 현황 리스트 조회
const getDailyRecords = () => {
const f = document.reqForm;
ajaxUtil._ajaxMethod(
'/api/household/dailyRecordsStatus',
{
@@ -331,7 +390,7 @@
tmpl +=
`
<tr>
<td class="underline"><a href="javascript:void(0);" onclick="getDailyRecordsView(${item.id});">${item.dayGroup}</a></td>
<td class="underline"><a href="javascript:void(0);" onclick="getDailyRecordsView(${item.id}, ${item.dayGroupNo}, '${item.dayGroup}');">${item.dayGroup}</a></td>
<td>
<span class="tag ${statusInfoMap[item.allStatusType].className}">
${statusInfoMap[item.allStatusType].label}
@@ -357,15 +416,20 @@
);
}
// 임산물 등록 현황 상세
const getDailyRecordsView = (id) => {
// 일계부 등록 현황 상세
const getDailyRecordsView = (id, groupNo, dayGroupText) => {
if(id == null) {
alert('등록 내역이 없습니다.');
return;
}
f.dailyId.value = id;
f.groupNo.value = groupNo;
f.dayGroupText.value = dayGroupText;
const listArea = $('.tab-content .daily-record-list');
const detailArea = $('.tab-content .daily-record-detail');
detailArea.find('._selectedGroupNo').text(dayGroupText + '일 현황');
listArea.hide();
detailArea.show();
@@ -375,6 +439,24 @@
{ recordSeq: id },
function(response) { // 성공
console.log("일계부 등록 상세 데이터 : ", response);
// 금일 데이터 없음 체크
$('#incomeStatus').attr('checked', response.status.incomeStatus === 'TODAY_NONE');
$('#workStatus').attr('checked', response.status.workStatus === 'TODAY_NONE');
$('#expenseStatus').attr('checked', response.status.expenseStatus === 'TODAY_NONE');
$('#powerStatus').attr('checked', response.status.powerStatus === 'TODAY_NONE');
$('#forestryStatus').attr('checked', response.status.forestryStatus === 'TODAY_NONE');
if (response.status.farmingStatus === 'NONE') {
$('#farmingStatus').attr('disabled', true);
} else {
$('#farmingStatus').attr('disabled', false);
$('#farmingStatus').attr('checked', response.status.farmingStatus === 'TODAY_NONE');
}
// 금일 데이터 없음에 따라 버튼 hide 처리
showDailyNoneBtn();
// 상세 테이블 그리기
gridIncomeTable(response.status.incomeStatus, response.incomes);
gridWorkTable(response.status.workStatus, response.works);
gridExpenseTable(response.status.expenseStatus, response.expenses);
@@ -390,6 +472,17 @@
);
}
// 입력현황 목록
const getDailyRecordsList = () => {
getDailyRecords();
const listArea = $('.tab-content .daily-record-list');
const detailArea = $('.tab-content .daily-record-detail');
listArea.show();
detailArea.hide();
}
// 수입 테이블 그리기
const gridIncomeTable = (status, data) => {
const tbody = $('#table-income tbody');
@@ -637,6 +730,95 @@
tbody.append(tmpl);
}
// 금일 데이터 없음에 따라 버튼 hide/show 처리
const showDailyNoneBtn = () => {
$('.daily-record-detail').find('.table-tit-group').each(function(index, item) {
let checkedIndex = false;
$(item).find('[type="button"]').each(function(indexBtn, itemBtn) {
let $chkBox = $(itemBtn).find('input[type="checkbox"]');
if (($chkBox.length !== 0 && $chkBox.is(':disabled'))) {
checkedIndex = true;
}
if (checkedIndex) {
$(itemBtn).hide();
} else {
$(itemBtn).show();
}
if ($chkBox.length !== 0) {
checkedIndex = $chkBox.is(':checked') || $chkBox.is(':disabled');
}
});
});
}
// 데이터 초기화 Confirm
const showDailyNoneConfirm = (el) => {
const currentStep = $(el).data('step');
const todayNone = $(el).is(':checked') ? 'Y' : 'N';
if (currentStep === undefined) {
alert('변경할 수 없는 상태입니다.');
$(el).prop('checked', todayNone !== 'Y');
return;
}
const obj = $(f).serializeObject();
obj.currentStep = currentStep;
obj.todayNone = todayNone;
if (todayNone === 'Y') {
etUI.dialog.confirm({
title: '초기화 안내',
message: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
negativeCallback: function () {
$(el).prop('checked', todayNone !== 'Y');
},
positiveCallback: function () {
updateDailyNone(el, obj);
},
});
} else {
updateDailyNone(el, obj);
}
}
// 금일 데이터 없음 수정 처리
const updateDailyNone = (el, obj) => {
ajaxUtil._ajaxAsyncNoWaiting(
'/api/household/daily/today-none',
obj,
function () {
if (obj.todayNone === 'Y') {
alert('데이터 초기화가 완료되었습니다.');
} else {
alert('등록 상태가 변경되었습니다.');
}
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
},
);
}
// 일계부 등록 처리
const saveDaily = (el) => {
const currentStep = $(el).data('step');
const currentModalId = $(el).data('modalId');
console.log('removeDaily', currentStep, currentModalId);
alert('TODO : 추가')
}
// 일계부 삭제 처리
const removeDaily = (el) => {
const currentStep = $(el).data('step');
const currentListId = $(el).data('listId');
console.log('removeDaily', currentStep, currentListId);
alert('TODO : 삭제')
}
</script>
</div>
</html>