12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969 |
- //JS버전
- var today = new Date();
- const js_version = itp_fn_date_format(today);
- requirejs.config({
- baseUrl: ITP_CONTEXTPATH,
- paths: {
- 'jquery': 'js/jquery.min',
- 'jquery-ui': 'js/jquery-ui.min',
- 'jquery.number': 'js/jquery.number',
- 'jquery.sortable': 'js/jquery.ui.sortable',
- 'jquery.grid.addons': 'plugins/grid.addons',
- 'jquery.bootstrap': 'bootstrap/dist/js/bootstrap.min',
- 'jquery.bootstrap.treeview': 'bootstrap/dist/js/bootstrap-treeview',
- 'jquery.bootstrap.fileUpload': 'bootstrap-fileUpload/dist/bootstrap-FileUpload.js?version='+js_version,
- 'jquery.bootstrap.datepicker': 'bootstrap-datepicker/js/bootstrap-datepicker',
- 'jquery.bootstrap.datepicker.locale': 'bootstrap-datepicker/locales/bootstrap-datepicker.' + ITP_LANGUAGE + '.min',
- 'jquery.rwdImageMaps': 'js/jquery.rwdImageMaps',
- 'jquery.maphilight': 'js/jquery.maphilight.min',
- 'jquery.jqGrid': 'js/jquery.jqGrid',
- 'jquery.jqGrid.grouping': 'js/grid.grouping',
- 'jquery.jqGrid.inlinedit': 'js/grid.inlinedit',
- 'jquery.jqGrid.formedit': 'js/grid.formedit',
- 'jquery.jqGrid.celledit': 'js/grid.celledit',
- 'jquery.jqGrid.treegrid': 'js/grid.treegrid',
- 'jquery.jqGrid.fmatter': 'js/jquery.fmatter',
- 'jquery.jqGrid.locale': 'js/i18n/grid.locale-' + ITP_LANGUAGE,
- 'smarteditor2': 'se2/js/service/HuskyEZCreator',
- 'message.locale': 'js/app/locales/locale-' + ITP_LANGUAGE + '.js?version='+js_version,
- 'kakao.postcode': 'https://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2',
- 'kakao.maps': 'https://dapi.kakao.com/v2/maps/sdk.js?appkey=a2ce7c66185a5413095b6485ac9ad3cd&libraries=services,clusterer&autoload=false',
- 'file.saver': 'js/FileSaver.min', // 엑셀 다운로드 (JSON 데이터를 파일로 전환)
- 'xlsx': 'js/xlsx.full.min', // 엑셀 다운로드 (JSON 데이터를 파일로 전환)
- 'html2canvas': 'js/html2canvas.min', // PDF 다운로드 (html 객체를 canvas로 변환)
- 'jspdf': 'js/jspdf.min', // PDF 다운로드 (html, 이미지, canvas 객체를 pdf로 변환)
- // 'jspdf.autotable': 'js/jspdf.plugin.autotable.min', // PDF 다운로드 (html, 이미지, canvas 객체를 pdf로 변환)
- 'crypto': 'js/crypto', //Crypto 암호화 js
- 'check': 'js/check.js?version='+js_version //
- },
- shim: {
- 'jquery.bootstrap': {
- deps: [
- 'jquery',
- 'jquery-ui'
- ]
- },
- 'jquery.bootstrap.treeview': {
- deps: ['jquery.bootstrap']
- },
- 'jquery.bootstrap.fileUpload': {
- deps: ['jquery.bootstrap']
- },
- 'jquery.bootstrap.datepicker.locale': {
- deps: [
- 'jquery.bootstrap',
- 'jquery.bootstrap.datepicker'
- ]
- },
- 'jquery.jqGrid.locale': {
- deps: [
- 'jquery.jqGrid',
- 'jquery.jqGrid.grouping',
- 'jquery.jqGrid.inlinedit',
- 'jquery.jqGrid.formedit',
- 'jquery.jqGrid.celledit',
- 'jquery.jqGrid.treegrid',
- 'jquery.jqGrid.fmatter'
- ]
- },
- 'xlsx': {
- deps: ['file.saver']
- },
- 'jspdf': {
- deps: [
- // 'jspdf.autotable',
- 'html2canvas'
- ]
- }
- }
- });
- require([
- 'jquery',
- 'jquery.bootstrap',
- 'jquery.bootstrap.datepicker.locale',
- 'jquery.jqGrid.locale',
- 'message.locale'
- ], function($) {
- $.jgrid.styleUI.Bootstrap.base.rowTable = 'table table-bordered table-striped';
- $.jgrid.defaults.styleUI = 'Bootstrap';
- $.jgrid.defaults.datatype = 'json';
- $.jgrid.defaults.mtype = 'POST';
- $.jgrid.defaults.width = 782;
- $.jgrid.defaults.height = '100%';
- $.jgrid.defaults.autowidth = true;
- $.jgrid.defaults.shrinkToFit = true;
- $.jgrid.defaults.viewrecords = true;
- $.jgrid.defaults.altRows = true;
- $.jgrid.defaults.loadonce = false;
- $.jgrid.defaults.resizable = true;
- $.jgrid.defaults.multiSort = false;
- $.jgrid.defaults.cellEdit = false;
- $.jgrid.defaults.multiselect = true;
- $.jgrid.defaults.multiboxonly = true;
- $.jgrid.defaults.outoencode = true;
- $.jgrid.defaults.cellsubmit = 'clientArray';
- $.jgrid.defaults.page = 1;
- $.jgrid.defaults.rowNum = 20;
- $.jgrid.defaults.rownumWidth = 50;
- //$.jgrid.defaults.multiselectWidth = 30;
- $.jgrid.defaults.jsonReader = {
- root: 'gridRows',
- page: 'gridPage',
- total: 'gridTotal',
- records: 'gridRecords',
- repeatitems: false,
- cell: 'cell'
- };
- $.jgrid.defaults.ajaxGridOptions = {
- contentType: 'application/json'
- };
- $.jgrid.defaults.treeGridModel = 'adjacency';
- $.jgrid.defaults.ExpandColClick = true;
- $.jgrid.defaults.tree_root_level = 0;
- $.jgrid.defaults.treeReader = {
- level_field: 'level',
- leaf_field: 'leaf'
- };
- history.pushState(null, null, location.href);
- window.onpopstate = function () {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noBack);
- history.go(1);
- };
- $('[data-toggle="tooltip"]').tooltip();
- $('.modal.itp_modal .modal-content').draggable();
- itp_fn_set_timeout.init();
- $('#ITP_BTN_HOME').on('click', function() {
- location.replace(ITP_CONTEXTPATH + '/main.html');
- });
- $('#ITP_BTN_USER').on('click', function() {
- itp_fn_call_popup(ITP_CONTEXTPATH + '/COMMONPOP_USER', '#ITP_ASIDE', 'COMMONPOP_USER', null, undefined, null, null);
- });
- $('#ITP_BTN_MENU').on('click', function() {
- //$('#ITP_OVERLAY').toggle();
- $('#ITP_SIDEBAR').toggleClass('itp_open_nav');
- $('#ITP_CONTAINER').toggleClass('itp_open_conts');
- itp_fn_fire_window_resize();
- /*
- $('#ITP_OVERLAY').off('click');
- $('#ITP_OVERLAY').on('click', function() {
- $('#ITP_OVERLAY').hide();
- $('#ITP_SIDEBAR').removeClass('itp_open_nav');
- });
- */
- });
- $('#ITP_SIDEBAR .accordion-toggle').off('click');
- $('#ITP_SIDEBAR .accordion-toggle').on('click', function() {
- $(this).find('i.indicator').toggleClass('glyphicon-chevron-down glyphicon-chevron-up');
- });
- $('#ITP_HEADER .itp_tab_list').on('click', '.itp_tab_open', function() {
- // console.log('[ITP_TAB_OPEN] CALL');
- //로그인체크
- itp_fn_logined_check();
- itp_fn_fire_window_resize();
- });
- $('#ITP_HEADER .itp_tab_list').on('click', '.itp_tab_close', function() {
- var tab_id = $(this).attr('data-itp-tab-id');
- var li = $(this).closest('li');
- var tabSize = $('#ITP_HEADER .itp_tab_list li').size() - 1;
- var curIdx = li.index();
- $('#ITP_TAB_' + tab_id).remove();
- $(this).closest('li').remove();
- if(curIdx === tabSize) {
- $('#ITP_HEADER .itp_tab_list li').removeClass('active');
- $('#ITP_CONTAINER .itp_contents .itp_sec').removeClass('active');
- // $('#ITP_HEADER .itp_tab_list li:first-child').addClass('active');
- // $('#ITP_CONTAINER .itp_contents .itp_sec:first-child').addClass('active');
- $('#ITP_HEADER .itp_tab_list li').eq(curIdx - 1).addClass('active');
- $('#ITP_CONTAINER .itp_contents .itp_sec').eq(curIdx - 1).addClass('active');
- itp_fn_fire_window_resize();
- }
- return false;
- });
- $('#ITP_CONTAINER').on('click', '.itp_srh_wrap_toggle .itp_srh_close', function() {
- var wrap = $(this).closest('.itp_srh_wrap_toggle');
- wrap.addClass('itp_srh_list_close');
- wrap.find('.itp_srh_toggle').addClass('itp_hide_away');
- wrap.find('.itp_srh_head').addClass('itp_height_full');
- wrap.find('.itp_srh_tab_toggle').hide();
- $(this).removeClass('show');
- $(this).addClass('hidden');
- $(this).next().removeClass('hidden');
- $(this).next().addClass('show');
- itp_fn_fire_window_resize();
- });
- $('#ITP_CONTAINER').on('click', '.itp_srh_wrap_toggle .itp_srh_open', function() {
- var wrap = $(this).closest('.itp_srh_wrap_toggle');
- wrap.removeClass('itp_srh_list_close');
- wrap.find('.itp_srh_toggle').removeClass('itp_hide_away');
- wrap.find('.itp_srh_head').removeClass('itp_height_full');
- wrap.find('.itp_srh_tab_toggle').show();
- $(this).removeClass('show');
- $(this).addClass('hidden');
- $(this).prev().removeClass('hidden');
- $(this).prev().addClass('show');
- itp_fn_fire_window_resize();
- });
-
- $('#ITP_HEADER #ITP_LOGIN_USER').on('click', function() {
-
- const key = {viewCd: 'R', userId: USER_ID};
- var param = $.param(key);
- var popFn = function(result) {
-
- };
- fn_call_popup('comm', 'USER_INFO_MODIFY_POPUP', '#ITP_ASIDE', popFn, param, 'S');
- $('#ITP_USER_INFO_MODIFY_POPUP > div.modal-dialog').width('500px');
- });
- $('#ITP_CONTAINER').on('keyup', 'input, textarea', function() {
- var $th = $(this);
- $th.val($th.val().replace(/(<([^>]+)>)/ig, function() {return '';}));
- });
- $.fn.clearForm = function() {
- return this.each(function() {
- var type = this.type, tag = this.tagName.toLowerCase();
- if (tag == 'form')
- return $(':input',this).clearForm();
- if (type == 'text' || type == 'password' || tag == 'textarea'|| type == 'hidden')
- this.value = '';
- else if (type == 'checkbox' || type == 'radio')
- this.checked = false;
- else if (tag == 'select')
- this.selectedIndex = -1;
- });
- };
- $.fn.serializeObject = function() {
- var result = {};
- var extend = function(i, element) {
- var node = result[element.name];
- if ('undefined' !== typeof node && node !== null) {
- if ($.isArray(node)) {
- node.push($.trim(element.value));
- } else {
- result[element.name] = [node, $.trim(element.value)];
- }
- } else {
- result[element.name] = $.trim(element.value);
- }
- }
- $.each(this.serializeArray(), extend);
- return result;
- };
- $.fn.extend({
- treed: function(o) {
- var openedClass = 'glyphicon-minus text-primary';
- var closedClass = 'glyphicon-plus text-primary';
- if (typeof o != 'undefined') {
- if (typeof o.openedClass != 'undefined') {
- openedClass = o.openedClass;
- }
- if (typeof o.closedClass != 'undefined') {
- closedClass = o.closedClass;
- }
- };
- var tree = $(this);
- tree.addClass('tree');
- tree.find('li').has('ul').each(function() {
- var branch = $(this);
- branch.find('.list-group-item').first().prepend('<i class="indicator glyphicon ' + closedClass + '"></i>');
- branch.addClass('branch');
- branch.on('click', function(e) {
- if (this == e.target) {
- var icon = $(this).find('.list-group-item').first().children('i:first');
- icon.toggleClass(openedClass + ' ' + closedClass);
- $(this).children('ul').children().toggle();
- }
- });
- branch.children('ul').children().toggle();
- //branch.children('ul').children().show();
- });
- tree.find('.branch .indicator').each(function() {
- $(this).on('click', function() {
- $(this).closest('li').click();
- return false;
- });
- });
- }
- });
- const newPostParam = {
- openYn: $('#ITP_CONTAINER').data('openYn'),
- navId: $('#ITP_CONTAINER').data('navId'),
- titId: $('#ITP_CONTAINER').data('titId')
- };
- if (newPostParam.openYn == 'Y') {itp_fn_open_tab(newPostParam);}
- // 로그아웃 버튼
- $('.ITP_BTN_LOGOUT').click(function() {
- fnLogout();
- });
- // 로그인 여부 체크
- var pathname = $(location).attr('pathname');
- if(pathname.indexOf('login.html') < 0) {
- itp_fn_logined_check(true, function() {
- if (VIEW_PAGE != 'LOGIN') { //main.html 이 load 되면 기본 정보 데이터를 불러온다.
- var data = JSON.parse(sessionStorage.getItem('itp_login_info'));
- CONN_KEY = data.connKey; //로그인 했을때 넣었던 키를 가져옴
- var callbackFn = function(result) {
- console.log(result);
- CODE_LIST = result.codeList;
- AUTH_MENU_LIST = result.authMenuList;
- ACT_LIST = result.actList;
- POP_LIST = result.popList;
- USER_ID = result.userId;
- USER_NM = result.userNm;
- USER_TYPE_CD = result.userTypeCd;
- AUTH_TYPE_CD = result.authTpCd;
- AUTH_TYPE_NM = result.authTpNm;
- AFFL_SHOP_LIST = result.afflList;
- AFFL_BRAND_LIST = result.brandList;
- /*
- if(FRCOMP_LIST.length > 0) {
- let itp_manage_cmpy_cd = '';
- let data = JSON.parse(sessionStorage.getItem('itp_manage_cmpy_cd'));
- if(data != null && data != undefined ) {
- itp_manage_cmpy_cd = data.cmpyCd;
- }
- let check = false;
- $.each(FRCOMP_LIST, function(idx, value) {
- if(value.cmpyCd == itp_manage_cmpy_cd) {
- check = true;
- }
- });
- if(!check) {
- sessionStorage.setItem('itp_manage_cmpy_cd', JSON.stringify(FRCOMP_LIST[0])); // 가맹점정보
- }
- } else {
- // sessionStorage.removeItem('itp_manage_cmpy_cd');
- */
- sessionStorage.setItem('itp_manage_cmpy_cd', '{}');
- //}
- // 사용자명
- $('#ITP_LOGIN_USER').text(USER_NM);
- // 가맹점 만들기
- fn_make_affl_brand.init();
- // 왼쪽 메뉴 만들기
- fn_make_side_menu();
- // 메뉴 요약
- fn_make_menu_summary();
- // 메인 팝업 띄우기
- fn_proc_popup_view('M');
- };
- fn_ajax_call('/api/session/data', null, callbackFn, 'GET');
- }
- });
- }
- });
- function fn_make_menu_summary() {
-
- $('#ITP_AJAX_SUMMARY_DETAIL_CONTAINER #ITP_SUMMARY_jqGrid_list tbody tr').css('display','none');
- $('#ITP_AJAX_SUMMARY_DETAIL_CONTAINER #ITP_SUMMARY_jqGrid_list tbody .USER_TYPE_'+USER_TYPE_CD).show();
-
- }
- var fn_make_affl_brand = {
- init : function() {
- this.make();
- this.action();
- },
- make: function () {
- sessionStorage.setItem('itp_manage_cmpy_cd', (AFFL_BRAND_LIST.length < 1) ? '' : JSON.stringify(AFFL_BRAND_LIST[0]));
- let authTypeNm = (AUTH_TYPE_NM === undefined) ? '오더퀸' : AUTH_TYPE_NM;
- $('#ITP_TXT_MAIN_SHR_AFFL').text(authTypeNm);
- },
- action: function () {
- $('#ITP_BTN_MAIN_SHR_AFFL').on('click', function() {
- // 팝업
- var popFn = function(rowDataPop) {
- console.log(rowDataPop);
- // sessionStorage.setItem('itp_manage_cmpy_cd', JSON.stringify(AFFL_BRAND_LIST[0]));
- // $('#ITP_TXT_MAIN_SHR_CMPY').text(AFFL_BRAND_LIST[0].brandNm);
- $.each(rowDataPop, function(key, value) {
- itp_fn_close_other_tab(''); // 다른탭 닫기
- $('#ITP_TXT_MAIN_SHR_BRAND').text('(' + value.brandNm + ')');
- sessionStorage.setItem('itp_manage_brand_cd', JSON.stringify(value));
- });
- };
- fn_call_popup('biz', 'BIZPOP_AFFL_BRAND', '#ITP_ASIDE', popFn, null, 'S');
- });
- }
- };
- function fn_make_side_menu() {
- $('#ITP_SIDEBAR .panel-group').empty();
-
- $.each(AUTH_MENU_LIST, function(key, value) {
- // console.log(JSON.stringify(value));
- if(value.level == 2) { // LEVEL2
- $('#ITP_SIDEBAR .panel-group').append($('#ITP_AJAX_MAIN_SIDE_LEVEL2_ROWCOPY').val());
- $('#ITP_SIDEBAR .panel-group > .panel-default:last').find('.fnMenuNm').text(value.menuNm);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last').find('.accordion-toggle').attr('href', '#ITP_NAV_'+value.menuNo);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last').find('.panel-collapse').attr('id', 'ITP_NAV_'+value.menuNo);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last').find('.fnLevelBottomList').empty();
- } else if(value.level == 3) { // LEVEL3
- $('#ITP_SIDEBAR .panel-group > .panel-default:last').find('.fnLevelBottomList').append($('#ITP_AJAX_MAIN_SIDE_LEVEL3_ROWCOPY').val());
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.fnMenuNm').text(value.menuNm);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-itp-nav-id', value.menuId);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-conn-url', value.connUrl);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-open-cd', value.openCd);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('id', value.menuId + '_PAGE_NO');
- } else if(value.level == 4) { // LEVEL4
- $('#ITP_SIDEBAR .panel-group > .panel-default:last').find('.fnLevelBottomList').append($('#ITP_AJAX_MAIN_SIDE_LEVEL4_ROWCOPY').val());
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.fnMenuNm').text(value.menuNm);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-itp-nav-id', value.menuId);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-conn-url', value.connUrl);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-open-cd', value.openCd);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('id', value.menuId + '_PAGE_NO');
- } else if(value.level == 5) { // LEVEL5
- $('#ITP_SIDEBAR .panel-group > .panel-default:last').find('.fnLevelBottomList').append($('#ITP_AJAX_MAIN_SIDE_LEVEL5_ROWCOPY').val());
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.fnMenuNm').text(value.menuNm);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-itp-nav-id', value.menuId);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-conn-url', value.connUrl);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('data-open-cd', value.openCd);
- $('#ITP_SIDEBAR .panel-group > .panel-default:last .fnLevelBottomList .itp_svg_in:last').find('.itp_nav_link').attr('id', value.menuId + '_PAGE_NO');
- }
- });
-
- $('#ITP_SIDEBAR .itp_nav_link').off('click');
- $('#ITP_SIDEBAR .itp_nav_link').on('click', function() {
- const id = $(this).attr('data-itp-nav-id');
- const connUrl = $(this).attr('data-conn-url');
- const openCd = $(this).attr('data-open-cd');
- // const path = '/app/'+id.substring(0, id.length - 5).toLowerCase();
- const tabSize = $('#ITP_HEADER .itp_tab_list li').size();
- console.log('[ITP_NAV_LINK] data-itp-nav-id = ' + id + ', data-conn-url = ' + connUrl + ', tabSize = ' + tabSize);
- // if(String(id).indexOf('OPER') === -1 && String(id).indexOf('SYSTEM') === -1 && !sessionStorage.getItem('itp_manage_brand_cd')) {
- // itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noChoiceBrand);
- // return false;
- // }
- if (tabSize > 10) {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noMoreTab);
- return false;
- }
- let isDup = false;
- $('#ITP_HEADER .itp_tab_list li').each(function() {
- const tab_id = $(this).find('.itp_tab_close').attr('data-itp-tab-id');
- if (tab_id == id) {
- isDup = true;
- $('#ITP_HEADER .itp_tab_list li').removeClass('active');
- $('#ITP_CONTAINER .itp_contents .itp_sec').removeClass('active');
- $(this).addClass('active');
- $('#ITP_TAB_' + id).addClass('active');
- return false;
- }
- });
- if (!isDup && openCd == 'C') {
- const href = ITP_CONTEXTPATH + connUrl; // $(this).attr('href');
- const text = $(this).children('.itp_tt').text();
- const tab = '<li class="active"><a href="#ITP_TAB_' + id + '" role="tab" data-toggle="tab" class="itp_tab_open">' + text + ' <i class="glyphicon glyphicon-remove itp_tab_close" data-itp-tab-id="' + id + '"></i></a></li>';
- itp_fn_load_page(href, tab, '', id);
- } else {
- itp_fn_fire_window_resize();
- }
- return false;
- });
- }
- function fn_proc_btn_auth(menu_id) {
- $.each(ACT_LIST, function(key, value) {
- if(menu_id == value.menuId) {
- if(value.viewYn == 'Y') {
- $('#ITP_TAB_' + menu_id).find('.'+value.actTpCd).addClass('SHOW');
- } else {
- $('#ITP_TAB_' + menu_id).find('.'+value.actTpCd).removeClass('SHOW');
- }
- }
- });
-
- $('#ITP_TAB_' + menu_id + ' button').each(function(index, item) {
- // console.log('id = ' + item.id);
- if(item.id && item.id != '') {
- $('#'+item.id).hide();
- if($('#'+item.id).hasClass('SHOW')) {
- $('#'+item.id).show();
- }
- }
- });
-
- // 가맹점검색 버튼 처리
- if(USER_TYPE_CD == 'N' || USER_TYPE_CD == 'P') { // 내부사용자&영업
- $('#ITP_TXT_'+menu_id+'_SHR_CMPY').show();
- $('#ITP_BTN_'+menu_id+'_SHR_CMPY').show();
- } else {
- $('#ITP_TXT_'+menu_id+'_SHR_CMPY').hide();
- $('#ITP_BTN_'+menu_id+'_SHR_CMPY').hide();
- }
-
- fn_proc_popup_view('S', menu_id); // 팝업처리
- }
- function fn_proc_popup_view(view_target_cd, menu_id) {
- var sIdx=0;
- var mIdx=0;
- var lIdx=0;
- $.each(POP_LIST, function(key, value) {
- if('S' == view_target_cd && 'S' == value.viewTargetCd && value.menuId == menu_id) {
- // 팝업처리
- console.log('[POPUP_VIEW:S]' + value.popNo);
- if(itp_fn_get_cookie(value.popNo) != 'Y') {
- fn_popup_window_center('popup.html?popNo='+value.popNo, value.popNo, value.popWidth, value.popHeight, sIdx);
- }
- sIdx++;
- } else if('M' == view_target_cd && 'M' == value.viewTargetCd) {
- // 팝업처리
- console.log('[POPUP_VIEW:M]' + value.popNo + ', mIdx : ' + mIdx);
- if(itp_fn_get_cookie(value.popNo) != 'Y') {
- fn_popup_window_center('popup.html?popNo='+value.popNo, value.popNo, value.popWidth, value.popHeight, mIdx);
- }
- mIdx++;
- } else if('L' == view_target_cd && 'L' == value.viewTargetCd) {
- // 팝업처리
- console.log('[POPUP_VIEW:L]' + value.popNo + ', lIdx : ' + lIdx);
- if(itp_fn_get_cookie(value.popNo) != 'Y') {
- fn_popup_window_center('popup.html?popNo='+value.popNo, value.popNo, value.popWidth, value.popHeight, lIdx);
- }
- lIdx++;
- }
- });
- }
- function fn_show_btn_auth(btn_id) {
- if($(btn_id).hasClass('SHOW')) {
- $(btn_id).show();
- } else {
- $(btn_id).hide();
- }
- }
- function fn_make_select(options, code, select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
-
- $.each(options, function(key, value) {
- if (value.codeCd == code) {
- if(all_show_yn == undefined || all_show_yn == true) {
- if(all_name == undefined || all_name == '') {
- $('<option/>', {'value': '', 'text': value.codeNm}).prependTo($select_id);
- } else {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- }
- $.each(value.codeDtlList, function(k, val) {
- $('<option/>', {
- 'value': val.codeDtlCd,
- 'text': val.codeDtlNm
- }).appendTo($select_id);
- });
- return false;
- }
- });
- };
- function fn_make_select_upper_menu(options, select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- if (value.level == 3) {
- $('<option/>', {
- 'value': value.menuNo,
- 'text': value.menuNm
- }).appendTo($select_id);
- }
- });
- };
- function fn_make_select_brand(options, select_id, all_show_yn, all_name) { //브랜드 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.brandId, // 브랜드코드
- 'text': value.brandNm // 브랜드명
- }).appendTo($select_id);
- });
- };
- function fn_make_select_store(options, select_id, all_show_yn, all_name, all_value) { //매장 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': !all_value || all_value == undefined ? '' : all_value, 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.storeNo, // 매장번호
- 'data-sale-store-no': value.saleStoreNo, // 판매매장번호
- 'text': value.storeNm // 매장명
- }).appendTo($select_id);
- });
- };
- function fn_make_select_pos(options, select_id, all_show_yn, all_name) { //포스 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.posNo, // 포스번호
- 'text': value.posNo // 포스명
- }).appendTo($select_id);
- });
- };
- function fn_make_select_van(options, select_id, all_show_yn, all_name) { //매장 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.vanCd, // VAN코드
- 'text': value.vanNm // VAN명
- }).appendTo($select_id);
- });
- };
- function fn_make_select_class(options, select_id, all_show_yn, all_name) { //카테고리 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- if(options == null) {
- return;
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.classCd,
- 'text': value.classNm
- }).appendTo($select_id);
- });
- };
- function fn_make_select_corner(options, select_id, all_show_yn, all_name) { //코너 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.cornerCd,
- 'text': value.cornerNm
- }).appendTo($select_id);
- });
- };
- function fn_make_select_workplace(options, select_id, all_show_yn, all_name) { //사업장 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.wkpeNo, // 사업장번호
- 'text': value.wkpeNm // 사업장명
- }).appendTo($select_id);
- });
- };
- function fn_make_select_location(options, select_id, all_show_yn, all_name) { //위치 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.lctnNo, // 위치번호
- 'text': value.lctnNm // 위치명
- }).appendTo($select_id);
- });
- };
- function fn_make_select_category(options, select_id, all_show_yn, all_name) { //카테고리 셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': value.cateNo, // 카테고리번호
- 'text': value.cateNm // 카테고리명
- }).appendTo($select_id);
- });
- };
- function fn_make_year_select(select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
-
- var toDate = new Date();
- var current_year = toDate.getFullYear();
- var start_year = current_year;
-
- for(var i = start_year ; i <= current_year ; i++) {
- $('<option/>', {'value': i, 'text': i + '년'}).appendTo($select_id);
- }
- $select_id.val(current_year);
- };
- function fn_make_month_select(select_id, all_show_yn, all_name, start_mon, current_yn, char_yn) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- if (!start_mon || start_mon == undefined)
- start_mon = 0;
-
- var value;
- for(var i = start_mon ; i < 13 ; i++) {
- if(i < 10) value = '0' + i;
- else value = i;
-
- if(char_yn == true) {
- $('<option/>', {'value': value, 'text': value + '월'}).appendTo($select_id);
- } else {
- $('<option/>', {'value': value, 'text': value}).appendTo($select_id);
- }
- }
-
- if (current_yn && current_yn == true) {
- var toDate = new Date();
- var mm = toDate.getMonth() + 1;
- mm = (mm < 10) ? '0' + mm : mm;
- $select_id.val(mm);
- }
- };
- function fn_make_day_select(select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- var value;
- for(var i = 0 ; i < 32 ; i++) {
- if(i < 10) value = '0' + i;
- else value = i;
- $('<option/>', {'value': value, 'text': value}).appendTo($select_id);
- }
- };
- function fn_make_hh_select(select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- var value;
- for(var i = 0 ; i < 24 ; i++) {
- if(i < 10) value = '0' + i;
- else value = i;
- $('<option/>', {'value': value, 'text': value}).appendTo($select_id);
- }
- };
- function fn_make_mi_select(select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- var value;
- for(var i = 0 ; i < 60 ; i++) {
- if(i < 10) value = '0' + i;
- else value = i;
- $('<option/>', {'value': value, 'text': value}).appendTo($select_id);
- }
- };
- function fn_make_ss_select(select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
- $select_id = $('#' + select_id);
- $select_id.empty();
- if(all_show_yn == true) {
- $('<option/>', {'value': '', 'text': all_name}).prependTo($select_id);
- }
- var value;
- for(var i = 0 ; i < 60 ; i++) {
- if(i < 10) value = '0' + i;
- else value = i;
- $('<option/>', {'value': value, 'text': value}).appendTo($select_id);
- }
- };
- function fn_make_input_common_cd(options, code, input_id, all_show_yn) { //HIDDEN 공통코드 리스트 만들기
- $input_id = $('#' + input_id);
- $input_id.val('');
- $.each(options, function(key, value) {
- if (value.codeCd == code) {
- //예제) :;BN:읽기버튼;BNW:쓰기버튼;LK:링크;MU:메뉴
- let code_list = '';
- if(all_show_yn == true) {
- code_list = code_list + ':';
- }
- $.each(value.codeDtlList, function(k, val) {
- if(k > 0) {
- code_list = code_list + ';';
- } else if(k == 0 && all_show_yn == true) {
- code_list = code_list + ';';
- }
- code_list = code_list + val.codeDtlCd;
- code_list = code_list + ':';
- code_list = code_list + val.codeDtlNm;
- });
- $input_id.val(code_list);
- return false;
- }
- });
- };
- function fn_make_common_cd_list(options, code, all_show_yn) { // 공통코드 리스트 만들기
- // $input_id = $('#' + input_id);
- // $input_id.val('');
- var return_val;
- $.each(options, function(key, value) {
- if (value.codeCd == code) {
- //예제) :;BN:읽기버튼;BNW:쓰기버튼;LK:링크;MU:메뉴
- let code_list = '';
- if(all_show_yn == true) {
- code_list = code_list + ':';
- }
- $.each(value.codeDtlList, function(k, val) {
- if(k > 0) {
- code_list = code_list + ';';
- } else if(k == 0 && all_show_yn == true) {
- code_list = code_list + ';';
- }
- code_list = code_list + val.codeDtlCd;
- code_list = code_list + ':';
- code_list = code_list + val.codeDtlNm;
- });
- // $input_id.val(code_list);
- // return code_list;
- return_val = code_list;
- }
- });
- return return_val;
- };
- function fn_make_input_store_print(options, input_id, all_show_yn) { //HIDDEN 매장프린터 리스트 만들기
- $input_id = $('#' + input_id);
- $input_id.val('');
- let list = '';
- if(all_show_yn == true) {
- list = list + ':';
- }
- $.each(options, function(key, value) {
- if(key > 0) {
- list = list + ';';
- } else if(key == 0 && all_show_yn == true) {
- list = list + ';';
- }
- list = list + value.printNo;
- list = list + ':';
- list = list + value.printNo;
- });
- $input_id.val(list);
- };
- function fn_make_input_store_kds(options, input_id, all_show_yn) { //HIDDEN 매장KDS 리스트 만들기
- $input_id = $('#' + input_id);
- $input_id.val('');
- let list = '';
- if(all_show_yn == true) {
- list = list + ':';
- }
- $.each(options, function(key, value) {
- if(key > 0) {
- list = list + ';';
- } else if(key == 0 && all_show_yn == true) {
- list = list + ';';
- }
- list = list + value.kdsNo;
- list = list + ':';
- list = list + value.kdsNo;
- });
- $input_id.val(list);
- };
- function fnHashed(code) { //유니코드로 들어오는 해쉬키를 스트링으로 변환
- return decodeURIComponent(JSON.parse('"' + code.replace(/\"/g, '\\"') + '"'));
- };
- function fnLogout() { //로그아웃
- var callbackFn = function(result) {
- sessionStorage.removeItem('itp_login_info'); //Jwt 키 제거
- $(location).attr('href', ITP_CONTEXTPATH + '/login.html');
- };
- fn_ajax_call('/api/member/sign-out', null, callbackFn, 'PATCH');
- };
- function fnSessionOut() { //1시간 동안 아무것도 안할때 또는 강제 만료시킬때 사용
- var callbackFn = function(result) {
- sessionStorage.removeItem('itp_login_info'); //Jwt 키 제거
- $(location).attr('href', ITP_CONTEXTPATH + '/login.html');
- };
- fn_ajax_call('/api/session/expire', null, callbackFn, 'PATCH');
- };
- //AJAX 양식 (이렇게 사용하시면 됩니다.)
- function fn_ajax_call(href, param, fn, type) {
- $.ajax({
- contentType: 'application/json',
- url: DOMAIN + href,
- data: param,
- type: type,
- async: false,
- timeout: 10000,
- xhrFields: {
- withCredentials: true //Cross Domain 처리
- },
- beforeSend: function(xhr) {
- $('#ITP_OVERLAY').show();
- xhr.setRequestHeader('X-AUTH-TOKEN', CONN_KEY); //Jwt 토큰을 헤더에 담아서 보낸다.
- },
- complete: function() {
- $('#ITP_OVERLAY').hide();
- },
- success: function(result) {
- if (result.code !== undefined) { //성공시에도 메세지가 있으면 얼럿 예)저장되었습니다.
- itp_fn_modal_alert_ajax(result.message);
- }
- if (fn !== undefined || typeof fn !== 'undefined') fn(result);
- },
- error: function(xhr, status, error) {
- if (xhr.responseJSON !== undefined) { //실패시 서버에서 내려주는 메세지 얼럿
- itp_fn_modal_alert_ajax(xhr.responseJSON.message);
- if (xhr.status == 401) { //401에러가 떨어지면 로그인페이지로 이동
- sessionStorage.removeItem('itp_login_info'); //Jwt 키 제거
- $(location).attr('href', ITP_CONTEXTPATH + '/login.html');
- }
- } else {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- });
- };
- function itp_fn_logined_check(user_nm_update, fn) {
- //console.log('[ITP_FN_LOGINED_CHECK] CALL, user_nm_update = ' + user_nm_update);
- var now, expiration, data = false;
- data = sessionStorage.getItem('itp_login_info');
- if(data) {
- data = JSON.parse(data);
- now = new Date();
- expiration = new Date(data.timestamp);
- expiration.setMinutes(expiration.getMinutes() + 60);
- if (now.getTime() > expiration.getTime()) {
- data = false;
- fnSessionOut();
- } else {
- sessionStorage.setItem('itp_login_info', JSON.stringify({
- timestamp: new Date(),
- connKey: data.connKey //Jwt키를 가져와서 세션 스토리지에 저장
- }));
- if(user_nm_update && user_nm_update == true) {
- if (fn !== undefined || typeof fn !== 'undefined') {
- fn();
- }
- }
- }
- } else {
- // 로그인 페이지로 이동
- $(location).attr('href', ITP_CONTEXTPATH + '/login.html');
- }
- }
- function itp_fn_get_code_detail_list(code_cd) {
- let map = new Map(JSON.parse(sessionStorage.itp_common_code));
- if(map.has(code_cd)) {
- return JSON.parse(map.get(code_cd));
- } else {
- return null;
- }
- }
- const ITP_GRID_NAV_DEFAULTS = {
- navGrid: {edit: false, add: false, del: false, refresh: true, view: false, search: false},
- inlineNav: {edit: false, add: false, cancel: false, save: false}
- };
- const ITP_GRID_NUM_WIDTH = {
- numWidth: 50,
- orderWidth: 70
- };
- const ITP_GRID_COL_STYLE = {
- link: {'color': '#000', 'text-decoration': 'underline', 'font-weight': 'bold', 'cursor': 'pointer'},
- selected: {'color': '#337ab7', 'text-decoration': 'underline', 'cursor': 'pointer'},
- popup: {'color': '#000', 'text-decoration': 'underline'},
- register: {'color': '#337ab7', 'text-decoration': 'underline'},
- delete: {'color': '#ac2925', 'text-decoration': 'underline'},
- important: {'color': '#ac2925'},
- cancel: {'color': '#ac2925', 'background': '#fff3f3'},
- blue: {'background': '#f3f8ff'},
- pay: {'color': '#337ab7', 'background': '#f3f8ff'},
- settle: {'background': '#f1f1f1'}
- };
- let ITP_UPLOAD_DEFAULTS = {
- fileTypes: {
- archives: ['zip', '7z', 'gz', 'gzip', 'rar', 'tar']
- ,audio: ['mp3', 'wav', 'wma', 'wpl', 'aac', 'flac', 'm4a', 'm4b', 'm4p', 'midi', 'ogg']
- ,files: ['doc', 'docx', 'dotx', 'docm', 'ods', 'odt', 'ott', 'ods', 'pdf', 'ppt', 'pptm', 'pptx', 'pub', 'rtf', 'csv', 'log', 'txt', 'xls', 'xlsm', 'xlsx', 'hwp', 'avi', 'mp4']
- ,images: ['bmp', 'tif', 'tiff', 'gif', 'jpeg', 'jpg', 'png', 'svg', 'ico', 'raw']
- }
- };
- const ITP_DATE_LANGUAGE = (function() {
- let lang = ITP_LANGUAGE;
- if (lang == 'en') {lang = ITP_LANGUAGE + '-GB';}
- var agrs = {language: lang};
- return agrs;
- }());
- function itp_fn_get_date_lang_format(yyyy, mm, dd, split){
- var retVal = '';
- if (ITP_LANGUAGE == 'en') {
- retVal = mm + split + dd + split + yyyy;
- } else {
- retVal = yyyy + split + mm + split + dd;
- }
- return retVal;
- };
- function itp_fn_get_add_date(sDate, v, split) {
- if (split == null || split == undefined) split = '.';
- sDate = itp_fn_delete_date_format(sDate);
- var yy = parseInt(sDate.substring(0, 4), 10);
- var mm = parseInt(sDate.substring(4, 6), 10);
- var dd = parseInt(sDate.substring(6), 10);
- var d = new Date(yy, mm - 1, dd + v);
- yy = d.getFullYear();
- mm = d.getMonth() + 1; mm = (mm < 10) ? '0' + mm : mm;
- dd = d.getDate(); dd = (dd < 10) ? '0' + dd : dd;
- return itp_fn_get_date_lang_format(yy, mm, dd, split);
- };
- function itp_fn_get_add_date_ko(sDate, v, split) {
- if (split == null || split == undefined) split = '.';
- sDate = itp_fn_delete_date_format(sDate);
- var yy = parseInt(sDate.substring(0, 4), 10);
- var mm = parseInt(sDate.substring(4, 6), 10);
- var dd = parseInt(sDate.substring(6), 10);
- var d = new Date(yy, mm - 1, dd + v);
- yy = d.getFullYear();
- mm = d.getMonth() + 1; mm = (mm < 10) ? '0' + mm : mm;
- dd = d.getDate(); dd = (dd < 10) ? '0' + dd : dd;
- return yy + split + mm + split + dd;
- };
- function itp_fn_get_today(split) {
- var retVal = '';
- if (split == null || split == undefined) split = '.';
- var toDate = new Date();
- var yyyy = toDate.getFullYear();
- var mm = toDate.getMonth()+1;
- var dd = toDate.getDate();
- mm = (mm < 10) ? '0' + mm : mm;
- dd = (dd < 10) ? '0' + dd : dd;
- return itp_fn_get_date_lang_format(yyyy, mm, dd, split);
- };
- function itp_fn_get_bom_today(split) {
- var retVal = '';
- if (split == null || split == undefined) split = '.';
- //var toDate = new Date();
- var yyyy = "2099";
- var mm = "12";
- var dd = "31";
- mm = (mm < 10) ? '0' + mm : mm;
- dd = (dd < 10) ? '0' + dd : dd;
- return itp_fn_get_date_lang_format(yyyy, mm, dd, split);
- };
- function itp_fn_get_today_ko(split) {
- var retVal = '';
- if (split == null || split == undefined) split = '.';
- var toDate = new Date();
- var yyyy = toDate.getFullYear();
- var mm = toDate.getMonth()+1;
- var dd = toDate.getDate();
- mm = (mm < 10) ? '0' + mm : mm;
- dd = (dd < 10) ? '0' + dd : dd;
- return yyyy + split + mm + split + dd;
- };
- function itp_fn_get_before_month(dateStr, addMonth, split) {
- if (split == null || split == undefined) split = '.';
- dateStr = itp_fn_delete_date_format(dateStr);
- var yyyy = dateStr.substring(0,4),
- mm = parseInt(dateStr.substring(4,6), 10),
- dd = parseInt(dateStr.substring(6), 10),
- date = new Date(yyyy, mm-1, dd);
- date.setMonth(date.getMonth() - addMonth);
- yyyy = date.getFullYear();
- mm = date.getMonth()+1;
- dd = date.getDate();
- if (parseInt(mm) < 10) mm = '0' + mm;
- if (parseInt(dd) < 10) dd = '0' + dd;
- return itp_fn_get_date_lang_format(yyyy, mm, dd, split);
- };
- function itp_fn_get_after_month(dateStr, addMonth, split) {
- if (split == null || split == undefined) split = '.';
- dateStr = itp_fn_delete_date_format(dateStr);
- var yyyy = dateStr.substring(0,4),
- mm = parseInt(dateStr.substring(4,6), 10),
- dd = parseInt(dateStr.substring(6), 10),
- date = new Date(yyyy, mm-1, dd);
- date.setMonth(date.getMonth() + addMonth);
- yyyy = date.getFullYear();
- mm = date.getMonth()+1;
- dd = date.getDate();
- if (parseInt(mm) < 10) mm = '0' + mm;
- if (parseInt(dd) < 10) dd = '0' + dd;
- return itp_fn_get_date_lang_format(yyyy, mm, dd, split);
- };
- function itp_fn_get_last_day(dateStr, month, split) {
- if (split == null || split == undefined) split = '.';
- var _tmp = '';
- if (dateStr == null || dateStr == undefined) _tmp = itp_fn_get_today_ko('');
- else _tmp = itp_fn_delete_date_format(dateStr);
- var yyyy = _tmp.substring(0,4),
- mm = _tmp.substring(4,6);
- if (month != null && month != undefined) mm = month;
- var dd = (new Date(yyyy,mm,0)).getDate();
- return itp_fn_get_date_lang_format(yyyy, mm, dd, split);
- };
- function itp_fn_get_first_day(dateStr, split) {
- if (split == null || split == undefined) split = '.';
- var _tmp = '';
- if (dateStr == null || dateStr == undefined) _tmp = itp_fn_get_today_ko('');
- else _tmp = itp_fn_delete_date_format(dateStr);
- var yyyy = _tmp.substring(0,4)
- ,mm = _tmp.substring(4,6)
- ,dd = '01';
- return itp_fn_get_date_lang_format(yyyy, mm, dd, split);
- };
- function itp_fn_delete_date_format(str) {
- var temp = '';
- for (var i = 0; i < str.length; i++) {
- if (str.charAt(i) == '-' || str.charAt(i) == '.' || str.charAt(i) == '/' || str.charAt(i) == ':') {
- continue;
- } else {
- temp += str.charAt(i);
- }
- }
- return temp;
- };
- function itp_fn_get_url_param(name) {
- var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
- if (results == null) {
- return null;
- } else {
- return results[1] || 0;
- }
- };
- var itp_fn_get_param_value = function(params, key){
- var results = new RegExp('[\?&]' + key + '=([^&#]*)').exec(params);
- if (results==null){
- return null;
- }
- else{
- return results[1] || 0;
- }
- }
- function itp_fn_close_other_tab(tabId) {
-
- $('#ITP_HEADER .itp_tab_list li').each(function() {
- var tmpId = $(this).find('.itp_tab_close').attr('data-itp-tab-id');
-
- if(tmpId) {
- // console.log('### MEMU : ' + tmpId + ', ACTIVE : ' + $(this).hasClass('active'));
-
- if($(this).hasClass('active') == false && tmpId != tabId) {
- $(this).find('.itp_tab_close').trigger('click');
- }
- }
- });
-
- $('#ITP_HEADER .itp_tab_list a[href="#ITP_TAB_'+tabId+'"]').trigger('click');
- }
- function itp_fn_open_tab(param) {
- const id = param.navId;
- const tabSize = $('#ITP_HEADER .itp_tab_list li').size();
- if (tabSize > 10) {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noMoreTab);
- return false;
- }
- let isDup = false;
- $('#ITP_HEADER .itp_tab_list li').each(function() {
- const tab_id = $(this).find('.itp_tab_close').attr('data-itp-tab-id');
- if (tab_id == id) {
- isDup = true;
- $('#ITP_HEADER .itp_tab_list li').removeClass('active');
- $('#ITP_CONTAINER .itp_contents .itp_sec').removeClass('active');
- $(this).addClass('active');
- $('#ITP_TAB_' + id).addClass('active');
- return false;
- }
- });
- if (!isDup) {
- const href = '/' + id;
- let text = $('#' + id + '_PAGE_NO').children('.itp_tt').text();
- if (param.titId !== null && param.titId !== undefined && param.titId != '') {
- text = $('#' + param.titId + '_PAGE_NO').children('.itp_tt').text();
- }
- const tab = '<li class="active"><a href="#ITP_TAB_' + id + '" role="tab" data-toggle="tab" class="itp_tab_open">' + text + ' <i class="glyphicon glyphicon-remove itp_tab_close" data-itp-tab-id="' + id + '"></i></a></li>';
- itp_fn_load_page(href, tab);
- } else {
- itp_fn_fire_window_resize();
- }
- return false;
- };
- function itp_fn_open_tab_self(param, fn) {
- const id = param.navId;
- const tabSize = $('#ITP_HEADER .itp_tab_list li').size();
- if (tabSize > 10) {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noMoreTab);
- return false;
- }
- let isDup = false;
- $('#ITP_HEADER .itp_tab_list li').each(function() {
- const tab_id = $(this).find('.itp_tab_close').attr('data-itp-tab-id');
- if (tab_id == id) {
- isDup = true;
- $('#ITP_HEADER .itp_tab_list li').removeClass('active');
- $('#ITP_CONTAINER .itp_contents .itp_sec').removeClass('active');
- $(this).addClass('active');
- $('#ITP_TAB_' + id).addClass('active');
- fn(param);
- return false;
- }
- });
- if (!isDup) {
- const href = '/' + id;
- const tab = '<li class="active"><a href="#ITP_TAB_' + id + '" role="tab" data-toggle="tab" class="itp_tab_open">' + param.menuTit + ' <i class="glyphicon glyphicon-remove itp_tab_close" data-itp-tab-id="' + id + '"></i></a></li>';
- const key = $.param(param);
- itp_fn_load_page(href, tab, key);
- } else {
- itp_fn_fire_window_resize();
- }
- return false;
- };
- function itp_fn_set_file_upload(wrap, folder, multi, thumb, screen, arg) {
- if (thumb) {
- multi = false;
- ITP_UPLOAD_DEFAULTS = {
- fileTypes: {
- images: ['bmp', 'tif', 'tiff', 'gif', 'jpeg', 'jpg', 'png', 'svg', 'ico', 'raw']
- }
- };
- }
- $('#' + wrap).bootstrapFileUpload({
- url: DOMAIN + '/api/file/upload',
- inputName: 'uploadFile',
- folderName: folder,
- fileNumber: arg.fileNo,
- fileInput: arg.fileId,
- fileTypes: ITP_UPLOAD_DEFAULTS.fileTypes,
- viewCode: arg.viewCd,
- formMethod: 'post',
- multiFile: multi,
- multiUpload: false,
- maxSize: 100,
- maxFiles: 5,
- showThumb: thumb,
- thumbWidth: 80,
- thumbHeight: 80,
- debug: true,
- screen_id: screen,
- showYn: arg.showYn,
- onFileAdded: function() {
- $.bootstrapFileUpload('uploadStart', wrap);
- },
- onInit: function() {
- $('#' + wrap).on('click', 'table.fileupload-download .filedownload-remove', function() {
- var trRow = $(this).closest('tr.fileupload-downloadrow');
- var tdData = trRow.children('td.itp_file_info');
- var pFileNo = tdData.attr('data-file-no');
- var pFileSeq = tdData.attr('data-file-seq');
- const param = {'fileNo': pFileNo, 'fileSeq': pFileSeq};
- $.ajax({
- contentType: 'application/json',
- url: DOMAIN + '/api/file/delete',
- data: JSON.stringify(param),
- type: 'DELETE',
- async: false,
- timeout: 10000,
- xhrFields: {
- withCredentials: true //Cross Domain 처리
- },
- beforeSend: function(xhr) {
- xhr.setRequestHeader('X-AUTH-TOKEN', CONN_KEY); //Jwt 토큰을 헤더에 담아서 보낸다.
- },
- success: function(result) {
- trRow.hide();
- trRow.remove();
- },
- error: function(xhr, status, error) {
- if (xhr.responseJSON !== undefined) { //실패시 서버에서 내려주는 메세지 얼럿
- itp_fn_modal_alert_ajax(xhr.responseJSON.message);
- if (xhr.status == 401) { //401에러가 떨어지면 로그인페이지로 이동
- sessionStorage.removeItem('itp_login_info'); //Jwt 키 제거
- $(location).attr('href', ITP_CONTEXTPATH + '/login.html');
- }
- } else {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- });
- });
- }
- });
- };
- function itp_fn_check_file_uploading(fileId) {
- let isUploading = false;
- const fileCount = $(fileId).find('table.fileupload-preview tbody.files tr.row').length;
- if (fileCount > 0) {isUploading = true;}
- return isUploading;
- };
- function itp_fn_check_file_validate(fileId) {
- let isValidate = false;
- const downCount = $(fileId).find('table.fileupload-download tbody tr.row').length;
- const fileCount = $(fileId).find('table.fileupload-preview tbody.files tr.row').length;
- if (downCount < 1) {
- if (fileCount < 1) {isValidate = true;}
- }
- return isValidate;
- };
- function itp_fn_upload_thumb(input, img, cont, fileNo, folder) {
- if ($(input).val() != '') {
- if ($(img).attr('data-thumb-yn') == 'Y') {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.upload.deleteFile);
- return;
- }
- const ext = $(input).val().split('.').pop().toLowerCase();
- if ($.inArray(ext, ['gif', 'jpg', 'jpeg', 'png']) == -1) {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.upload.fileType);
- $(input).val('');
- return;
- }
- let fileSize = input.files[0].size;
- fileSize = (fileSize / 1024) / 1024;
- const maxSize = 10;
- if (fileSize > maxSize) {
- itp_fn_modal_alert(maxSize + 'MB' + ITP_MSG_LOCALE.message.upload.fileSize);
- $(input).val('');
- return;
- }
- const hh = $(img).height();
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- reader.onload = function(e) {
- $(img).attr('src', e.target.result);
- };
- reader.readAsDataURL(input.files[0]);
- $(img).css('height', hh);
- }
- var formData = new FormData();
- formData.append('uploadFolder', folder);
- formData.append('fileNo', fileNo);
- formData.append('uploadFile', input.files[0], input.files[0].name);
- $.ajax({
- url: ITP_CONTEXTPATH + '/uploadFile',
- type: 'post',
- data: formData,
- enctype: 'multipart/form-data',
- cache: false,
- contentType: false,
- processData: false,
- success: function(result) {
- if (result.resultCd == 'E') {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- $(img).attr('src', ITP_CONTEXTPATH + '/images/noImg.png');
- $(img).attr('data-thumb-yn', 'N');
- } else {
- $(img).attr('data-file-nm', result.resultData.FILE[0].fileNm);
- $(img).attr('data-thumb-yn', 'Y');
- }
- },
- error: function(xhr, status, error) {
- if(xhr.status == 401) location.reload();
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- });
- }
- };
- function itp_fn_delete_thumb(img, input, fileNo) {
- var fileNm = $(img).attr('data-file-nm');
- const param = {'fileNo': fileNo, 'fileNm': fileNm};
- if ($(img).attr('data-thumb-yn') == 'N') {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.upload.fileNeed);
- return;
- }
- $.ajax({
- contentType: 'application/json',
- url: ITP_CONTEXTPATH + '/deleteFileByNm',
- data: JSON.stringify(param),
- type: 'POST',
- dataType: 'json',
- async: false,
- timeout: 10000,
- success: function(result) {
- if (result.resultCd == 'E') {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- } else {
- $(img).attr('src', ITP_CONTEXTPATH + '/images/noImg.png');
- $(img).attr('data-thumb-yn', 'N');
- $(input).val('');
- }
- },
- error: function(xhr, status, error) {
- if(xhr.status == 401) location.reload();
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- });
- };
- function itp_fn_thumb_validate(img, inline) {
- var error = function(msg) {
- $ele = $(img).closest('.itp_thumb_area');
- $ele.closest('.form-group').addClass('has-error');
- var error_msg = $('<span class="help-block">' + msg + '</span>');
- if (inline == 'inline') {
- $ele.append(error_msg);
- } else {
- error_msg.insertAfter($ele);
- }
- };
- if ($(img).attr('data-thumb-yn') == 'N') {
- error(ITP_MSG_LOCALE.message.upload.fileNeed);
- return;
- }
- return true;
- };
- function itp_fn_get_image_thumbnail(id, w, h) {
- let fileInfo = document.getElementById(id).files[0];
- let reader = new FileReader();
- reader.onload = function() {
- document.getElementById(id + '_IMG').src = reader.result;
- };
- if (fileInfo) {
- if(!/\.(jpg|jpeg)$/i.test(fileInfo.name)) {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.form.onlyImage);
- return;
- }
- var _URL = window.URL || window.webkitURL;
- var img = new Image();
- img.src = _URL.createObjectURL(fileInfo);
- img.onload = function() {
- //console.log(img.width + ' ' + img.height);
- if (img.width != w || img.height != h) {
- //itp_fn_modal_alert(ITP_MSG_LOCALE.message.form.noImageSize);
- //return;
- }
- reader.readAsDataURL(fileInfo);
- }
- }
- };
- function itp_fn_get_category_thumbnail(id, w, h) {
- let fileInfo = document.getElementById(id).files[0];
- let reader = new FileReader();
- reader.onload = function() {
- document.getElementById(id + '_IMG').src = reader.result;
- };
- if (fileInfo) {
- if(!/\.(jpg|jpeg|png)$/i.test(fileInfo.name)) {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.form.onlyImage2);
- return;
- }
- var _URL = window.URL || window.webkitURL;
- var img = new Image();
- img.src = _URL.createObjectURL(fileInfo);
- img.onload = function() {
- //console.log(img.width + ' ' + img.height);
- if (img.width != w || img.height != h) {
- //itp_fn_modal_alert(ITP_MSG_LOCALE.message.form.noImageSize);
- //return;
- }
- reader.readAsDataURL(fileInfo);
- }
- }
- };
- function itp_fn_get_image_intro(obj, w, h) {
- let isLoad = true;
- let fileInfo = obj.files[0];
- let reader = new FileReader();
- reader.onload = function() {
- $(obj).closest('li').find('.itp_img_img').attr('src', reader.result);
- };
- if (fileInfo) {
- if(!/\.(jpg|jpeg)$/i.test(fileInfo.name)) {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.form.onlyImage);
- isLoad = false;
- return;
- }
- var _URL = window.URL || window.webkitURL;
- var img = new Image();
- img.src = _URL.createObjectURL(fileInfo);
- img.onload = function() {
- //console.log(img.width + ' ' + img.height);
- if (img.width != w || img.height != h) {
- //itp_fn_modal_alert(ITP_MSG_LOCALE.message.form.noImageSize);
- //isLoad = false;
- //return;
- }
- reader.readAsDataURL(fileInfo);
- }
- }
- return isLoad;
- };
- function itp_fn_set_upload_file(id) {
- let fileInfo = document.getElementById(id).files[0];
- $('#' + id + '_NM').html(fileInfo.name).show();
- };
- function itp_fn_set_smart_editor(oEditors, sLang, textarea) {
- if (sLang == 'en') {
- sLang = sLang + '_US';
- } else {
- sLang = sLang + '_KR';
- }
- const aAdditionalFontSet = [['MS UI Gothic', 'MS UI Gothic'], ['Comic Sans MS', 'Comic Sans MS']];
- nhn.husky.EZCreator.createInIFrame({
- oAppRef: oEditors,
- elPlaceHolder: textarea,
- sSkinURI: ITP_CONTEXTPATH + '/se2/SmartEditor2Skin_' + sLang + '.html',
- htParams: {
- bUseToolbar: true,
- bUseVerticalResizer: false,
- bUseModeChanger: true,
- bSkipXssFilter: true,
- aAdditionalFontList: aAdditionalFontSet,
- fOnBeforeUnload: function() {
- },
- I18N_LOCALE: sLang
- },
- fOnAppLoad: function() {
- var sDefaultFont = 'Times New Roman';
- var nFontSize = 10;
- oEditors.getById[textarea].setDefaultFont(sDefaultFont, nFontSize);
- },
- fCreator: 'createSEditor2'
- });
- };
- function itp_fn_search_tabs_detail(tabs, wrap) {
- $(wrap).on('click', tabs + ' li a', function() {
- const href = $(this).attr('href');
- itp_fn_load_tabs(wrap, href);
- return false;
- });
- };
- // [수발주 추가]
- function itp_fn_grid_make_remote(option) {
- var options = $.extend({
- multiselect: false,
- rownumbers: true,
- loadBeforeSend: function(jqXHR) {
- jqXHR.setRequestHeader('X-AUTH-TOKEN', CONN_KEY);
- },
- loadError: function(jqXHR, textStatus, errorThrown) {
- itp_fn_grid_load_error(jqXHR, textStatus, errorThrown);
- }
- }, option);
- $(options.gridId).jqGrid({
- colModel: options.colModel,
- postData: options.param,
- url: options.url,
- pager: options.pager,
- multiselect: options.multiselect,
- rownumbers: options.rownumbers,
- loadBeforeSend: options.loadBeforeSend,
- onCellSelect: options.onCellSelect,
- loadComplete: options.loadComplete,
- loadError: options.loadError,
- onPaging: function(action) {
- itp_fn_grid_paging(options.gridId, action, options.param);
- }
- }).navGrid(options.pager, ITP_GRID_NAV_DEFAULTS.navGrid);
- }
- function itp_fn_grid_make_local(option) {
- var options = $.extend({
- multiselect: false,
- rownumbers: true
- }, option);
- $(option.gridId).jqGrid({
- colModel: options.colModel,
- data: options.data,
- datatype: 'local',
- pager: options.pager
- }).navGrid(options.pager, ITP_GRID_NAV_DEFAULTS.navGrid);
- }
- function itp_fn_grid_paging(grid_id, action, args) {
- var gridOption = $(grid_id).jqGrid('getGridParam');
- const suffix = gridOption.pager;
- let currentPage = gridOption.page;
- const lastPage = gridOption.lastpage;
- const userPage = $(suffix).find('.ui-pg-input').val();
- if (action == 'next') {
- if (currentPage < lastPage) {
- currentPage += 1;
- }
- } else if (action == 'prev') {
- if (currentPage > 0 && currentPage != 1) {
- currentPage -= 1;
- }
- } else if (action == 'first') {
- currentPage = 1;
- } else if (action == 'last') {
- currentPage = lastPage;
- } else if (action == 'user') {
- if (userPage > lastPage || userPage < 1) {
- return 'stop';
- } else {
- currentPage = userPage;
- }
- }
- args.gridPage = currentPage;
- $(grid_id).setGridParam({
- postData : JSON.stringify(args)
- });
- };
- function itp_fn_grid_sorting(grid_id, index, sortOrder, args) {
- args.sidx = index;
- args.sord = sortOrder;
- $(grid_id).setGridParam({
- postData : JSON.stringify(args)
- });
- };
- function itp_fn_grid_load_complete(data, gridId, paging, rn, menuId, isSrh, emptyFn, isView, totCnt, totPage, emptyMsg, helpMsg, excelDownloadId, excelUploadId) {
- if (data.resultCd == 'E') {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.ajax.failData);
- } else {
- const rowCnt = $(gridId).jqGrid('getGridParam', 'records');
- const shrinkToFit = $(gridId).getGridParam('shrinkToFit');
- const gridNm = gridId.slice(1);
- if (emptyMsg === null || emptyMsg === undefined) {
- emptyMsg = ITP_MSG_LOCALE.message.grid.noData;
- }
- if (isSrh) {
- emptyMsg = ITP_MSG_LOCALE.message.grid.noSrh;
- $('#ITP_' + menuId + '_jqGridEmpty').addClass('itp_noSrh');
- } else {
- $('#ITP_' + menuId + '_jqGridEmpty').removeClass('itp_noSrh');
- }
- if (rowCnt == 0) {
- $(gridId + '_list').find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $('#ITP_' + menuId + '_jqGridEmpty').html(emptyMsg);
- $('#ITP_' + menuId + '_jqGridEmpty').show();
- } else {
- $(gridId + '_list').find('.ui-jqgrid-bdiv').css('min-height', 'auto');
- $('#ITP_' + menuId + '_jqGridEmpty').hide();
- if (isSrh) {emptyFn.push();}
- }
- if (shrinkToFit) {
- $(gridId + '_list').find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
- } else {
- $(gridId + '_list').find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'auto');
- }
- if (paging) {
- $(gridId + 'Pager_center').show();
- if (!totPage) {
- $(gridId + 'Pager_right').css('visibility', 'hidden');
- }
- } else {
- $(gridId + 'Pager_center').hide();
- $(gridId + 'Pager_right').hide();
- }
- if (rn == 'number') {$('#jqgh_' + gridNm + '_rn').text(ITP_MSG_LOCALE.label.numbering);}
- if (rn == 'order') {$('#jqgh_' + gridNm + '_rn').text(ITP_MSG_LOCALE.label.ordering);}
- if (rn == 'rank') {$('#jqgh_' + gridNm + '_rn').text(ITP_MSG_LOCALE.label.ranking);}
- if (isView) {
- let viewHtml = '';
- viewHtml += '<span class="itp_shrv fix">';
- viewHtml += '<span class="shrv_txt"><b>' + ITP_MSG_LOCALE.label.srhResult + '</b></span>';
- viewHtml += '<span class="shrv_num">(<em>' + rowCnt + '</em>)</span>';
- viewHtml += '<span class="shrv_bar">|</span>';
- viewHtml += '<span class="shrv_txt">' + ITP_MSG_LOCALE.label.total + '</span>';
- viewHtml += '<span class="shrv_num shrv_tot">(<em>' + totCnt + '</em>)</span>';
-
- if (helpMsg !== null && helpMsg !== undefined && helpMsg != '') {
- viewHtml += '<span class="shrv_help">' + helpMsg + '</span>';
- }
- viewHtml += '</span>';
-
- if (excelDownloadId !== null && excelDownloadId !== undefined && excelDownloadId != '') {
- viewHtml += '<span class="itp_shrx fix">';
- viewHtml += '<span class="shrx_txt" id="'+excelDownloadId+'"><b>엑셀 다운로드</b></span>';
- if (excelUploadId !== null && excelUploadId !== undefined && excelUploadId != '') {
- viewHtml += '<span class="shrx_bar">|</span>';
- viewHtml += '<span class="shrx_txt" id="'+excelUploadId+'"><b>엑셀 일괄저장</b></span>';
- }
- viewHtml += '</span>';
- }
-
- $('#ITP_' + menuId + '_jqGridView').html(viewHtml).show();
- }
- $(gridId).on('focus', 'td[role="gridcell"] .editable', function() {
- $(this).closest('tr[editable="1"] td').trigger('click');
- });
- }
- };
- function itp_fn_grid_file_select(menuId, fileSelectId, helpMsg) {
-
- let viewHtml = '';
- viewHtml += '<span class="itp_shrv fix">';
- if (helpMsg !== null && helpMsg !== undefined && helpMsg != '') {
- viewHtml += '<span class="shrv_help">' + helpMsg + '</span>';
- }
- viewHtml += '</span>';
-
- if (fileSelectId !== null && fileSelectId !== undefined && fileSelectId != '') {
- viewHtml += '<span class="itp_shrx fix">';
- viewHtml += '<input id="'+fileSelectId+'_FILE" type="file" style="display:none;" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">';
- viewHtml += '<span class="shrx_txt" id="'+fileSelectId+'"><b>파일 선택</b></span>';
- viewHtml += '</span>';
- }
-
- $('#ITP_' + menuId + '_jqGridView').html(viewHtml).show();
-
- };
- function itp_fn_grid_load_error(jqXHR, textStatus, errorThrown) {
- // console.log(JSON.stringify(jqXHR));
-
- if (jqXHR.status == 401) location.href = ITP_CONTEXTPATH + '/';
- if(jqXHR.responseJSON.message) {
- itp_fn_modal_alert(jqXHR.responseJSON.message);
- } else {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.ajax.failData);
- }
- };
- function itp_fn_grid_validate_row(gridId, msg) {
- const rids = $(gridId).jqGrid('getDataIDs');
- for (var idx in rids) {
- $(gridId).jqGrid('saveRow', rids[idx]);
- }
- var inputs = $(gridId).find('tr[editable="1"]');
- if (inputs.length > 0) return false;
- let isValidate = true;
- $(gridId).find('tr[editable="0"]').children('td[role="gridcell"]').find('.editable').each(function() {
- if ($(this).val() == '') {
- $(this).closest('tr[editable="0"] td').trigger('click');
- isValidate = false;
- return false;
- }
- });
- if (!isValidate) {return false;}
- var rows = $(gridId).find('tr.jqgrow[role="row"]:visible');
- if (rids.length == 0 || rows.length < 1) {
- if (msg == undefined || typeof msg == 'undefined') {
- itp_fn_modal_alert(ITP_MSG_LOCALE.message.ajax.noData);
- } else {
- itp_fn_modal_alert(msg);
- }
- return false;
- }
- return true;
- };
- function itp_fn_set_data_editable(rowId, cellIdx, lastrowid, gridId, cm, addRow) {
- if (true == true && cellIdx == 0) return;
- if (rowId) {
- const viewCd = $(gridId).jqGrid('getRowData', rowId).viewCd;
- if (viewCd == 'R') {
- $(gridId).jqGrid('setCell', rowId, 'viewCd', 'U');
- }
- if (lastrowid && rowId != lastrowid) {
- $(gridId).jqGrid('saveRow', lastrowid);
- }
- if (cm !== undefined || typeof cm !== 'undefined') {
- if (cm !== null) {
- let edittype = true;
- if (addRow) {
- edittype = false;
- } else {
- if (viewCd == 'C') {edittype = true;} else {edittype = false;}
- }
- const cols = $(gridId).jqGrid('getGridParam', 'colModel');
- for (var i=0; i<cols.length; i++) {
- for (var j=0; j<cm.length; j++) {
- if (cols[i].name == cm[j]) {
- $(gridId).jqGrid('setColProp', cols[i].name, {editable: edittype});
- }
- }
- }
- }
- }
- $(gridId).jqGrid('editRow', rowId, true);
- lastrowid = rowId;
- }
- return lastrowid;
- };
- function itp_fn_set_all_row_editable(gridId) {
- var ids = $(gridId).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(gridId).jqGrid('editRow', rowId, true);
- });
- var i, count, $grid = $(gridId);
- var rowArray = $(gridId).jqGrid('getDataIDs');
- for (i = 0, count = rowArray.length; i < count; i += 1) {
- $grid.jqGrid('setSelection', rowArray[i], false);
- }
- $(gridId).find('tr[editable="1"]').children('td[role="gridcell"]').find('.editable').each(function() {
- $(this).css({
- 'border': '1px solid #ccc',
- '-webkit-box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)',
- 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075)'
- });
- });
- };
- function itp_fn_set_row_editable(gridId, rowId) {
- $(gridId).jqGrid('editRow', rowId, true);
- };
- function itp_fn_grid_save_rows(gridId) {
- var rids = $(gridId).jqGrid('getDataIDs');
- for(var idx in rids) {
- $(gridId).jqGrid('saveRow', rids[idx]);
- }
- $(gridId).find('tr[editable="0"]').children('td[role="gridcell"]').find('.editable').each(function() {
- if ($(this).val() == '') {
- $(this).closest('tr[editable="0"] td').trigger('click');
- return false;
- }
- });
- };
- function itp_fn_grid_reset_selection(e, lastrowid, gridId, menuId) {
- if (lastrowid != '' && typeof lastrowid != 'undefined') {
- if (e.target.id == 'cb_' + gridId) return;
- if (e.target.id == 'ITP_BTN_' + menuId + '_ADDROW') return;
- if (e.target.id == 'ITP_BTN_' + menuId + '_DELROW') return;
- if ($(e.target).closest('#' + gridId).length == 0) {
- var rids = $('#' + gridId).jqGrid('getDataIDs');
- for(var idx in rids) {
- $('#' + gridId).jqGrid('saveRow', rids[idx]);
- }
- //$('#' + gridId).jqGrid('saveRow', lastrowid);
- $('#' + gridId).find('tr[editable="0"]').children('td[role="gridcell"]').find('.editable').each(function() {
- if ($(this).val() == '') {
- $(this).closest('tr[editable="0"] td').trigger('click');
- return false;
- }
- });
- $('#' + gridId).resetSelection();
- }
- }
- };
- function itp_fn_grid_add_row(gridId, fn, cm, menuId) {
- if (cm !== undefined || typeof cm !== 'undefined') {
- if (cm !== null) {
- const cols = $(gridId).jqGrid('getGridParam', 'colModel');
- for (var i=0; i<cols.length; i++) {
- for (var j=0; j<cm.length; j++) {
- if (cols[i].name == cm[j]) {
- $(gridId).jqGrid('setColProp', cols[i].name, {editable: true});
- }
- }
- }
- }
- }
- $(gridId + '_list').find('.ui-jqgrid-bdiv').css('min-height', 'auto');
- $('#ITP_' + menuId + '_jqGridEmpty').hide();
- $(gridId).jqGrid('addRow', {position: 'last'});
- var rids = $(gridId).jqGrid('getDataIDs');
- var last_row_id = rids[rids.length - 1];
- $(gridId).jqGrid('setCell', last_row_id, 'viewCd', 'C');
- if (fn !== undefined || typeof fn !== 'undefined') {
- fn(last_row_id, rids.length);
- }
- return last_row_id;
- };
- function itp_fn_add_grid_row(gridId, fn, cm, menuId) {
- if (cm !== undefined || typeof cm !== 'undefined') {
- if (cm !== null) {
- const cols = $(gridId).jqGrid('getGridParam', 'colModel');
- for (var i=0; i<cols.length; i++) {
- for (var j=0; j<cm.length; j++) {
- if (cols[i].name == cm[j]) {
- $(gridId).jqGrid('setColProp', cols[i].name, {editable: false});
- }
- }
- }
- }
- }
- $(gridId + '_list').find('.ui-jqgrid-bdiv').css('min-height', 'auto');
- $('#ITP_' + menuId + '_jqGridEmpty').hide();
- $(gridId).jqGrid('addRow', {position: 'last'});
- var rids = $(gridId).jqGrid('getDataIDs');
- var last_row_id = rids[rids.length - 1];
- $(gridId).jqGrid('setCell', last_row_id, 'viewCd', 'C');
- if (fn !== undefined || typeof fn !== 'undefined') {
- fn(last_row_id, rids.length);
- }
- return last_row_id;
- };
- function itp_fn_grid_del_row(gridId) {
- const rowKey = $(gridId).getGridParam('selrow');
- if (!rowKey) {
- return;
- }
- var selectedIds = $(gridId).getGridParam('selarrrow');
- for (var i=selectedIds.length-1; i>=0; i--) {
- if ($(gridId).jqGrid('getRowData', selectedIds[i]).viewCd == 'C') {
- $(gridId).delRowData(selectedIds[i]);
- } else {
- $(gridId).jqGrid('saveRow', selectedIds[i]);
- $(gridId).jqGrid('setCell', selectedIds[i], 'viewCd', 'D');
- $(gridId).find('tr#' + selectedIds[i]).css('display', 'none');
- }
- }
- };
- function itp_fn_grid_tree_select(gridList, gridId) {
- $(gridList).on('click', 'input[name=chk]', function() {
- if ($(this).is(':checked')) {
- $(this).parent('td[role="gridcell"]').trigger('click');
- } else {
- $(gridId).jqGrid('resetSelection');
- }
- $(gridList).find('input[name=chk]').not($(this)).prop('checked', false);
- });
- };
- function itp_fn_grid_tree_select_row(gridList, rowId) {
- var checkbox = $(gridList).find('tr[role="row"]#' + rowId).find('input[name=chk]');
- checkbox.prop('checked', true);
- $(gridList).find('input[name=chk]').not(checkbox).prop('checked', false);
- };
- function itp_fn_check_grid_is_writing(gridId) {
- const rowData = $(gridId).getRowData();
- let isWriting = false;
- $.each(rowData, function(key, value) {
- if (value.viewCd != 'R') {
- isWriting = true;
- return;
- }
- });
- return isWriting;
- };
- function itp_fn_jqgrid_resize(grid_id, parent_id, size) {
- $(window).on('resize', function(e) {
- //window.resizeEvt;
- //clearTimeout(window.resizeEvt);
- window.resizeEvt = setTimeout(function() {
- $(grid_id).setGridWidth(782);
- var outerwidth = $(parent_id).width();
- if ($(window).width() < 1301 && size == 'sm') {
- outerwidth = 782;
- }
- $(grid_id).setGridWidth(outerwidth);
- }, 250);
- });
- };
- function itp_fn_make_set_combine(gridId, label, width, cols, hideCols) {
- $(gridId).jqGrid('setLabel', cols, label, '', {
- style: 'width:' + width + 'px;',
- colspan: '2'
- });
- $(gridId).jqGrid('setLabel', hideCols, '', '', {style: 'display:none;'});
- };
- function itp_fn_make_set_search(gridId, label, width, cols) {
- $(gridId).jqGrid('setLabel', cols, label, '', {
- style: 'width:' + width + 'px;',
- colspan: '2'
- });
- $(gridId).jqGrid('setLabel', cols + 'Img', '', '', {style: 'display:none;'});
- };
- function itp_fn_make_btn_search(cellvalue, options, rowObject) {
- var str = '<button class="btn btn-default btn-sm itp_btn" type="button"><i class="glyphicon glyphicon-search"></i></button>';
- return str;
- };
- function itp_fn_make_checkbox(cellvalue, options, rowObject) {
- var str = '<input type="checkbox" name="chk">';
- return str;
- };
- function itp_fn_add_excel_btn(gridId, pagerId, fileNm, href, $params) {
- $(gridId).navButtonAdd(pagerId, {
- buttonicon: 'glyphicon glyphicon-download-alt',
- title: ITP_MSG_LOCALE.button.excelDown,
- caption: '',
- position: 'last',
- onClickButton: function() {
- let params = $params.serializeObject();
- let colsNm = [], colsLb = [], colsWd = [], colsAg = [];
- const cols = $(gridId).jqGrid('getGridParam', 'colModel');
- for (var i=0; i<cols.length; i++) {
- if (cols[i].hidden == false && cols[i].name != 'rn') {
- //console.log('colsNm==>>' + colsNm);
- colsNm.push(cols[i].name);
- colsLb.push(cols[i].label);
- colsWd.push(cols[i].width);
- colsAg.push(cols[i].align);
- }
- }
- params.excelNm = fileNm;
- params.pagingYn = false;
- let inputs = '';
- const data = $.param(params);
- $.each(data.split('&'), function() {
- var pair = this.split('=');
- inputs += '<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />';
- });
- inputs += '<input type="hidden" name="colsNm" value="' + colsNm + '" />';
- inputs += '<input type="hidden" name="colsLb" value="' + colsLb + '" />';
- inputs += '<input type="hidden" name="colsWd" value="' + colsWd + '" />';
- inputs += '<input type="hidden" name="colsAg" value="' + colsAg + '" />';
- //console.log(inputs); return;
- $('<form action="' + href + '" method="post">' + inputs + '</form>')
- .appendTo('body').submit().remove();
- }
- });
- };
- function itp_fn_download_excel(fileNm, href, $params) {
- let params = $params.serializeObject();
- params.excelNm = fileNm;
- params.pagingYn = false;
- let inputs = '';
- const data = $.param(params);
- $.each(data.split('&'), function() {
- var pair = this.split('=');
- inputs += '<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />';
- });
- //console.log(inputs); return;
- $('<form action="' + href + '" method="post">' + inputs + '</form>')
- .appendTo('body').submit().remove();
- };
- function itp_fn_grid_make_cell_link(gridId, cells, text, css) {
- var ids = $(gridId).jqGrid('getDataIDs');
- var gridData = $(gridId).jqGrid('getRowData');
- for (var i=0; i < gridData.length; i++) {
- for (var j=0; j < cells.length; j++) {
- $(gridId).jqGrid('setCell', ids[i], cells[j], text, css);
- }
- }
- };
- function itp_fn_grid_save_row(gridId) {
- var rids = $(gridId).jqGrid('getDataIDs');
- for (var idx in rids) {
- $(gridId).jqGrid('saveRow', rids[idx]);
- }
- };
- function itp_fn_fire_window_resize() {
- var evt = document.createEvent('HTMLEvents');
- evt.initEvent('resize', true, false);
- window.dispatchEvent(evt);
- };
- function itp_fn_make_select(options, select_id) {
- $(select_id).empty();
- $('<option/>', {'value': '', 'text': ITP_MSG_LOCALE.label.selected}).prependTo(select_id);
- $.each(options, function(key, value) {
- $('<option/>', {
- 'value': this.codeCd,
- 'text': this.codeNm
- }).appendTo(select_id);
- });
- };
- String.prototype.rPad = function (n, c) {
- var i; var a = this.split('');
- for (i = 0; i < n - this.length; i++) {a.push (c);};
- return a.join('');
- };
- var StringBuffer = function(){
- this.buffer = new Array();
- }
- StringBuffer.prototype.append = function(obj){
- this.buffer.push(obj);
- }
- StringBuffer.prototype.toString = function(){
- return this.buffer.join("");
- }
- function itp_fn_number_comma(str, dec) {
- var roundXL = function(n, digits) {
- if (digits >= 0) return parseFloat(n.toFixed(digits));
- digits = Math.pow(10, digits);
- var t = Math.round(n * digits) / digits;
- return parseFloat(t.toFixed(0));
- };
- var nStr = (str == undefined || str == 'null' ? '' : str) + '';
- var nDec = (dec == undefined ? -1 : dec);
- if (nStr == '') return nStr;
- nStr = nStr.replace(/,/g, '');
- var x = (nDec === -1 ? nStr : roundXL(Number(nStr), nDec) + '').split('.'),
- x1 = x[0].replace(/,/g, ''),
- x2 = x.length > 1 ? '.' + x[1] : '',
- rgx = /(\d+)(\d{3})/;
- while (rgx.test(x1)) x1 = x1.replace(rgx, '$1' + ',' + '$2');
- if (nDec > 0) {
- if (x2 =='') x2 = '.' + x2.rPad(nDec, '0');
- else x2 = x2.rPad(nDec + 1, '0');
- } else if (nDec == 0) x2 = '';
- return x1 + x2;
- };
- function itp_fn_currency_fmatter(cellvalue, options, rowObject) {
- const currCd = rowObject[options.colModel.formatoptions.currCd];
- let dec = 0;
- if (currCd !== undefined && typeof currCd !== 'undefined') {
- if (currCd == 'USD') {
- dec = 2;
- }
- }
- return itp_fn_number_comma(cellvalue, dec);
- };
- function itp_fn_currency_fmatter_pop(currCd) {
- let dec = 2;
- if (currCd == 'USD') {
- dec = 2;
- }
- return {formatter: 'number', formatoptions: {decimalPlaces: dec}};
- };
- function itp_fn_currency_unfmatter(cellvalue, options, cell) {
- var value = cellvalue.replace(/,/gi, '');
- return value;
- };
- function itp_fn_time_fmatter(cellvalue, options, rowObject) {
- let time = '';
- if (cellvalue !== undefined && typeof cellvalue !== 'undefined') {
- if (cellvalue.length == 4) {
- const hh = cellvalue.substring(0, 2);
- const mm = cellvalue.substring(2, 4);
- time = hh + ':' + mm;
- }
- }
- return time;
- };
- function itp_fn_time_unfmatter(cellvalue, options, cell) {
- var value = cellvalue.replace(/:/gi, '');
- return value;
- };
- function itp_fn_modal_alert(msg) {
- $('#ITP_MODAL_ALERT_CANCEL').hide();
- $('#ITP_MODAL_ALERT').modal('show');
- $('#ITP_MODAL_ALERT').find('.itp_alert_txt').html(msg);
- $('#ITP_MODAL_ALERT_CONFIRM').off('click');
- $('#ITP_MODAL_ALERT_CONFIRM').on('click', function() {
- $('#ITP_MODAL_ALERT').modal('hide');
- });
- };
- function itp_fn_modal_alert_ajax(msg) {
- $('#ITP_MODAL_ALERT_AJAX').modal('show');
- $('#ITP_MODAL_ALERT_AJAX').find('.itp_alert_txt').html(msg);
- $('#ITP_MODAL_ALERT_AJAX_CONFIRM').off('click');
- $('#ITP_MODAL_ALERT_AJAX_CONFIRM').on('click', function() {
- $('#ITP_MODAL_ALERT_AJAX').modal('hide');
- });
- };
- function itp_fn_modal_duplicate(label, input) {
- let msg = ITP_MSG_LOCALE.message.form.duplicate;
- msg = msg.replace('{0}', label);
- $('#ITP_MODAL_ALERT_CANCEL').hide();
- $('#ITP_MODAL_ALERT').modal('show');
- $('#ITP_MODAL_ALERT').find('.itp_alert_txt').html(msg);
- $('#ITP_MODAL_ALERT_CONFIRM').off('click');
- $('#ITP_MODAL_ALERT_CONFIRM').on('click', function() {
- $('#ITP_MODAL_ALERT').modal('hide');
- if (input != null) {
- $(input).focus();
- }
- });
- };
- function itp_fn_modal_confirm(msg, fn, args) {
- $('#ITP_MODAL_ALERT_CANCEL').show();
- $('#ITP_MODAL_ALERT').modal('show');
- $('#ITP_MODAL_ALERT').find('.itp_alert_txt').html(msg);
- if (fn !== undefined || typeof fn !== 'undefined') {
- $('#ITP_MODAL_ALERT_CONFIRM').off('click');
- $('#ITP_MODAL_ALERT_CONFIRM').on('click', function() {
- fn.callBack(args);
- $('#ITP_MODAL_ALERT').modal('hide');
- });
- }
- };
- function itp_fn_form_clear_validate(modal, form) {
- $(form).find('.itp_ip').removeClass('has-error');
- $(form).find('.help-block').remove();
- if (modal != null) {
- $(modal).on('hidden.bs.modal', function() {
- $(form).find('.itp_ip').removeClass('has-error');
- $(form).find('.help-block').remove();
- });
- }
- };
- function itp_fn_chnage_number_form(formId) {
- $(formId).find('input.numberOnly').number(true);
- $(formId).find('input.distanceOnly').number(true, 1);
- $(formId).find('input.priceOnly').number(true, 2);
- $(formId).find('input.unitOnly').number(true, 3);
- };
- function itp_fn_form_validate(form, element, arry, msg, type) {
- var error = function(txt) {
- if (type != 'ONLYCHK') {
- if (msg == undefined || typeof msg == 'undefined') {
- msg = txt;
- }
- $(element).closest('.itp_ip').addClass('has-error');
- var error_msg = $('<span class="help-block">' + msg + '</span>');
- if($(element).parent('.input-group').length) {
- error_msg.insertAfter($(element).parent());
- } else {
- error_msg.insertAfter($(element));
- }
- }
- };
- if ($.inArray('empty', arry) > -1) {
- if ($(element).val() == '' || $(element).val() < 1) {
- error(ITP_MSG_LOCALE.message.form.mandatory);
- return false;
- }
- }
- if ($.inArray('emptyNum', arry) > -1) {
- if ($(element).val() == '' || $(element).val() < 0) {
- error(ITP_MSG_LOCALE.message.form.mandatory);
- return false;
- }
- }
- if ($.inArray('number', arry) > -1) {
- const regExp = /^[0-9]+$/;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.onlynumber);
- return false;
- }
- }
- if ($.inArray('float', arry) > -1) {
- if($(element).val() == '') return true;
- const regExp = /^\d+.?\d?\d?\d?$/;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.onlynumber);
- return false;
- }
- }
- if ($.inArray('tel', arry) > -1) {
- const regExp = /^\d{2,3}-\d{3,4}-\d{4}$/;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.wrongtelnumber);
- return false;
- }
- }
- if ($.inArray('email', arry) > -1) {
- const regExp = /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.wrongemail);
- return false;
- }
- }
- if ($.inArray('id', arry) > -1) {
- const regExp = /^[a-z]+[a-z0-9]{4,11}$/g;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.wronguserid);
- return false;
- }
- }
- if ($.inArray('id2', arry) > -1) {
- const regExp = /^[A-Za-z0-9+]*$/;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.wronguserid2);
- return false;
- }
- }
- if ($.inArray('password', arry) > -1) {
- const regExp = /^(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9])(?=.*[0-9]).{8,16}$/;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.wrongpassword);
- return false;
- }
- }
- if ($.inArray('url', arry) > -1) {
- const regExp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
- if (!regExp.test($(element).val())) {
- error(ITP_MSG_LOCALE.message.form.wronglink);
- return false;
- }
- }
- return true;
- };
- function itp_fn_set_only_number_form(input) {
- $(input).val($(input).val().replace(/[^0-9]/g, ''));
- };
- function itp_fn_set_telephone_form(input) {
- $(input).val($(input).val().replace(/[^0-9]/g, '').replace(/(^02|^0505|^1[0-9]{3}|^0[0-9]{2})([0-9]+)?([0-9]{4})/, '$1-$2-$3').replace('--', '-'));
- };
- function itp_fn_set_business_reg_form(input) {
- let companyNum = $(input).val();
- companyNum = companyNum.replace(/[^0-9]/g, '');
- var tempNum = '';
- if (companyNum.length < 4) {
- tempNum = companyNum;
- } else if (companyNum.length < 6) {
- tempNum += companyNum.substr(0,3);
- tempNum += '-';
- tempNum += companyNum.substr(3,2);
- } else if (companyNum.length < 11) {
- tempNum += companyNum.substr(0,3);
- tempNum += '-';
- tempNum += companyNum.substr(3,2);
- tempNum += '-';
- tempNum += companyNum.substr(5);
- } else {
- tempNum += companyNum.substr(0,3);
- tempNum += '-';
- tempNum += companyNum.substr(3,2);
- tempNum += '-';
- tempNum += companyNum.substr(5);
- }
- $(input).val(tempNum);
- };
- function itp_fn_set_comma(str) {
- str = String(str);
- return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
- };
- function itp_fn_set_uncomma(str) {
- str = String(str);
- return str.replace(/[^\d]+/g, '');
- };
- function itp_fn_set_plus_minus(num) {
- var str = '';
- if (num > -1) {
- str = '+ ' + itp_fn_set_comma(itp_fn_set_uncomma(num));
- } else {
- str = '- ' + itp_fn_set_comma(itp_fn_set_uncomma(Math.abs(num)));
- }
- return str;
- };
- function itp_fn_load_page(href, tab, param, id) {
- //console.log('[ITP_FN_LOAD_PAGE] href = ' + href + ', tab = ' + tab);
- //로그인체크
- itp_fn_logined_check();
- $.ajax({
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- url: href,
- data: param,
- type: 'POST',
- dataType: 'html',
- async: false,
- timeout: 10000,
- beforeSend: function() {
- //$('#ITP_OVERLAY').show();
- },
- complete: function() {
- //$('#ITP_OVERLAY').hide();
- //$('#ITP_SIDEBAR').removeClass('itp_open_nav');srhResult
- },
- success: function(html) {
- $('#ITP_HEADER .itp_tab_list li').removeClass('active');
- $('#ITP_HEADER .itp_tab_list').append(tab);
- $('#ITP_CONTAINER .itp_contents .itp_sec').removeClass('active');
- $('#ITP_CONTAINER .itp_contents').append(html);
- //$('#ITP_SIDEBAR').removeClass('itp_open_nav');
- //JS파일적용
- const js = "<script src=\"./js/app/"+id.substring(0, id.length - 5).toLowerCase()+"/ITP_"+id+".js?version="+js_version+"\"></script>";
- $('#ITP_CONTAINER .itp_contents #ITP_TAB_'+id+' #ITP_TAP_JS').append(js);
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failPage);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failPage);
- }
- });
- };
- function itp_fn_load_tabs(wrap, href) {
- $.ajax({
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- url: href,
- type: 'POST',
- dataType: 'html',
- async: false,
- timeout: 10000,
- beforeSend: function() {
- //$('#ITP_OVERLAY').show();
- },
- complete: function() {
- //$('#ITP_OVERLAY').hide();
- },
- success: function(html) {
- $(wrap).remove();
- $('#ITP_CONTAINER .itp_contents').append(html);
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failPage);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failPage);
- }
- });
- };
- function itp_fn_load_html(href, container, param, fn, args) {
- $.ajax({
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- url: href,
- data: param,
- type: 'POST',
- dataType: 'html',
- async: false,
- timeout: 10000,
- beforeSend: function() {
- //$('#ITP_OVERLAY').show();
- },
- complete: function() {
- //$('#ITP_OVERLAY').hide();
- },
- success: function(html) {
- var append = function() {
- var deferred = $.Deferred();
- try {
- $(container).empty();
- $(container).append(html);
- deferred.resolve();
- } catch(err) {
- deferred.reject(err);
- }
- return deferred.promise();
- };
- append().done(function() {
- if (fn !== undefined || typeof fn !== 'undefined') {
- fn.callBack(args);
- }
- });
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failData);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failData);
- }
- });
- };
- // itp_fn_call_popup(ITP_CONTEXTPATH + '/BIZPOP_BOSS', '#ITP_ASIDE', 'BIZPOP_BOSS', null, popFn, null, 'S');
- function itp_fn_call_popup(href, container, fnm, param, popFn, args, returnType) {
- $.ajax({
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- url: href,
- data: param,
- type: 'POST',
- dataType: 'html',
- async: false,
- timeout: 10000,
- beforeSend: function() {
- //$('#ITP_OVERLAY').show();
- },
- complete: function() {
- //$('#ITP_OVERLAY').hide();
- },
- success: function(html) {
- var append = function() {
- var deferred = $.Deferred();
- try {
- $(container).empty();
- $(container).append(html);
- deferred.resolve();
- } catch(err) {
- deferred.reject(err);
- }
- return deferred.promise();
- };
- append().done(function() {
- eval('itp_fn_' + fnm)(popFn, args, returnType);
- $('.modal.itp_modal .modal-content').draggable();
- });
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failData);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failData);
- }
- });
- };
- // 2021.07.07 송호성 추가
- function fn_call_popup(type, popnm, container, popFn, args, returnType) {
- console.log('[ITP_CALL_POPUP] type = ' + type + ', popnm = ' + popnm);
- $.ajax({
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- url: ITP_CONTEXTPATH + '/app/popup/'+type+'/'+popnm+'.html',
- type: 'POST',
- dataType: 'html',
- async: false,
- timeout: 10000,
- beforeSend: function() {
- //$('#ITP_OVERLAY').show();
- },
- complete: function() {
- //$('#ITP_OVERLAY').hide();
- },
- success: function(html) {
- var append = function() {
- var deferred = $.Deferred();
- try {
- $(container).empty();
- $(container).append(html);
- deferred.resolve();
- } catch(err) {
- deferred.reject(err);
- }
- return deferred.promise();
- };
- append().done(function() {
- const js = '<script src="'+ITP_CONTEXTPATH+'/js/app/popup/'+type+'/ITP_'+popnm+'.js?version='+js_version+'"></script>';
- $('#ITP_ASIDE #ITP_'+popnm+' #ITP_POPUP_JS').empty();
- $('#ITP_ASIDE #ITP_'+popnm+' #ITP_POPUP_JS').append(js);
- eval('itp_fn_' + popnm)(popFn, args, returnType);
- $('.modal.itp_modal .modal-content').draggable();
- });
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failData);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failData);
- }
- });
- };
- function fn_popup_window_center(pageURL, popNm, w, h, mIdx) {
- var left = (screen.width/2)-(w/2)+(mIdx*45);
- var top = (screen.height/2)-(h/2)+(mIdx*90);
- var targetWin = window.open (pageURL, popNm, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
- if (window.focus) {
- targetWin.focus();
- }
- return targetWin;
- }
- function itp_fn_ajax_call(href, param, fn, type) {
- $.ajax({
- contentType: 'application/json',
- url: href,
- data: JSON.stringify(param),
- type: 'POST',
- dataType: 'json',
- async: false,
- timeout: 10000,
- beforeSend: function() {
- $('#ITP_OVERLAY').show();
- },
- complete: function() {
- $('#ITP_OVERLAY').hide();
- },
- success: function(result) {
- if (result.resultCd == 'S') {
- if (type == 'SAVE') {itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.successData);}
- if (type == 'DELETE') {itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.deletedData);}
- if (type == 'RESETPW') {itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.resetPw);}
- if (type == 'RESETUSERPW') {itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.resetUserPw);}
- if (type == 'CANCELPAY') {itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.cancelPay);}
- if (fn !== undefined || typeof fn !== 'undefined') fn(result.resultData);
- } else {
- if (result.resultMsg != null && result.resultMsg != '') {
- itp_fn_modal_alert_ajax(result.resultMsg);
- } else {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- }
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- });
- };
- function itp_fn_excel_upload(formId, href, fn) {
- const form = $(formId)[0];
- let param = new FormData(form);
- $.ajax({
- enctype: 'multipart/form-data',
- method: 'POST',
- url: ITP_CONTEXTPATH + href,
- data: param,
- processData: false,
- contentType: false,
- cache: false,
- async: false,
- timeout: 10000,
- beforeSend: function() {
- $('#ITP_OVERLAY').show();
- },
- complete: function() {
- $('#ITP_OVERLAY').hide();
- },
- success: function(result) {
- if (result.resultCd == 'S') {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.upload.successUpload);
- } else {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.upload.failUpload);
- }
- if(typeof fn === 'function'){
- fn(result.resultData);
- }
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.upload.failUpload);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.upload.failUpload);
- }
- });
- };
- function itp_fn_ajax_form_call(href, param, fn, type) {
- $.ajaxSettings.traditional = true;
- $.ajax({
- url: href,
- type: 'POST',
- data: param,
- enctype: 'multipart/form-data',
- cache: false,
- contentType: false,
- processData: false,
- dataType: 'json',
- async: false,
- timeout: 10000,
- beforeSend: function() {
- $('#ITP_OVERLAY').show();
- },
- complete: function() {
- $('#ITP_OVERLAY').hide();
- },
- success: function(result) {
- if (result.resultCd == 'S') {
- if (type == 'SAVE') {itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.successData);}
- if (type == 'DELETE') {itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.deletedData);}
- if (fn !== undefined || typeof fn !== 'undefined') fn(result.resultData);
- } else {
- if (result.resultMsg != null && result.resultMsg != '') {
- itp_fn_modal_alert_ajax(result.resultMsg);
- } else {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- }
- },
- error: function(xhr, status, error) {
- if (xhr.status == 401) location.href = ITP_CONTEXTPATH + '/';
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- },
- fail: function() {
- itp_fn_modal_alert_ajax(ITP_MSG_LOCALE.message.ajax.failProcess);
- }
- });
- };
- function itp_fn_date_format(date, type) {
- let month = date.getMonth() + 1;
- let day = date.getDate();
- let hour = date.getHours();
- let minute = date.getMinutes();
- let second = date.getSeconds();
- month = month >= 10 ? month : '0' + month;
- day = day >= 10 ? day : '0' + day;
- hour = hour >= 10 ? hour : '0' + hour;
- minute = minute >= 10 ? minute : '0' + minute;
- second = second >= 10 ? second : '0' + second;
- if(type && type == 1) {
- return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
- } else if(type && type == 2) {
- return date.getFullYear() + '.' + month + '.' + day;
- } else if(type && type == 3) {
- return date.getFullYear() + '' + month + '' + day;
- } else {
- return date.getFullYear() + month + day + hour + minute + second;
- }
- }
- // 쿠키 가져오기
- var itp_fn_get_cookie = function (cname) {
- var name = cname + "=";
- var ca = document.cookie.split(';');
- for(var i=0; i<ca.length; i++) {
- var c = ca[i];
- while (c.charAt(0)==' ') c = c.substring(1);
- if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
- }
- return "";
- }
- // 24시간 기준 쿠키 설정하기
- var itp_fn_set_cookie = function (cname, cvalue, exdays) {
- var todayDate = new Date();
- todayDate.setTime(todayDate.getTime() + (exdays*24*60*60*1000));
- var expires = "expires=" + todayDate.toUTCString();
- document.cookie = cname + "=" + cvalue + "; " + expires;
- }
- var itp_fn_contains_chars_only = function(value, chars) {
- for (var inx = 0; inx < value.length; inx++) {
- if (chars.indexOf(value.charAt(inx)) == -1)
- return false;
- }
- return true;
- }
- var itp_fn_check_big_alpha_num = function(value) {
- var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- return itp_fn_contains_chars_only(value,chars);
- }
- var itp_fn_s2ab = function(s) {
- var buf = new ArrayBuffer(s.length);
- var view = new Uint8Array(buf);
- for (var i=0; i<s.length; i++) view[i] = s.charCodeAt(i) & 0xFF;
- return buf;
- }
- var itp_fn_export_excel = function(excelData, fileName, sheetName) {
- // WORKBOOK 생성
- var wb = XLSX.utils.book_new();
- // 시트 만들기
- var newWorksheet = XLSX.utils.json_to_sheet(excelData);
- // WORKBOOK에 새로만든 워크시트에 이름을 주고 붙인다.
- XLSX.utils.book_append_sheet(wb, newWorksheet, sheetName);
- // 엑셀 파일 만들기
- var wbout = XLSX.write(wb, {bookType:'xlsx', type: 'binary'});
- // 엑셀 파일 내보내기
- saveAs(new Blob([itp_fn_s2ab(wbout)],{type:"application/octet-stream"}), fileName);
- }
- var itp_fn_jqgrid_to_excel = function(gridId, fileName, sheetName){
-
- var colModel = $(gridId).jqGrid('getGridParam', 'colModel');
-
- let dataList = [];
- var ids = $(gridId).getDataIDs();
- $.each(ids, function(ridx, rowId) {
- let data = new Object() ;
-
- $.each(colModel, function(cidx, item) {
- // console.log( item.label + ' : ' + $(gridId).jqGrid('getCell', rowId, item.name) );
-
- if(item.name == 'rn') { // NO
- data["NO"] = $(gridId).jqGrid('getCell', rowId, item.name);
- } else if(item.label !== undefined) {
- data[item.label] = $(gridId).jqGrid('getCell', rowId, item.name);
- }
- });
- dataList.push(data);
- });
- itp_fn_export_excel(dataList, fileName, sheetName);
- };
- var itp_fn_set_timeout = {
- init: function () {
- this.action();
- },
- action: function () {
- $(document).on('click', 'button', function() {
- if(!$(this).hasClass('itp_out')) {
- //로그인체크
- itp_fn_logined_check();
- }
- });
- }
- };
|