[FO] 일계부 동력 사용시간 List, 기타 공통 수정
This commit is contained in:
@@ -137,7 +137,7 @@
|
||||
maxView: 0,
|
||||
minDate: this.data.minDate,
|
||||
maxDate: this.data.maxDate,
|
||||
beforeShowDay: this._beforeShowDay.bind(this)
|
||||
beforeShowDay: (date) => this._beforeShowDay(date)
|
||||
})
|
||||
this.instances.datepicker = this.instances.datepickerComp.getDatepickerInstance()
|
||||
|
||||
@@ -182,12 +182,12 @@
|
||||
_setupEventListeners() {
|
||||
// // Bind methods to maintain context
|
||||
this.boundMethods = {
|
||||
handleDateChange: this._handleDateChange.bind(this),
|
||||
handleMonthChange: this._handleMonthChange.bind(this),
|
||||
handleWeekChange: this._handleWeekChange.bind(this),
|
||||
handlePrevWeek: this._handlePrevWeek.bind(this),
|
||||
handleNextWeek: this._handleNextWeek.bind(this),
|
||||
handleModeToggle: this._handleModeToggle.bind(this)
|
||||
handleDateChange: ({ detail }) => this._handleDateChange({ detail }),
|
||||
handleMonthChange: ({ detail }) => this._handleMonthChange({ detail }),
|
||||
handleWeekChange: ({ detail }) => this._handleWeekChange({ detail }),
|
||||
handlePrevWeek: () => this._handlePrevWeek(),
|
||||
handleNextWeek: () => this._handleNextWeek(),
|
||||
handleModeToggle: () => this._handleModeToggle()
|
||||
}
|
||||
|
||||
// // Add event listeners
|
||||
@@ -291,8 +291,14 @@
|
||||
}
|
||||
|
||||
_initializeWeekMode() {
|
||||
this.state.weekPaging = 0
|
||||
const selectedDate = this.instances.datepicker.getDate()
|
||||
const selectedDay = selectedDate.getDate()
|
||||
|
||||
// // 선택된 날짜가 포함된 주차 계산
|
||||
this.state.weekPaging = Math.floor((selectedDay - 1) / DatepickerComponent.CONSTANTS.DAYS_PER_WEEK)
|
||||
|
||||
this._weekPagination()
|
||||
this._updateWeekNavigationButtons()
|
||||
}
|
||||
|
||||
_initializeMonthMode() {
|
||||
@@ -310,21 +316,47 @@
|
||||
this._weekPagination(direction)
|
||||
}
|
||||
|
||||
_updateWeekNavigationButtons() {
|
||||
if (this.state.mode !== 'week') return
|
||||
|
||||
const currentDate = this.instances.datepicker.getDate()
|
||||
|
||||
// // 이전주 버튼 상태 확인
|
||||
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
|
||||
this._toggleButtonDisabled(this.elements.nextWeek, isNextDisabled)
|
||||
}
|
||||
|
||||
_getPrevWeekDate(currentDate) {
|
||||
const endWeekDate = this.state.weekPaging * DatepickerComponent.CONSTANTS.DAYS_PER_WEEK - 6
|
||||
return new Date(currentDate.getFullYear(), currentDate.getMonth(), endWeekDate)
|
||||
}
|
||||
|
||||
_getNextWeekDate(currentDate) {
|
||||
const endWeekDate = (this.state.weekPaging + 2) * DatepickerComponent.CONSTANTS.DAYS_PER_WEEK
|
||||
return new Date(currentDate.getFullYear(), currentDate.getMonth(), endWeekDate)
|
||||
}
|
||||
|
||||
_weekPagingPrev() {
|
||||
const currentDate = this.instances.datepicker.getDate()
|
||||
const endWeekDate = this.state.weekPaging * DatepickerComponent.CONSTANTS.DAYS_PER_WEEK - 6
|
||||
const date = new Date(currentDate.getFullYear(), currentDate.getMonth(), endWeekDate)
|
||||
|
||||
this._disablePrevNextButtons('prev', date)
|
||||
|
||||
// // 현재 주가 1주차(weekPaging = 0)라면 이전 달로 이동
|
||||
if (this.state.weekPaging <= 0) {
|
||||
this._moveToPreviousMonth()
|
||||
return
|
||||
}
|
||||
|
||||
// // 이전 주로 이동
|
||||
this.state.weekPaging -= 1
|
||||
this._clickFirstVisibleCell()
|
||||
this._dispatchWeekChangeEvent('prev', currentDate)
|
||||
this._weekPagination('prev')
|
||||
this._updateWeekNavigationButtons()
|
||||
}
|
||||
|
||||
_weekPagingNext() {
|
||||
@@ -414,6 +446,7 @@
|
||||
this.state.weekPaging = lastWeekOfPrevMonth
|
||||
this._weekPagination('prev')
|
||||
this._clickFirstVisibleCell()
|
||||
this._updateWeekNavigationButtons()
|
||||
}
|
||||
|
||||
_moveToNextMonth() {
|
||||
@@ -426,6 +459,7 @@
|
||||
// // 주 모드에서 월 이동 시 적절한 날짜가 선택되도록 loadMonthData 호출
|
||||
// // changeMonth 이벤트가 자동으로 발생하여 loadMonthData가 호출됨
|
||||
this._weekPagination('next')
|
||||
this._updateWeekNavigationButtons()
|
||||
}
|
||||
|
||||
_setFirstDateDay(date) {
|
||||
@@ -451,6 +485,7 @@
|
||||
// // Month setup and data loading
|
||||
_setupMonth(date) {
|
||||
this.state.currentMonth = this._getMonthKey(date)
|
||||
console.log('this.state.currentMonth', this.state.currentMonth, date)
|
||||
|
||||
const allCells = this._getAllCells()
|
||||
const thisMonthCells = this._getThisMonthCells()
|
||||
@@ -518,9 +553,9 @@
|
||||
}
|
||||
|
||||
async _finalizeDateLoading(date) {
|
||||
const today = new Date()
|
||||
this._setupMonth(today)
|
||||
// this._setupMonth(date)
|
||||
|
||||
const today = new Date()
|
||||
const targetDate = this._getTargetDate(date, today)
|
||||
this.instances.datepicker.setDate(targetDate)
|
||||
|
||||
@@ -600,7 +635,6 @@
|
||||
// TODO
|
||||
//const response = await fetch(`http://localhost:8888/assets/json/${month}.json`)
|
||||
const response = await fetch(`/api/record/calendar/${month}`)
|
||||
|
||||
return await response.json()
|
||||
}
|
||||
|
||||
@@ -664,13 +698,12 @@
|
||||
// data: {no: 2, start: 3, end: 4, children: Array(2)}
|
||||
// currentDate: {start: '2025.06.15', end: '2025.06.16'}
|
||||
// viewDate: instanceof Date
|
||||
kri.logger.debug('changeDateCallback', data, currentDate, viewDate);
|
||||
console.log('changeDateCallback', data, currentDate, viewDate);
|
||||
|
||||
// TODO
|
||||
formControl.setDetail(data, currentDate, viewDate);
|
||||
|
||||
}, function(monthKey, currentDate){
|
||||
kri.logger.debug('changeMonthCallback', monthKey, currentDate);
|
||||
console.log('changeMonthCallback', monthKey, currentDate);
|
||||
});
|
||||
|
||||
</script>
|
||||
@@ -701,24 +734,24 @@
|
||||
let formControl = {
|
||||
setDetail(rowdata, currentDate, viewDate) {
|
||||
const searchMonth = viewDate.getFullYear().toString() + (viewDate.getMonth() + 1).toString().padStart(2, '0');
|
||||
let rowList = [];
|
||||
let etcList = [];
|
||||
let childList = rowdata.children;
|
||||
let monthlyList = rowdata.monthly;
|
||||
if (rowdata == null) {
|
||||
kri.logger.error('달력 선택 데이터 없음.')
|
||||
}
|
||||
if (rowdata != null && typeof rowdata === 'object' && rowdata.children !== undefined) {
|
||||
rowList = rowdata.children.filter(f => !(f.code === 'MONTHLY' || f.code === 'BANK'));
|
||||
etcList = rowdata.children.filter(f => f.code === 'MONTHLY' || f.code === 'BANK');
|
||||
}
|
||||
// if (rowdata != null && typeof rowdata === 'object' && rowdata.children !== undefined) {
|
||||
// rowList = rowdata.children.filter(f => !(f.code === 'MONTHLY' || f.code === 'BANK'));
|
||||
// monthlyList = rowdata.children.filter(f => f.code === 'MONTHLY' || f.code === 'BANK');
|
||||
// }
|
||||
|
||||
let tmpl = $.templates('#dailyNoneTmpl');
|
||||
let html = '';
|
||||
if (rowList === undefined || rowList.length === 0) {
|
||||
if (childList === undefined || childList.length === 0) {
|
||||
html = tmpl.render({
|
||||
month: searchMonth,
|
||||
no: rowdata.no,
|
||||
date: currentDate,
|
||||
etcList: etcList,
|
||||
monthlyList: monthlyList,
|
||||
});
|
||||
} else {
|
||||
tmpl = $.templates('#dailyListTmpl');
|
||||
@@ -726,8 +759,8 @@
|
||||
month: searchMonth,
|
||||
no: rowdata.no,
|
||||
date: currentDate,
|
||||
list: rowList,
|
||||
etcList: etcList,
|
||||
list: childList,
|
||||
monthlyList: monthlyList,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -779,8 +812,10 @@
|
||||
</script>
|
||||
<script id="etcRowTmpl" type="text/x-jsrender">
|
||||
<div class="regist-btn-area">
|
||||
{{for etcList}}
|
||||
{{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>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<ul class="detail-list"
|
||||
th:if="${item.name eq 'EXPENSE'}"
|
||||
>
|
||||
<th:block th:if="${#strings.isEmpty(expenseList)}">
|
||||
<th:block th:if="${#lists.isEmpty(expenseList)}">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
@@ -111,7 +111,7 @@
|
||||
<ul class="detail-list"
|
||||
th:if="${item.name eq 'POWER'}"
|
||||
>
|
||||
<th:block th:if="${#strings.isEmpty(powerList)}">
|
||||
<th:block th:if="${#lists.isEmpty(powerList)}">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
|
||||
@@ -179,33 +179,34 @@
|
||||
const $estimatedValue = $(ENV.modal.selector).find('form input[name="estimatedValue"]');
|
||||
$price.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($estimatedValue);
|
||||
modalControl._inputActive($estimatedValue);
|
||||
} else {
|
||||
modalControl._priceDisabled($estimatedValue);
|
||||
modalControl._inputDisabled($estimatedValue);
|
||||
}
|
||||
});
|
||||
|
||||
$estimatedValue.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($price);
|
||||
modalControl._inputActive($price);
|
||||
} else {
|
||||
modalControl._priceDisabled($price);
|
||||
modalControl._inputDisabled($price);
|
||||
}
|
||||
});
|
||||
|
||||
// data set
|
||||
selectboxInstance2.setValue($formWrap.find('input[name="unitCode"]').val());
|
||||
|
||||
if ($price.val() === '' && $estimatedValue.val() !== '') {
|
||||
modalControl._priceDisabled($price);
|
||||
modalControl._inputDisabled($price);
|
||||
} else if ($price.val() !== '' && $estimatedValue.val() === '') {
|
||||
modalControl._priceDisabled($estimatedValue);
|
||||
modalControl._inputDisabled($estimatedValue);
|
||||
}
|
||||
},
|
||||
_priceActive($input) {
|
||||
_inputActive($input) {
|
||||
$input.val('').attr('disabled', false);
|
||||
$input.parent().parent().closest('.component-input').removeClass('input-disabled');
|
||||
},
|
||||
_priceDisabled($input) {
|
||||
_inputDisabled($input) {
|
||||
$input.val('').attr('disabled', true);
|
||||
$input.parent().parent().closest('.component-input').addClass('input-disabled');
|
||||
},
|
||||
|
||||
@@ -192,38 +192,35 @@
|
||||
const $estimatedValue = $(ENV.modal.selector).find('form input[name="estimatedValue"]');
|
||||
$price.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($estimatedValue);
|
||||
modalControl._inpuActive($estimatedValue);
|
||||
} else {
|
||||
modalControl._priceDisabled($estimatedValue);
|
||||
modalControl._inputDisabled($estimatedValue);
|
||||
}
|
||||
});
|
||||
|
||||
$estimatedValue.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($price);
|
||||
modalControl._inpuActive($price);
|
||||
} else {
|
||||
modalControl._priceDisabled($price);
|
||||
modalControl._inputDisabled($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);
|
||||
modalControl._inputDisabled($price);
|
||||
} else if ($price.val() !== '' && $estimatedValue.val() === '') {
|
||||
modalControl._priceDisabled($estimatedValue);
|
||||
modalControl._inputDisabled($estimatedValue);
|
||||
}
|
||||
},
|
||||
_priceActive($input) {
|
||||
_inpuActive($input) {
|
||||
$input.val('').attr('disabled', false);
|
||||
$input.parent().parent().closest('.component-input').removeClass('input-disabled');
|
||||
},
|
||||
_priceDisabled($input) {
|
||||
_inputDisabled($input) {
|
||||
$input.val('').attr('disabled', true);
|
||||
$input.parent().parent().closest('.component-input').addClass('input-disabled');
|
||||
},
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field type-hour">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="leasedHours" name="ownedHours" th:value="${detail.ownedHours}" maxlength="10" placeholder="임차해서 사용한 동력 사용시간을 입력해 주세요">
|
||||
<input type="number" inputmode="decimal" pattern="[0-9]*" id="leasedHours" name="leasedHours" th:value="${detail.leasedHours}" maxlength="10" placeholder="임차해서 사용한 동력 사용시간을 입력해 주세요">
|
||||
<span class="input-field-txt">시간</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,25 +13,25 @@
|
||||
<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>
|
||||
<strong>동력 사용내역 [[${#lists.isEmpty(powerList) ? 0 : #lists.size(powerList)}]]건 등록</strong> <br>
|
||||
되었습니다.
|
||||
</h3>
|
||||
<p>동력 사용내역을 등록해 주세요.</p>
|
||||
</hgroup>
|
||||
|
||||
<!--/* 신규 등록 */-->
|
||||
<th:block th:if="${#lists.isEmpty(incomeList)}">
|
||||
<th:block th:if="${#lists.isEmpty(powerList)}">
|
||||
<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')}">
|
||||
th:disabled="${#strings.equals(dailyRecord.powerStatus, 'TODAY_NONE')}">
|
||||
<i class="ico-small" aria-hidden="true"
|
||||
th:classappend="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
|
||||
th:classappend="${#strings.equals(dailyRecord.powerStatus, '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')}">
|
||||
data-type="POWER"
|
||||
th:checked="${#strings.equals(dailyRecord.powerStatus, 'TODAY_NONE')}">
|
||||
<span class="checkbox-item">
|
||||
<span class="checkbox-txt">금일 등록내용 없음</span>
|
||||
</span>
|
||||
@@ -39,10 +39,10 @@
|
||||
</div>
|
||||
</th:block>
|
||||
<!--/* 목록 */-->
|
||||
<th:block th:unless="${#lists.isEmpty(incomeList)}">
|
||||
<th:block th:unless="${#lists.isEmpty(powerList)}">
|
||||
<section class="regist-item-area">
|
||||
<p class="total">
|
||||
<span>총 <strong>[[${#lists.size(incomeList)}]]</strong>건</span>
|
||||
<span>총 <strong>[[${#lists.size(powerList)}]]</strong>건</span>
|
||||
<button type="button" class="btn-reset" onclick="krip.daily.resetConfirm()">
|
||||
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||
<span>초기화</span>
|
||||
@@ -50,18 +50,15 @@
|
||||
</p>
|
||||
<div class="item-list">
|
||||
<div class="list-item"
|
||||
th:each="item, itemStatus : ${incomeList}">
|
||||
th:each="item, itemStatus : ${powerList}">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">[[${item.categorySelf}]]</p>
|
||||
<p class="item-name">[[${item.equipmentName}]]</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">
|
||||
equipmentName
|
||||
|
||||
|
||||
<li th:if="${not #strings.isEmpty(item.ownedHours)}">
|
||||
<p>자가 사용시간</p>
|
||||
<span th:text="|${item.ownedHours}시간|">0시간</span>
|
||||
@@ -90,7 +87,7 @@
|
||||
<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:disabled="${not #strings.equals(dailyRecord.powerStatus, 'TODAY_NONE') and #lists.isEmpty(powerList)}"
|
||||
th:onclick="krip.daily.goToNext([[${nextStep}]], [[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
|
||||
<span class="btn-txt">다음 단계로 이동</span>
|
||||
</button>
|
||||
@@ -154,63 +151,35 @@
|
||||
|
||||
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() {
|
||||
const $ownedHour = $(ENV.modal.selector).find('form input[name="ownedHours"]');
|
||||
const $leasedHour = $(ENV.modal.selector).find('form input[name="leasedHours"]');
|
||||
$ownedHour.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($estimatedValue);
|
||||
modalControl._inputActive($leasedHour);
|
||||
} else {
|
||||
modalControl._priceDisabled($estimatedValue);
|
||||
modalControl._inputDisabled($leasedHour);
|
||||
}
|
||||
});
|
||||
|
||||
$estimatedValue.on('keyup', function() {
|
||||
$leasedHour.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($price);
|
||||
modalControl._inputActive($ownedHour);
|
||||
} else {
|
||||
modalControl._priceDisabled($price);
|
||||
modalControl._inputDisabled($ownedHour);
|
||||
}
|
||||
});
|
||||
|
||||
// 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);
|
||||
if ($ownedHour.val() === '' && $leasedHour.val() !== '') {
|
||||
modalControl._inputDisabled($ownedHour);
|
||||
} else if ($ownedHour.val() !== '' && $leasedHour.val() === '') {
|
||||
modalControl._inputDisabled($leasedHour);
|
||||
}
|
||||
},
|
||||
_priceActive($input) {
|
||||
_inputActive($input) {
|
||||
$input.val('').attr('disabled', false);
|
||||
$input.parent().parent().closest('.component-input').removeClass('input-disabled');
|
||||
},
|
||||
_priceDisabled($input) {
|
||||
_inputDisabled($input) {
|
||||
$input.val('').attr('disabled', true);
|
||||
$input.parent().parent().closest('.component-input').addClass('input-disabled');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user