From ffcf1a89344242334c68e8a3540b557c3176aef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=84=EC=A3=BC?= Date: Tue, 17 Jun 2025 10:05:10 +0900 Subject: [PATCH] =?UTF-8?q?[FO]=20=EC=9D=BC=EA=B3=84=EB=B6=80=20=EC=88=98?= =?UTF-8?q?=EC=9E=85/=EC=A7=80=EC=B6=9C=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EA=B3=B5=ED=86=B5=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/ui/page/daily-record.js | 122 +++++++++++- .../templates/record/expense/form.html | 10 +- .../templates/record/expense/index.html | 178 ++++-------------- .../templates/record/income/form.html | 15 +- .../templates/record/income/index.html | 175 ++++------------- 5 files changed, 203 insertions(+), 297 deletions(-) diff --git a/front/src/main/resources/static/ui/page/daily-record.js b/front/src/main/resources/static/ui/page/daily-record.js index df351964..37565803 100644 --- a/front/src/main/resources/static/ui/page/daily-record.js +++ b/front/src/main/resources/static/ui/page/daily-record.js @@ -23,12 +23,12 @@ krip.daily.goToPrev = function(target, searchMonth, groupNo) { url = url.replace('{target}', target); console.log(url); -} +}; krip.daily.goToPrev = function() { // TODO : history.back 으로 해결 되는가? history.back(); -} +}; krip.daily.goToNext = function(target, searchMonth, groupNo) { let url = krip.daily.httpUrl.target; @@ -60,4 +60,122 @@ krip.daily.todayNone = function(month, groupNo, target, checked) { $('.component-btns').find('.btn-primary').attr('disabled', !checked); }, ); +}; + +krip.daily.baseBindUI = function() { + etUI.locales.ko = { + dialog: { + positive: '예', + negative: '아니오', + }, + }; + + const $noneWrap = $('input[name="todayNone"]'); + $noneWrap.on('click', function () { + let checked = $(this).is(':checked'); + let $btn = $(ENV.modal.selectorId); + $btn.attr('disabled', checked); + if (checked) { + $btn.find('i').addClass('ico-add-disabled'); + $btn.find('i').removeClass('ico-add'); + $noneWrap.val('Y'); + } else { + $btn.find('i').addClass('ico-add'); + $btn.find('i').removeClass('ico-add-disabled'); + //document.reqForm.todayNone.value = 'N'; + $noneWrap.val('N'); + } + // TODO 2번 이벤트 발생하는 원인 찾기 + console.log(1111) + + krip.daily.todayNone(ENV.month, ENV.groupNo, $noneWrap.data('type'), checked); + }); + + const $formWrap = $(ENV.modal.selectorId); + $formWrap.on('click', function() { + krip.daily.createModal(); + }); +} + +krip.daily.createModal = function(id) { + if (ENV.httpUrl.form === undefined) { + kri.logger.warn('[daily] form url is none.'); + return; + } + + if (id === undefined) { + id = 0; + } + + ajaxUtil._ajaxAsyncMethod( + ENV.httpUrl.form.replace('{id}', id), + {}, + function(rstHtml, status) { + $(ENV.modal.selector).find('.modal-content').html(rstHtml); + + const modal01 = document.querySelector(ENV.modal.selector).ui; + modal01.open(); + + modalControl._bindModelUI(); + }, + function(code, rstData) { + kri.logger.error('Do nothing. code: '+ code, rstData); + }, + 'get', + 'html' + ); +} + +krip.daily.removeConfirm = function(id) { + etUI.dialog.alert({ + title: '삭제 안내', + message: '등록하신 내용을 삭제하시겠어요?
삭제된 내용은 복구할 수 없습니다.', + type: 'confirm', + dialogType: 'confirm', + callback: function () { + krip.daily.remove(id); + }, + }); +}; + +krip.daily.remove = function(id) { + if (ENV.httpUrl.remove === undefined) { + kri.logger.warn('[daily] remove url is none.'); + return; + } + + ajaxUtil._ajaxAsync( + ENV.httpUrl.remove, + { 'id': id }, + function (rstData, status) { + location.reload(); + }, + ); +}; + +krip.daily.resetConfirm = function() { + etUI.dialog.alert({ + title: '초기화 안내', + message: '등록하신 모든 내용을 삭제하시겠어요?
삭제된 내용은 복구할 수 없습니다.', + type: 'confirm', + dialogType: 'confirm', + callback: function () { + krip.daily.reset(); + }, + }); +}; + +krip.daily.reset = function() { + if (ENV.httpUrl.reset === undefined) { + kri.logger.warn('[daily] reset url is none.'); + return; + } + + ajaxUtil._ajaxAsync( + ENV.httpUrl.reset, + {}, + function (rstData, status) { + location.reload(); + }, + ); }; \ No newline at end of file diff --git a/front/src/main/resources/templates/record/expense/form.html b/front/src/main/resources/templates/record/expense/form.html index 40ba9fa6..5457b42d 100644 --- a/front/src/main/resources/templates/record/expense/form.html +++ b/front/src/main/resources/templates/record/expense/form.html @@ -3,14 +3,6 @@ xmlns:th="http://www.thymeleaf.org" lang="ko"> - -
- reqVO: [[${reqVO}]] -
-
- detail: [[${dailyRecord}]] -
-