파일 삭제 및 퍼블 반영

This commit is contained in:
주수현
2025-07-29 12:20:41 +09:00
parent b474a6afe0
commit e6d412c5eb
11 changed files with 309 additions and 748 deletions

View File

@@ -254,7 +254,21 @@
const date = new Date(detail.viewDate)
const monthKey = this._getMonthKey(date)
// this._setupMonth(date)
// 주 모드일 때 월이 변경되면 weekStart 업데이트
if (this.state.mode === 'week') {
this._setFirstDateDay(date)
// datepicker 옵션 업데이트
this.instances.datepicker.setOptions({
...this.instances.datepickerComp.core.props,
weekStart: this.state.weekStart
})
// refresh를 통해 요일 헤더 업데이트
if (this.instances.datepicker.refresh) {
this.instances.datepicker.refresh()
}
}
if (!this.state.isLoading) {
await this.loadMonthData(date)
@@ -263,6 +277,32 @@
this.callbacks.changeMonth(monthKey, date)
}
async _finalizeDateLoading(date) {
this._setupMonth(date)
const today = new Date()
const targetDate = this._getTargetDate(date, today)
this.instances.datepicker.setDate(targetDate)
// 주 모드일 때 요일 헤더 업데이트
if (this.state.mode === 'week') {
this._setFirstDateDay(date)
this.instances.datepicker.setOptions({
...this.instances.datepickerComp.core.props,
weekStart: this.state.weekStart
})
}
this._scheduleClick()
if (date >= this.data.minDate) {
this.instances.datepicker.refresh()
}
this._loadingEnd()
this.elements.datepicker.classList.remove(DatepickerComponent.CONSTANTS.CLASSES.LOADING)
}
_handleWeekChange({
detail
}) {
@@ -325,15 +365,30 @@
...this.instances.datepickerComp.core.props,
weekStart: this.state.weekStart
})
// 옵션 변경 후 즉시 refresh 호출
if (this.instances.datepicker.refresh) {
this.instances.datepicker.refresh()
}
}
_initializeWeekMode() {
const selectedDate = this.instances.datepicker.getDate()
const selectedDay = selectedDate.getDate()
// // 선택된 날짜가 포함된 주차 계산
// 선택된 날짜가 포함된 주차 계산
this.state.weekPaging = Math.floor((selectedDay - 1) / DatepickerComponent.CONSTANTS.DAYS_PER_WEEK)
// weekStart 설정 및 옵션 업데이트
this._setFirstDateDay(selectedDate)
this.instances.datepicker.setOptions({
...this.instances.datepickerComp.core.props,
weekStart: this.state.weekStart
})
// refresh를 통해 요일 헤더 업데이트
if (this.instances.datepicker.refresh) {
this.instances.datepicker.refresh()
}
this._weekPagination()
this._updateWeekNavigationButtons()
}
@@ -367,15 +422,31 @@
if (this.state.mode !== 'week') return
const currentDate = this.instances.datepicker.getDate()
const currentMonth = currentDate.getMonth()
const currentYear = currentDate.getFullYear()
// // 이전주 버튼 상태 확인
// 이전주 버튼 상태 확인
const prevWeekDate = this._getPrevWeekDate(currentDate)
const isPrevDisabled = prevWeekDate <= this.data.minDate
this._toggleButtonDisabled(this.elements.prevWeek, isPrevDisabled)
// // 다음주 버튼 상태 확인
const nextWeekDate = this._getNextWeekDate(currentDate)
const isNextDisabled = nextWeekDate >= this.data.maxDate
// 다음주 버튼 상태 확인 개선
const nextWeekStart = this._getNextWeekDate(currentDate)
// maxDate와 비교할 때 더 정확한 계산
// 다음주가 시작되는 날짜가 maxDate를 초과하는지 확인
let isNextDisabled = false
// 다음주가 다음 달로 넘어가는 경우 체크
if (nextWeekStart.getMonth() !== currentMonth) {
// 다음 달의 첫째 날이 maxDate를 초과하는지 확인
const nextMonthFirstDay = new Date(currentYear, currentMonth + 1, 1)
isNextDisabled = nextMonthFirstDay > this.data.maxDate
} else {
// 같은 달 내에서 다음주 시작일이 maxDate를 초과하는지 확인
isNextDisabled = nextWeekStart > this.data.maxDate
}
this._toggleButtonDisabled(this.elements.nextWeek, isNextDisabled)
}
@@ -385,8 +456,12 @@
}
_getNextWeekDate(currentDate) {
const endWeekDate = (this.state.weekPaging + 2) * DatepickerComponent.CONSTANTS.DAYS_PER_WEEK
return new Date(currentDate.getFullYear(), currentDate.getMonth(), endWeekDate)
// 현재 주의 시작일 계산
const currentWeekStart = (this.state.weekPaging * DatepickerComponent.CONSTANTS.DAYS_PER_WEEK) + 1
// 다음주의 시작일 계산
const nextWeekStart = currentWeekStart + DatepickerComponent.CONSTANTS.DAYS_PER_WEEK
return new Date(currentDate.getFullYear(), currentDate.getMonth(), nextWeekStart)
}
_weekPagingPrev() {
@@ -412,11 +487,7 @@
this.state.maxWeekPaging = Math.ceil(lastDayOfMonth / DatepickerComponent.CONSTANTS.DAYS_PER_WEEK)
const endWeekDate = (this.state.weekPaging + 2) * DatepickerComponent.CONSTANTS.DAYS_PER_WEEK
const date = new Date(currentDate.getFullYear(), currentDate.getMonth(), endWeekDate)
this._disablePrevNextButtons('next', date)
// 현재 주가 마지막 주인지 확인
if (this.state.weekPaging >= this.state.maxWeekPaging - 1) {
this._moveToNextMonth()
return
@@ -425,6 +496,8 @@
this.state.weekPaging += 1
this._clickFirstVisibleCell()
this._dispatchWeekChangeEvent('next', currentDate)
this._weekPagination('next')
this._updateWeekNavigationButtons() // 버튼 상태 업데이트 추가
}
_clickFirstVisibleCell() {
@@ -487,13 +560,31 @@
_moveToPreviousMonth() {
const currentDate = this.instances.datepicker.getDate()
const prevMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1)
const lastDayOfPrevMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0).getDate()
const lastWeekOfPrevMonth = Math.ceil(lastDayOfPrevMonth / DatepickerComponent.CONSTANTS.DAYS_PER_WEEK) - 1
const firstDayOfLastWeek = (lastWeekOfPrevMonth * DatepickerComponent.CONSTANTS.DAYS_PER_WEEK) + 1
const targetDate = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, firstDayOfLastWeek)
// 먼저 날짜 설정
this.instances.datepicker.setDate(targetDate)
// 새로운 달의 첫째 날 기준으로 weekStart 업데이트
this._setFirstDateDay(prevMonth)
// datepicker 옵션 업데이트
this.instances.datepicker.setOptions({
...this.instances.datepickerComp.core.props,
weekStart: this.state.weekStart
})
this.state.weekPaging = lastWeekOfPrevMonth
// refresh를 통해 요일 헤더 업데이트
if (this.instances.datepicker.refresh) {
this.instances.datepicker.refresh()
}
this._weekPagination('prev')
this._clickFirstVisibleCell()
this._updateWeekNavigationButtons()
@@ -503,18 +594,41 @@
const currentDate = this.instances.datepicker.getDate()
const nextMonthFirstDay = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 1)
// 먼저 날짜 설정
this.instances.datepicker.setDate(nextMonthFirstDay)
// 새로운 달의 첫째 날 기준으로 weekStart 업데이트
this._setFirstDateDay(nextMonthFirstDay)
// datepicker 옵션 업데이트
this.instances.datepicker.setOptions({
...this.instances.datepickerComp.core.props,
weekStart: this.state.weekStart
})
this.state.weekPaging = 0
// // 주 모드에서 월 이동 시 적절한 날짜가 선택되도록 loadMonthData 호출
// // changeMonth 이벤트가 자동으로 발생하여 loadMonthData가 호출됨
// refresh를 통해 요일 헤더 업데이트
if (this.instances.datepicker.refresh) {
this.instances.datepicker.refresh()
}
this._weekPagination('next')
this._clickFirstVisibleCell()
this._updateWeekNavigationButtons()
}
_setFirstDateDay(date) {
const firstDate = new Date(date.getFullYear(), date.getMonth(), 1)
this.state.weekStart = firstDate.getDay()
// 주 모드일 때 datepicker 옵션도 즉시 업데이트
if (this.state.mode === 'week' && this.instances.datepicker) {
this.instances.datepicker.setOptions({
...this.instances.datepickerComp.core.props,
weekStart: this.state.weekStart
})
}
}
_weekPagination(direction) {
@@ -768,198 +882,198 @@
</div>
<section layout:fragment="script">
<script th:src="@{/static/library/jsRender/jsrender.min.js}"></script>
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: '',
list: '/record/calendar/{searchMonth}/{groupNo}',
create: '/record/daily/{searchMonth}/{groupNo}',
alert: '/api/record/daily/alert/{searchMonth}',
},
submitted: false,
};
<script th:src="@{/static/library/jsRender/jsrender.min.js}"></script>
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: '',
list: '/record/calendar/{searchMonth}/{groupNo}',
create: '/record/daily/{searchMonth}/{groupNo}',
alert: '/api/record/daily/alert/{searchMonth}',
},
submitted: false,
};
let formControl = {
setDetail(rowdata, currentDate, viewDate) {
const searchMonth = viewDate.getFullYear().toString() + (viewDate.getMonth() + 1).toString().padStart(2, '0');
let childList = rowdata.children;
let monthlyList = rowdata.monthly;
if (rowdata == null) {
kri.logger.error('달력 선택 데이터 없음.')
}
let formControl = {
setDetail(rowdata, currentDate, viewDate) {
const searchMonth = viewDate.getFullYear().toString() + (viewDate.getMonth() + 1).toString().padStart(2, '0');
let childList = rowdata.children;
let monthlyList = rowdata.monthly;
if (rowdata == null) {
kri.logger.error('달력 선택 데이터 없음.')
}
let tmpl = $.templates('#dailyNoneTmpl');
let html = '';
if (childList === undefined || childList.length === 0) {
html = tmpl.render({
month: searchMonth,
no: rowdata.no,
date: currentDate,
monthlyList: monthlyList,
registrable: rowdata.registrable,
modifiable: rowdata.modifiable,
});
} else {
tmpl = $.templates('#dailyListTmpl');
html = tmpl.render({
month: searchMonth,
no: rowdata.no,
date: currentDate,
list: childList,
monthlyList: monthlyList,
registrable: rowdata.registrable,
modifiable: rowdata.modifiable,
carryOver: rowdata.carryOver != null ? Number(rowdata.carryOver).toLocaleString() : null,
});
}
let tmpl = $.templates('#dailyNoneTmpl');
let html = '';
if (childList === undefined || childList.length === 0) {
html = tmpl.render({
month: searchMonth,
no: rowdata.no,
date: currentDate,
monthlyList: monthlyList,
registrable: rowdata.registrable,
modifiable: rowdata.modifiable,
});
} else {
tmpl = $.templates('#dailyListTmpl');
html = tmpl.render({
month: searchMonth,
no: rowdata.no,
date: currentDate,
list: childList,
monthlyList: monthlyList,
registrable: rowdata.registrable,
modifiable: rowdata.modifiable,
carryOver: rowdata.carryOver != null ? Number(rowdata.carryOver).toLocaleString() : null,
});
}
$('#selectedDay').html(html);
$('#selectedDay').html(html);
// 오늘 날짜가 해당 달의 마지막 날인지 확인
const today = new Date();
const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0); // 해당 달의 마지막 날
// 마지막 alert 날짜 확인
const lastAlertDate = sessionStorage.getItem('lastAlertDate');
const todayDateString = today.toDateString();
// 오늘 날짜가 해당 달의 마지막 날인지 확인
const today = new Date();
const lastDayOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0); // 해당 달의 마지막 날
// 마지막 alert 날짜 확인
const lastAlertDate = sessionStorage.getItem('lastAlertDate');
const todayDateString = today.toDateString();
if (lastAlertDate !== todayDateString &&
today.getFullYear() === lastDayOfMonth.getFullYear() &&
today.getMonth() === lastDayOfMonth.getMonth() &&
today.getDate() === lastDayOfMonth.getDate()) {
ajaxUtil._ajaxSyncMethod(
ENV.httpUrl.alert.replace('{searchMonth}', searchMonth.replace('-', '')),
{},
function (response) {
let dailyNo = []
let msgTxt = '';
let month = viewDate.getMonth() + 1;
let idxPlus = 0;
msgTxt += "등록하지 않은 일계부 항목이 있습니다.\n 정확한 조사를 위해 꾸준히 입력해 주세요.\n";
if(response.dailyRecordAlertDtoList.length > 0){
response.dailyRecordAlertDtoList.forEach((dto) =>{
let dateTxt;
if(dto.startDay === dto.endDay){
dateTxt = month+"월 "+dto.startDay+"일";
}else{
dateTxt = month+"월 "+dto.startDay+"~"+dto.endDay+"일";
}
dailyNo.push(dateTxt);
});
msgTxt += "<p class=\"dialog-info-tit\">1. 일계부 미등록 </p>\n <p class=\"dialog-info\">"+dailyNo.join(',')+"</p>\n";
idxPlus ++;
}
if(response.monthRecordAlertDtoList.length > 0) {
response.monthRecordAlertDtoList.forEach((dto,idx) => {
msgTxt += "<p class=\"dialog-info-tit\">"+ (idx+idxPlus+1) +". "+dto+"</p>\n";
});
}
if (lastAlertDate !== todayDateString &&
today.getFullYear() === lastDayOfMonth.getFullYear() &&
today.getMonth() === lastDayOfMonth.getMonth() &&
today.getDate() === lastDayOfMonth.getDate()) {
ajaxUtil._ajaxSyncMethod(
ENV.httpUrl.alert.replace('{searchMonth}', searchMonth.replace('-', '')),
{},
function (response) {
let dailyNo = []
let msgTxt = '';
let month = viewDate.getMonth() + 1;
let idxPlus = 0;
msgTxt += "등록하지 않은 일계부 항목이 있습니다.\n 정확한 조사를 위해 꾸준히 입력해 주세요.\n";
if(response.dailyRecordAlertDtoList.length > 0){
response.dailyRecordAlertDtoList.forEach((dto) =>{
let dateTxt;
if(dto.startDay === dto.endDay){
dateTxt = month+"월 "+dto.startDay+"일";
}else{
dateTxt = month+"월 "+dto.startDay+"~"+dto.endDay+"일";
}
dailyNo.push(dateTxt);
});
msgTxt += "<p class=\"dialog-info-tit\">1. 일계부 미등록 </p>\n <p class=\"dialog-info\">"+dailyNo.join(',')+"</p>\n";
idxPlus ++;
}
if(response.monthRecordAlertDtoList.length > 0) {
response.monthRecordAlertDtoList.forEach((dto,idx) => {
msgTxt += "<p class=\"dialog-info-tit\">"+ (idx+idxPlus+1) +". "+dto+"</p>\n";
});
}
if(response.dailyRecordAlertDtoList.length > 0 || dto.monthRecordAlertDtoList.length > 0) {
etUI.dialog.alert({
title: '',
message: msgTxt,
type:'alert',
callback: function () {
sessionStorage.setItem('lastAlertDate',lastDayOfMonth.toDateString());
},
});
}
},
function (rstData, status) {
if(response.dailyRecordAlertDtoList.length > 0 || dto.monthRecordAlertDtoList.length > 0) {
etUI.dialog.alert({
title: '',
message: msgTxt,
type:'alert',
callback: function () {
sessionStorage.setItem('lastAlertDate',lastDayOfMonth.toDateString());
},
});
}
},
function (rstData, status) {
},
'get'
,'json'
);
}
},
recordCreate(searchMonth, groupNo) {
location.href = ENV.httpUrl.create.replace('{searchMonth}', searchMonth.replace('-', '')).replace('{groupNo}', groupNo);
},
};
},
'get'
,'json'
);
}
},
recordCreate(searchMonth, groupNo) {
location.href = ENV.httpUrl.create.replace('{searchMonth}', searchMonth.replace('-', '')).replace('{groupNo}', groupNo);
},
};
</script>
<script id="dailyNoneTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}
</script>
<script id="dailyNoneTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}
{{if registrable}}
<div class="component-btns btn-add">
<button type="button" onclick="formControl.recordCreate('{{:month}}', {{:no}});">
<p class="txt">일계부 등록하기</p>
</button>
</div>
{{/if}}
{{include tmpl="#etcRowTmpl" /}}
</script>
<script id="dailyListTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}
<ul class="btn-column-list">
{{if no == 1}}
<li>
<p class="label">월초이월금</p>
{{if carryOver == null}}
<p class="value">정산중입니다.</p>
{{else}}
<p class="value"><em><b>{{:carryOver}}</b> 원</em></p>
{{/if}}
</li>
{{if registrable}}
<div class="component-btns btn-add">
<button type="button" onclick="formControl.recordCreate('{{:month}}', {{:no}});">
<p class="txt">일계부 등록하기</p>
</button>
</div>
{{/if}}
{{for list ~edit=modifiable}}
{{if status == null}}
{{include tmpl="#etcRowTmpl" /}}
</script>
<script id="dailyListTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}
<ul class="btn-column-list">
{{if no == 1}}
<li>
<p class="label">{{:codeLabel}}</p>
<p class="value">미작성</p>
</li>
{{else}}
<li class="{{if ~edit}}edit{{else}}view{{/if}}">
{{if status == 'TARGET' && total != 0}}
<a href="{{:path}}?type=update">
<p class="label">{{:codeLabel}}</p>
<p class="value"><em>총 <b>{{:total}}</b>건</em></p>
</a>
{{else status == 'TARGET' && total == 0}}
<a href="{{:path}}?type=update">
<p class="label">{{:codeLabel}}</p>
<p class="value">미완료</p>
</a>
{{else status == 'TODAY_NONE'}}
<a href="{{:path}}?type=update">
<p class="label">{{:codeLabel}}</p>
<p class="value">없음</p>
</a>
<p class="label">월초이월금</p>
{{if carryOver == null}}
<p class="value">정산중입니다.</p>
{{else}}
<p class="value"><em><b>{{:carryOver}}</b> 원</em></p>
{{/if}}
</li>
{{/if}}
{{/for}}
</ul>
{{include tmpl="#etcRowTmpl" /}}
</script>
<script id="titleTmpl" type="text/x-jsrender">
{{if date.start == date.end}}
<p class="date">{{:date.start}}</p>
{{else}}
<p class="date">{{:date.start}} ~ {{:date.end}}</p>
{{/if}}
</script>
<script id="etcRowTmpl" type="text/x-jsrender">
<div class="regist-btn-area">
{{for monthlyList}}
<a href="{{:path ? path : 'javascript:void(0);'}}" class="btn{{if total != null && total != 0}} complete{{/if}}">
<p>{{:codeLabel}}</p>
{{if total != null && total != 0}}
<span>등록완료</span>
{{for list ~edit=modifiable}}
{{if status == null}}
<li>
<p class="label">{{:codeLabel}}</p>
<p class="value">미작성</p>
</li>
{{else}}
<span>미등록</span>
<li class="{{if ~edit}}edit{{else}}view{{/if}}">
{{if status == 'TARGET' && total != 0}}
<a href="{{:path}}?type=update">
<p class="label">{{:codeLabel}}</p>
<p class="value"><em>총 <b>{{:total}}</b>건</em></p>
</a>
{{else status == 'TARGET' && total == 0}}
<a href="{{:path}}?type=update">
<p class="label">{{:codeLabel}}</p>
<p class="value">미완료</p>
</a>
{{else status == 'TODAY_NONE'}}
<a href="{{:path}}?type=update">
<p class="label">{{:codeLabel}}</p>
<p class="value">없음</p>
</a>
{{/if}}
</li>
{{/if}}
</a>
{{/for}}
</div>
</script>
{{/for}}
</ul>
{{include tmpl="#etcRowTmpl" /}}
</script>
<script id="titleTmpl" type="text/x-jsrender">
{{if date.start == date.end}}
<p class="date">{{:date.start}}</p>
{{else}}
<p class="date">{{:date.start}} ~ {{:date.end}}</p>
{{/if}}
</script>
<script id="etcRowTmpl" type="text/x-jsrender">
<div class="regist-btn-area">
{{for monthlyList}}
<a href="{{:path ? path : 'javascript:void(0);'}}" class="btn{{if total != null && total != 0}} complete{{/if}}">
<p>{{:codeLabel}}</p>
{{if total != null && total != 0}}
<span>등록완료</span>
{{else}}
<span>미등록</span>
{{/if}}
</a>
{{/for}}
</div>
</script>
</section>
</html>