[FO] 일계부 수입/지출 스크립트 공통 정리
This commit is contained in:
@@ -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: '등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
|
||||
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: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
|
||||
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();
|
||||
},
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user