|
@@ -137,12 +137,40 @@ require([
|
137
|
137
|
// 왼쪽 메뉴 만들기
|
138
|
138
|
fn_make_slide_menu.init();
|
139
|
139
|
};
|
140
|
|
- fn_ajax_call('/api/session/data', null, callbackFn, 'GET');
|
141
|
|
- // fn_ajax_call('/api/session/data-app', null, callbackFn, 'GET');
|
|
140
|
+ fn_ajax_call('/api/session/data-app', null, callbackFn, 'GET');
|
142
|
141
|
}
|
143
|
142
|
|
144
|
143
|
});
|
145
|
144
|
|
|
145
|
+var itp_fn_logined_check = function(user_nm_update, fn) {
|
|
146
|
+ var now, expiration, data = false;
|
|
147
|
+ data = sessionStorage.getItem('itp_login_info');
|
|
148
|
+ if(data) {
|
|
149
|
+ data = JSON.parse(data);
|
|
150
|
+ now = new Date();
|
|
151
|
+ expiration = new Date(data.timestamp);
|
|
152
|
+ expiration.setMinutes(expiration.getMinutes() + 60);
|
|
153
|
+
|
|
154
|
+ if (now.getTime() > expiration.getTime()) {
|
|
155
|
+ data = false;
|
|
156
|
+ fnSessionOut();
|
|
157
|
+ } else {
|
|
158
|
+ sessionStorage.setItem('itp_login_info', JSON.stringify({
|
|
159
|
+ timestamp: new Date(),
|
|
160
|
+ connKey: data.connKey //Jwt키를 가져와서 세션 스토리지에 저장
|
|
161
|
+ }));
|
|
162
|
+ if(user_nm_update && user_nm_update == true) {
|
|
163
|
+ if (fn !== undefined || typeof fn !== 'undefined') {
|
|
164
|
+ fn();
|
|
165
|
+ }
|
|
166
|
+ }
|
|
167
|
+ }
|
|
168
|
+ } else {
|
|
169
|
+ // 로그인 페이지로 이동
|
|
170
|
+ $(location).attr('href', MOBILE_CONTEXTPATH + '/app/login.html');
|
|
171
|
+ }
|
|
172
|
+};
|
|
173
|
+
|
146
|
174
|
var fn_make_user_info = {
|
147
|
175
|
init : function() {
|
148
|
176
|
this.set();
|
|
@@ -187,36 +215,80 @@ var fn_make_slide_menu = {
|
187
|
215
|
this.make();
|
188
|
216
|
},
|
189
|
217
|
make: function() {
|
|
218
|
+ var selector = '.menu_select .panel-group > .panel_list:last';
|
190
|
219
|
$.each(AUTH_MENU_LIST, function(key, value) {
|
191
|
|
- var selector = '.menu_select .panel-group > .panel-list:last';
|
192
|
|
- if(value.level == 2) { // LEVEL2
|
|
220
|
+ if(value.level === 2) { // LEVEL2
|
193
|
221
|
$('.menu_select .panel-group').append($('#ITP_AJAX_MAIN_SLIDE_LEVEL2_ROWCOPY').val());
|
194
|
222
|
$(selector).find('.fnMenuNm').text(value.menuNm);
|
195
|
223
|
$(selector).find('.accordion-toggle').attr('href', '#ITP_NAV_'+value.menuNo);
|
196
|
224
|
$(selector).find('.panel-collapse').attr('id', 'ITP_NAV_'+value.menuNo);
|
197
|
|
- // $(selector).find('.fnLevelBottomList').empty();
|
198
|
|
- // $('.menu_select .panel-group').append($('#ITP_AJAX_MAIN_SIDE_LEVEL2_ROWCOPY').val());
|
199
|
|
- // $('.menu_select .panel-group > .panel-default:last').find('.fnMenuNm').text(value.menuNm);
|
200
|
|
- // $('.menu_select .panel-group > .panel-default:last').find('.accordion-toggle').attr('href', '#ITP_NAV_'+value.menuNo);
|
201
|
|
- // $('.menu_select .panel-group > .panel-default:last').find('.panel-collapse').attr('id', 'ITP_NAV_'+value.menuNo);
|
202
|
|
- // $('.menu_select .panel-group > .panel-default:last').find('.fnLevelBottomList').empty();
|
203
|
|
- } else if(value.level == 3) { // LEVEL3
|
204
|
|
- // $(selector).find('.fnLevelBottomList').append($('#ITP_AJAX_MAIN_SLIDE_LEVEL3_ROWCOPY').val());
|
205
|
|
- // $(selector + ' .fnLevelBottomList .itp_svg_in:last').find('.fnMenuNm').text(value.menuNm);
|
206
|
|
-
|
207
|
|
-
|
208
|
|
-
|
209
|
|
- // $('.menu_select .panel-group > .panel-default:last').find('.fnLevelBottomList').append($('#ITP_AJAX_MAIN_SIDE_LEVEL3_ROWCOPY').val());
|
210
|
|
- // $('.menu_select .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.fnMenuNm').text(value.menuNm);
|
211
|
|
- // $('.menu_select .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-itp-nav-id', value.menuId);
|
212
|
|
- // $('.menu_select .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-conn-url', value.connUrl);
|
213
|
|
- // $('.menu_select .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-open-cd', value.openCd);
|
214
|
|
- // $('.menu_select .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('id', value.menuId + '_PAGE_NO');
|
|
225
|
+ $(selector).find('.fnLevelBottomList').empty();
|
|
226
|
+ } else if(value.level === 3) { // LEVEL3
|
|
227
|
+ $(selector).find('.fnLevelBottomList').append($('#ITP_AJAX_MAIN_SLIDE_LEVEL3_ROWCOPY').val());
|
|
228
|
+ $(selector + ' .fnLevelBottomList .itp_svg_in:last').find('.fnMenuNm').text(value.menuNm);
|
|
229
|
+ $(selector + ' .fnLevelBottomList .itp_svg_in:last').attr('data-itp-nav-id', value.menuId);
|
|
230
|
+ $(selector + ' .fnLevelBottomList .itp_svg_in:last').attr('data-conn-url', value.connUrl);
|
|
231
|
+ $(selector + ' .fnLevelBottomList .itp_svg_in:last').attr('data-open-cd', value.openCd);
|
|
232
|
+ $(selector + ' .fnLevelBottomList .itp_svg_in:last').attr('id', value.menuId + '_PAGE_NO');
|
|
233
|
+ // $(selector + ' .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-itp-nav-id', value.menuId);
|
|
234
|
+ // $(selector + ' .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-conn-url', value.connUrl);
|
|
235
|
+ // $(selector + ' .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-open-cd', value.openCd);
|
|
236
|
+ // $(selector + ' .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('id', value.menuId + '_PAGE_NO');
|
215
|
237
|
}
|
216
|
238
|
});
|
|
239
|
+ this.action();
|
217
|
240
|
},
|
218
|
241
|
action: function() {
|
219
|
|
-
|
|
242
|
+ var _this = this;
|
|
243
|
+ $('#ITP_SIDEBAR .accordion-toggle').off('click').on('click', function() {
|
|
244
|
+ console.log('accordion-toggle');
|
|
245
|
+ });
|
|
246
|
+ $('#ITP_SIDEBAR .itp_nav_link').off('click').on('click', function() {
|
|
247
|
+ const id = $(this).attr('data-itp-nav-id');
|
|
248
|
+ const connUrl = $(this).attr('data-conn-url');
|
|
249
|
+ const openCd = $(this).attr('data-open-cd');
|
|
250
|
+ console.log('id ===> ' + id);
|
|
251
|
+ console.log('connUrl ===> ' + connUrl);
|
|
252
|
+ console.log('openCd ===> ' + openCd);
|
|
253
|
+
|
|
254
|
+ if(openCd === 'C') {
|
|
255
|
+ const href = MOBILE_CONTEXTPATH + connUrl;
|
|
256
|
+ _this.loadPage(id, href);
|
|
257
|
+ }
|
|
258
|
+ });
|
|
259
|
+ },
|
|
260
|
+ loadPage: function(id, href, param) {
|
|
261
|
+ //로그인체크
|
|
262
|
+ itp_fn_logined_check();
|
|
263
|
+
|
|
264
|
+ $.ajax({
|
|
265
|
+ contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
266
|
+ url: href,
|
|
267
|
+ data: param,
|
|
268
|
+ type: 'POST',
|
|
269
|
+ dataType: 'html',
|
|
270
|
+ async: false,
|
|
271
|
+ timeout: 10000,
|
|
272
|
+ beforeSend: function() {
|
|
273
|
+ },
|
|
274
|
+ complete: function() {
|
|
275
|
+ },
|
|
276
|
+ success: function(html) {
|
|
277
|
+ console.log(html);
|
|
278
|
+ $('#ITP_CONTAINER .contents').empty().append(html);
|
|
279
|
+ //JS파일적용
|
|
280
|
+ const js = "<script src=\"../js/app/"+id.substring(0, id.length - 5).toLowerCase()+"/ITP_"+id+".js?version="+js_version+"\"></script>";
|
|
281
|
+ $('#ITP_CONTAINER #ITP_TAB_'+id+' #ITP_TAP_JS').append(js);
|
|
282
|
+ $('#ITP_MENU').toggle();
|
|
283
|
+ },
|
|
284
|
+ error: function(xhr, status, error) {
|
|
285
|
+ if (xhr.status == 401) location.href = MOBILE_CONTEXTPATH + '/app/';
|
|
286
|
+ itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failPage);
|
|
287
|
+ },
|
|
288
|
+ fail: function() {
|
|
289
|
+ itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failPage);
|
|
290
|
+ }
|
|
291
|
+ });
|
220
|
292
|
}
|
221
|
293
|
};
|
222
|
294
|
|
|
@@ -436,3 +508,158 @@ function itp_fn_date_format(date, type) {
|
436
|
508
|
return date.getFullYear() + month + day + hour + minute + second;
|
437
|
509
|
}
|
438
|
510
|
}
|
|
511
|
+
|
|
512
|
+let itp_fn_form_validate = function(form, element, arry, msg, type) {
|
|
513
|
+ var error = function(txt) {
|
|
514
|
+ if (type != 'ONLYCHK') {
|
|
515
|
+ if (msg == undefined || typeof msg == 'undefined') {
|
|
516
|
+ msg = txt;
|
|
517
|
+ }
|
|
518
|
+
|
|
519
|
+ $(element).closest('.itp_ip').addClass('has-error');
|
|
520
|
+ var error_msg = $('<span class="help-block">' + msg + '</span>');
|
|
521
|
+ if($(element).parent('.input-group').length) {
|
|
522
|
+ error_msg.insertAfter($(element).parent());
|
|
523
|
+ } else {
|
|
524
|
+ error_msg.insertAfter($(element));
|
|
525
|
+ }
|
|
526
|
+ }
|
|
527
|
+ };
|
|
528
|
+
|
|
529
|
+ if ($.inArray('empty', arry) > -1) {
|
|
530
|
+ if ($(element).val() == '' || $(element).val() < 1) {
|
|
531
|
+ error(ITP_MSG_LOCALE.message.form.mandatory);
|
|
532
|
+ return false;
|
|
533
|
+ }
|
|
534
|
+ }
|
|
535
|
+
|
|
536
|
+ if ($.inArray('emptyNum', arry) > -1) {
|
|
537
|
+ if ($(element).val() == '' || $(element).val() < 0) {
|
|
538
|
+ error(ITP_MSG_LOCALE.message.form.mandatory);
|
|
539
|
+ return false;
|
|
540
|
+ }
|
|
541
|
+ }
|
|
542
|
+
|
|
543
|
+ if ($.inArray('number', arry) > -1) {
|
|
544
|
+ const regExp = /^[0-9]+$/;
|
|
545
|
+ if (!regExp.test($(element).val())) {
|
|
546
|
+ error(ITP_MSG_LOCALE.message.form.onlynumber);
|
|
547
|
+ return false;
|
|
548
|
+ }
|
|
549
|
+ }
|
|
550
|
+
|
|
551
|
+ if ($.inArray('float', arry) > -1) {
|
|
552
|
+ if($(element).val() == '') return true;
|
|
553
|
+ const regExp = /^\d+.?\d?\d?\d?$/;
|
|
554
|
+ if (!regExp.test($(element).val())) {
|
|
555
|
+ error(ITP_MSG_LOCALE.message.form.onlynumber);
|
|
556
|
+ return false;
|
|
557
|
+ }
|
|
558
|
+ }
|
|
559
|
+
|
|
560
|
+ if ($.inArray('tel', arry) > -1) {
|
|
561
|
+ const regExp = /^\d{2,3}-\d{3,4}-\d{4}$/;
|
|
562
|
+ if (!regExp.test($(element).val())) {
|
|
563
|
+ error(ITP_MSG_LOCALE.message.form.wrongtelnumber);
|
|
564
|
+ return false;
|
|
565
|
+ }
|
|
566
|
+ }
|
|
567
|
+
|
|
568
|
+ if ($.inArray('email', arry) > -1) {
|
|
569
|
+ const regExp = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
|
|
570
|
+ if (!regExp.test($(element).val())) {
|
|
571
|
+ error(ITP_MSG_LOCALE.message.form.wrongemail);
|
|
572
|
+ return false;
|
|
573
|
+ }
|
|
574
|
+ }
|
|
575
|
+
|
|
576
|
+ if ($.inArray('id', arry) > -1) {
|
|
577
|
+ const regExp = /^[a-z]+[a-z0-9]{4,11}$/g;
|
|
578
|
+ if (!regExp.test($(element).val())) {
|
|
579
|
+ error(ITP_MSG_LOCALE.message.form.wronguserid);
|
|
580
|
+ return false;
|
|
581
|
+ }
|
|
582
|
+ }
|
|
583
|
+
|
|
584
|
+ if ($.inArray('id2', arry) > -1) {
|
|
585
|
+ const regExp = /^[A-Za-z0-9+]*$/;
|
|
586
|
+ if (!regExp.test($(element).val())) {
|
|
587
|
+ error(ITP_MSG_LOCALE.message.form.wronguserid2);
|
|
588
|
+ return false;
|
|
589
|
+ }
|
|
590
|
+ }
|
|
591
|
+
|
|
592
|
+ if ($.inArray('password', arry) > -1) {
|
|
593
|
+ const regExp = /^(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9])(?=.*[0-9]).{8,16}$/;
|
|
594
|
+ if (!regExp.test($(element).val())) {
|
|
595
|
+ error(ITP_MSG_LOCALE.message.form.wrongpassword);
|
|
596
|
+ return false;
|
|
597
|
+ }
|
|
598
|
+ }
|
|
599
|
+
|
|
600
|
+ if ($.inArray('url', arry) > -1) {
|
|
601
|
+ const regExp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
|
|
602
|
+ if (!regExp.test($(element).val())) {
|
|
603
|
+ error(ITP_MSG_LOCALE.message.form.wronglink);
|
|
604
|
+ return false;
|
|
605
|
+ }
|
|
606
|
+ }
|
|
607
|
+
|
|
608
|
+ return true;
|
|
609
|
+};
|
|
610
|
+
|
|
611
|
+let itp_fn_form_event = {
|
|
612
|
+ onKeyup: function(formId) {
|
|
613
|
+ $(formId).find('input[data-key-up]').on('keyup', function() {
|
|
614
|
+ let value = '';
|
|
615
|
+ let arry = $(this).data('key-up').split(',');
|
|
616
|
+ if ($.inArray('number', arry) > -1) {
|
|
617
|
+ value = $(this).val().replace(/[^0-9]/g, "");
|
|
618
|
+ }
|
|
619
|
+ if ($.inArray('comma', arry) > -1) {
|
|
620
|
+ value = $(this).val().replace(/[^0-9]/g, "")
|
|
621
|
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
622
|
+ }
|
|
623
|
+ if ($.inArray('regNo', arry) > -1) {
|
|
624
|
+ value = $(this).val().replace(/[^0-9]/g, "")
|
|
625
|
+ .replace(/(^[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{5})$/,"$1-$2-$3")
|
|
626
|
+ }
|
|
627
|
+ if ($.inArray('corpNo', arry) > -1) {
|
|
628
|
+ if($(this).val().length > 13) return;
|
|
629
|
+ value = $(this).val().replace(/[^0-9]/g, "")
|
|
630
|
+ .replace(/(^[0-9]{6})([0-9]+)?([0-9]{7})$/,"######-#######")
|
|
631
|
+ // .replace(/(\d{6})(\d{7})/, '######-#######')
|
|
632
|
+ }
|
|
633
|
+ if ($.inArray('tel', arry) > -1) {
|
|
634
|
+ value = ($(this).val().startsWith('0')) ? $(this).val().replace(/[^0-9]/g, "")
|
|
635
|
+ .replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})$/,"$1-$2-$3")
|
|
636
|
+ .replace("--", "-") : '';
|
|
637
|
+ }
|
|
638
|
+ $(this).val(value);
|
|
639
|
+ });
|
|
640
|
+ },
|
|
641
|
+ removeChar: function(formId) {
|
|
642
|
+ $(formId).find('input[data-key-up]').each(function() {
|
|
643
|
+ $(this).val($(this).val().replace(/[^0-9]/g, ""));
|
|
644
|
+ });
|
|
645
|
+ },
|
|
646
|
+ isValid: function(formId, type) {
|
|
647
|
+ var isValid = false;
|
|
648
|
+ $(formId).find('input, select, checkbox, textarea').each(function(k) {
|
|
649
|
+ if($(this).data('check-required')) {
|
|
650
|
+ var arry = $(this).data('check-required').split(',');
|
|
651
|
+ var alertMsg = $(this).data('alert-required');
|
|
652
|
+ console.log(alertMsg);
|
|
653
|
+ isValid = itp_fn_form_validate(formId, '#' + $(this).attr('id'), arry, undefined, alertMsg);
|
|
654
|
+ if(!isValid) {
|
|
655
|
+ if(alertMsg && alertMsg.length > 0) {
|
|
656
|
+ // itp_fn_modal_alert($(this).data('alert-msg'));
|
|
657
|
+ alert($(this).data('alert-msg'));
|
|
658
|
+ }
|
|
659
|
+ return false;
|
|
660
|
+ }
|
|
661
|
+ }
|
|
662
|
+ });
|
|
663
|
+ return isValid;
|
|
664
|
+ }
|
|
665
|
+};
|