$(document).ready(function () { // Page Preloader $('#status').fadeOut(); $('#preloader').delay(200).fadeOut(function () { $('body').delay(200).css({'overflow': 'visible'}); }); // 좌측메뉴 스토리지 let leftMenuType = localStorage.getItem("leftMenuType"); if(leftMenuType=='close'){ $('.menutoggle').addClass('menu-collapsed'); $('body').addClass('leftpanel-collapsed'); $('ul.children').css("display",""); }else{ $('.menutoggle').removeClass('menu-collapsed'); $('body').removeClass('leftpanel-collapsed'); $('ul.children').css("display","block"); }; // 로딩바 제거 // 상단 스케쥴 - 이동 $('.headSchedule,.headSchedule-mobile').click(function (e) { location.href="/html/dashboard.html"; }); // Toggle Left Menu $('.leftpanel .nav-parent > a').live('click', function () { var parent = $(this).parent(); var sub = parent.find('> ul'); // Dropdown works only when leftpanel is not collapsed if (!$('body').hasClass('leftpanel-collapsed')) { if (sub.is(':visible')) { sub.slideUp(200, function () { parent.removeClass('nav-active'); $('.mainpanel').css({height: ''}); adjustmainpanelheight(); }); } else { closeVisibleSubMenu(); parent.addClass('nav-active'); sub.slideDown(200, function () { adjustmainpanelheight(); }); } } return false; }); function closeVisibleSubMenu() { $('.leftpanel .nav-parent').each(function () { var t = $(this); if (t.hasClass('nav-active')) { t.find('> ul').slideUp(200, function () { t.removeClass('nav-active'); }); } }); } function adjustmainpanelheight() { // Adjust mainpanel height var docHeight = $(document).height(); if (docHeight > $('.mainpanel').height()) $('.mainpanel').height(docHeight); } adjustmainpanelheight(); // Tooltip $('.tooltips').tooltip({container: 'body'}); // Popover $('.popovers').popover(); // Close Button in Panels $('.panel .panel-close').click(function () { $(this).closest('.panel').fadeOut(200); return false; }); // Form Toggles $('.toggle').toggles({on: true}); $('.toggle-chat1').toggles({on: false}); // Sparkline $('#sidebar-chart').sparkline([4, 3, 3, 1, 4, 3, 2, 2, 3, 10, 9, 6], { type: 'bar', height: '30px', barColor: '#428BCA' }); $('#sidebar-chart2').sparkline([1, 3, 4, 5, 4, 10, 8, 5, 7, 6, 9, 3], { type: 'bar', height: '30px', barColor: '#D9534F' }); $('#sidebar-chart3').sparkline([5, 9, 3, 8, 4, 10, 8, 5, 7, 6, 9, 3], { type: 'bar', height: '30px', barColor: '#1CAF9A' }); $('#sidebar-chart4').sparkline([4, 3, 3, 1, 4, 3, 2, 2, 3, 10, 9, 6], { type: 'bar', height: '30px', barColor: '#428BCA' }); $('#sidebar-chart5').sparkline([1, 3, 4, 5, 4, 10, 8, 5, 7, 6, 9, 3], { type: 'bar', height: '30px', barColor: '#F0AD4E' }); // Minimize Button in Panels $('.minimize').click(function () { var t = $(this); var p = t.closest('.panel'); if (!$(this).hasClass('maximize')) { p.find('.panel-body, .panel-footer').slideUp(200); t.addClass('maximize'); t.html('+'); } else { p.find('.panel-body, .panel-footer').slideDown(200); t.removeClass('maximize'); t.html('−'); } return false; }); // Add class everytime a mouse pointer hover over it $('.nav-bracket > li').hover(function () { $(this).addClass('nav-hover'); }, function () { $(this).removeClass('nav-hover'); }); // Menu Toggle $('.menutoggle').click(function () { var body = $('body'); var bodypos = body.css('position'); if (bodypos != 'relative') { if (!body.hasClass('leftpanel-collapsed')) { body.addClass('leftpanel-collapsed'); $('.nav-bracket ul').attr('style', ''); $(this).addClass('menu-collapsed'); localStorage.setItem("leftMenuType", 'close'); } else { body.removeClass('leftpanel-collapsed chat-view'); $('.nav-bracket li.active ul').css({display: 'block'}); $(this).removeClass('menu-collapsed'); localStorage.removeItem("leftMenuType"); } } else { if (body.hasClass('leftpanel-show')) body.removeClass('leftpanel-show'); else body.addClass('leftpanel-show'); adjustmainpanelheight(); } }); // Chat View $('#chatview').click(function () { var body = $('body'); var bodypos = body.css('position'); if (bodypos != 'relative') { if (!body.hasClass('chat-view')) { body.addClass('leftpanel-collapsed chat-view'); $('.nav-bracket ul').attr('style', ''); } else { body.removeClass('chat-view'); if (!$('.menutoggle').hasClass('menu-collapsed')) { $('body').removeClass('leftpanel-collapsed'); $('.nav-bracket li.active ul').css({display: 'block'}); } else { } } } else { if (!body.hasClass('chat-relative-view')) { body.addClass('chat-relative-view'); body.css({left: ''}); } else { body.removeClass('chat-relative-view'); } } }); reposition_topnav(); reposition_searchform(); $(window).resize(function () { if ($('body').css('position') == 'relative') { $('body').removeClass('leftpanel-collapsed chat-view'); } else { $('body').removeClass('chat-relative-view'); $('body').css({left: '', marginRight: ''}); } reposition_searchform(); reposition_topnav(); }); /* This function will reposition search form to the left panel when viewed * in screens smaller than 767px and will return to top when viewed higher * than 767px */ function reposition_searchform() { if ($('.searchform').css('position') == 'relative') { $('.searchform').insertBefore('.leftpanelinner .userlogged'); } else { $('.searchform').insertBefore('.header-right'); } } /* This function allows top navigation menu to move to left navigation menu * when viewed in screens lower than 1024px and will move it back when viewed * higher than 1024px */ function reposition_topnav() { if ($('.nav-horizontal').length > 0) { // top navigation move to left nav // .nav-horizontal will set position to relative when viewed in screen below 1024 if ($('.nav-horizontal').css('position') == 'relative') { if ($('.leftpanel .nav-bracket').length == 2) { $('.nav-horizontal').insertAfter('.nav-bracket:eq(1)'); } else { // only add to bottom if .nav-horizontal is not yet in the left panel if ($('.leftpanel .nav-horizontal').length == 0) $('.nav-horizontal').appendTo('.leftpanelinner'); } $('.nav-horizontal').css({display: 'block'}) .addClass('nav-pills nav-stacked nav-bracket'); $('.nav-horizontal .children').removeClass('dropdown-menu'); $('.nav-horizontal > li').each(function () { $(this).removeClass('open'); $(this).find('a').removeAttr('class'); $(this).find('a').removeAttr('data-toggle'); }); if ($('.nav-horizontal li:last-child').has('form')) { $('.nav-horizontal li:last-child form').addClass('searchform').appendTo('.topnav'); $('.nav-horizontal li:last-child').hide(); } } else { // move nav only when .nav-horizontal is currently from leftpanel // that is viewed from screen size above 1024 if ($('.leftpanel .nav-horizontal').length > 0) { $('.nav-horizontal').removeClass('nav-pills nav-stacked nav-bracket') .appendTo('.topnav'); $('.nav-horizontal .children').addClass('dropdown-menu').removeAttr('style'); $('.nav-horizontal li:last-child').show(); $('.searchform').removeClass('searchform').appendTo('.nav-horizontal li:last-child .dropdown-menu'); $('.nav-horizontal > li > a').each(function () { $(this).parent().removeClass('nav-active'); if ($(this).parent().find('.dropdown-menu').length > 0) { $(this).attr('class', 'dropdown-toggle'); $(this).attr('data-toggle', 'dropdown'); } }); } } } } // Sticky Header if ($.cookie('sticky-header')) $('body').addClass('stickyheader'); // Sticky Left Panel if ($.cookie('sticky-leftpanel')) { $('body').addClass('stickyheader'); $('.leftpanel').addClass('sticky-leftpanel'); } // Left Panel Collapsed if ($.cookie('leftpanel-collapsed')) { $('body').addClass('leftpanel-collapsed'); $('.menutoggle').addClass('menu-collapsed'); } // Changing Skin var c = $.cookie('change-skin'); if (c) { $('head').append(''); } // Changing Font var fnt = $.cookie('change-font'); if (fnt) { $('head').append(''); } // Check if leftpanel is collapsed if ($('body').hasClass('leftpanel-collapsed')) $('.nav-bracket .children').css({display: ''}); // Handles form inside of dropdown $('.dropdown-menu').find('form').click(function (e) { e.stopPropagation(); }); }); (function ($, window) { $.fn.contextMenu = function (settings) { return this.each(function () { // Open context menu $(this).on("contextmenu", function (e) { // return native menu if pressing control if (e.ctrlKey) return; var user_no = $(this).data("id"); $("#user_no").val(user_no); //open menu var $menu = $(settings.menuSelector) .data("invokedOn", $(e.target)) .show() .css({ position: "absolute", left: getMenuPosition(e.clientX, 'width', 'scrollLeft'), top: getMenuPosition(e.clientY, 'height', 'scrollTop') }) .off('click') .on('click', 'a', function (e) { $menu.hide(); var $invokedOn = $menu.data("invokedOn"); var $selectedMenu = $(e.target); settings.menuSelected.call(this, $invokedOn, $selectedMenu); }); return false; }); //make sure menu closes on any click $('body').click(function () { $(settings.menuSelector).hide(); }); }); function getMenuPosition(mouse, direction, scrollDir) { var win = $(window)[direction](), scroll = $(window)[scrollDir](), menu = $(settings.menuSelector)[direction](), position = mouse + scroll; // opening menu would pass the side of the page if (mouse + menu > win && menu < mouse) position -= menu; return position; } }; })($, window); $(".table td.member-id").contextMenu({ menuSelector: "#contextMenu", menuSelected: function (invokedOn, selectedMenu) { var msg = "You selected the menu item '" + selectedMenu.text() + "' on the value '" + invokedOn.text() + "'"; } }); // 회원아이디 오른쪽 클릭 메뉴 링크 function popSelMenu(menuMode) { var user_no = $("#user_no").val(); switch (menuMode) { case "memInfo" : popUserInfo(user_no) break; case "addHistory" : popUserHistory(user_no); break; case "useStore" : popUserStore(user_no); break; case "smsSend" : popUserSMS(user_no); break; case "mailSend" : popUserMail(user_no); break; default: break; } } // 구글시트 이동 function popGoogleSheet(sheetId, sheet) { if(sheetId && sheet) { //window.open('https://docs.google.com/spreadsheets/d/' + spreadSheetId + '/edit#gid=' + sheetId + '&range=B' + sheet, 'GoogleSheet'); } } // 노션페이지 팝업 function popNotion(url) { window.open(url, 'Notion'); event.stopImmediatePropagation(); } // 업무 등록 function popWorkTask(task_no) { let options = popSize(550,750); let uri = '/html/plan/work_reg.html?task_no=' + task_no; window.open(uri, 'WorkTask', options + ', toolbar=no, menubar=no, scrollbars=no, resizable=no'); } // 업무 확인 function popWorkTaskView(task_no) { let options = popSize(550,750); let uri = '/html/plan/work_view.html?task_no=' + task_no; window.open(uri, 'WorkTask', options + ', toolbar=no, menubar=no, scrollbars=no, resizable=no'); } // 업무 복사 (등록) function popWorkTaskDuplicate(task_no) { let options = popSize(550,750); let uri = '/html/plan/work_reg.html?duplicate_no=' + task_no; window.open(uri, 'WorkTask_' + task_no, options + ', toolbar=no, menubar=no, scrollbars=no, resizable=no'); } // 완료처리 팝업 function popWorkCompTask(task_no) { let options = popSize(530,340); let uri = '/html/plan/work_comp.html?task_no=' + task_no; window.open(uri, 'WorkTaskComp_' + task_no, options + ', toolbar=no, menubar=no, scrollbars=no, resizable=no'); } /* 업무 등록*/ $('#work-complete').on("click",function(){ var formData = $("#dailyTaskInput").serialize(); let breakChk = false; $(".memberTime").each(function(){ if(!$(this).val() || $(this).val() == 0 || $(this).val()=='0.0'){ $(this).val(''); $(this).focus(); breakChk = true; return false; } }); if(breakChk) { alert("작업시간은 필수 입니다."); return; } let banner = $('#banner').val() == 0 || !$('#banner').val() ? false : true; let detail = $('#detail').val() == 0 || !$('#detail').val() ? false : true; if($('#designYn').val() == 'Y' && !banner && !detail ){ alert("디자이너가 포함된경우 디자안(배너, 상세)값을 입력해 주세요."); return; } if($('#designYn').val() == 'N' && (banner || detail) ){ if(!confirm("디자이너가 포함되지 않았는데 이미지 작업건이 있습니다. 이대로 처리 하시겠습니까?")) return; }else{ if(!confirm('해당건을 처리 하시겠습니까?')) return; } $.ajax({ cache : false, url : "/html/process.html", // 요기에 type : 'POST', data : formData, success : function(data) { if(data=='Success' || data == 'Auth'){ top.opener.location.reload(); self.close(); } else alert(data); }, // success error : function(xhr, status) { alert(xhr + " : " + status); } }); // $.ajax */ }) /* 업무 완료 복구*/ $('.work-restore').on("click",function(e){ e.stopPropagation(); let task_idx = $(this).data('idx'); let refpage = '/plan/work_reg.html'; if(!task_idx){ alert('업무관리번호가 없습니다.'); return; } if(!confirm('해당건을 복구 하시겠습니까?')) return; $.ajax({ cache : false, url : "/html/process.html", // 요기에 type : 'POST', data : {task_idx:task_idx,mod:'restore',refpage:refpage }, success : function(data) { if(data=='Success' || data == 'Auth'){ location.reload(); } else alert(data); }, // success error : function(xhr, status) { alert(xhr + " : " + status); } }); }) // 업무일지 등록 function popPlanTask(pt_no,month) { let options = popSize(600,550); let uri = '/html/plan/daily_reg.html?pt_no=' + pt_no; if(month) uri += '&month=' + month; window.open(uri, 'PlanTask', options + ', toolbar=no, menubar=no, scrollbars=Yes, resizable=no'); } // 회원 회원정보 function popUserInfo(user_no) { window.open('/html/member/member_detail.html?user_no=' + user_no, '회원정보_' + user_no, 'width=800, height=700, toolbar=no, menubar=no, scrollbars=no, resizable=yes'); } // 회원 회원등록/수정 function popUserMember(user_no) { let options = popSize(800,510); window.open('/html/member/member_Add.html?user_no=' + user_no, '회원등록/수정', options + ', toolbar=no, menubar=no, scrollbars=no, resizable=no'); } // 업체정보 function popCompanyInfo(com_no) { let options = popSize(800,510); window.open('/html/company/company_detail.html?com_no=' + com_no, '업체정보_' + com_no, options + ', toolbar=no, menubar=no, scrollbars=no, resizable=yes'); } $('.company-id').on("click",function() { let com_no = $(this).data('idx'); if(com_no) popCompanyInfo(com_no); }) // 업체등록/수정 function popCompany(user_no) { let options = popSize(800,510); window.open('/html/company/company_add.html?com_no=' + user_no, '회원등록/수정', options + ', toolbar=no, menubar=no, scrollbars=no, resizable=no'); } // 화면중간에 팝업 띄우기 function popSize(width,height){ let left = (screen.width - width) / 2; // 가로 가운데 정렬을 위한 왼쪽 위치 계산 let top = (screen.height - height) / 2; // 세로 가운데 정렬을 위한 상단 위치 계산 let options = 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top; return options; } $(document).ready(function () { //최상단 체크박스 클릭 $(".checkall").click(function () { //클릭되었으면 if ($(".checkall").prop("checked")) { //input태그의 name이 chk인 태그들을 찾아서 checked옵션을 true로 정의 $("input[name=chk]").prop("checked", true); //클릭이 안되있으면 } else { //input태그의 name이 chk인 태그들을 찾아서 checked옵션을 false로 정의 $("input[name=chk]").prop("checked", false); } }) $('.btn-toggle').click(function () { $(this).find('.btn').toggleClass('active'); if ($(this).find('.btn-primary').length > 0) { $(this).find('.btn').toggleClass('btn-primary'); } if ($(this).find('.btn-danger').length > 0) { $(this).find('.btn').toggleClass('btn-danger'); } if ($(this).find('.btn-success').length > 0) { $(this).find('.btn').toggleClass('btn-success'); } if ($(this).find('.btn-info').length > 0) { $(this).find('.btn').toggleClass('btn-info'); } $(this).find('.btn').toggleClass('btn-default'); }); /* 창 닫기 */ $('#btn-close').on("click",function(){ self.close(); }) /* 이전페이지로 */ $('#btn-back').on("click",function(){ history.go(-1); }) }); /* 게시판 관리버튼 기능 [E] */ // datepicker $(document).ready(function () { $(function () { $("#sdate").datepicker({dateFormat: 'yy-mm-dd', maxDate: '=date("Y-m-d");?>'}); $(".datepicker").datepicker({dateFormat: 'yy-mm-dd'}); }); }); // 날자 설정 function SetDate(O, S, E) { let n = new Date(); let strF = O.charAt(0); // 첫글자 let strFP = O.slice(1) * 1; // 나머지글자 let strL = O.slice(-1); // 마지막글자 let strLP = O.slice(0,-1) * 1; // 마지막글자를 제외한 let stDate, enDate = n, last; // 지난 월도 선택 if(strF=='B'){ stDate = new Date(n.getFullYear(), n.getMonth() - strFP, 1); last = (new Date(stDate.getFullYear(), stDate.getMonth() + 1, 0)).getDate(); enDate = new Date(stDate.getFullYear(), stDate.getMonth() , last); } // 지금으로 부터 몇개월 전 else if(strL=='M'){ strLP = (strLP) ? strLP - 1 : 0; stDate = new Date(n.getFullYear(), n.getMonth() - strLP, 1); } // 지난 년도 else if(strF=='Y'){ stDate = new Date(n.getFullYear() - strFP, 0, 1); enDate = new Date(stDate.getFullYear(), 11, 31); } else { switch (O) { case 'T': stDate = n; break; case '1': stDate = new Date(n.getFullYear(), n.getMonth(), n.getDate() - 1); enDate = stDate; break; case '7': stDate = new Date(n.getFullYear(), n.getMonth(), n.getDate() - 7); break; case '30': stDate = new Date(n.getFullYear(), n.getMonth(), n.getDate() - 30); break; } } let sdate = getDateFormat(stDate); let edate = getDateFormat(enDate); $("#"+S).val(sdate); $("#"+E).val(edate); // option : 리포트에서 클릭시 리포트로 이동 기능 report(sdate, edate, O); } function getDateFormat(currentDate) { var year = currentDate.getFullYear(); var month = ("0" + (currentDate.getMonth() + 1)).slice(-2); var day = ("0" + currentDate.getDate()).slice(-2); // YYYY-mm-dd 형식으로 날짜 구성 var formattedDate = year + "-" + month + "-" + day; return formattedDate; } function report(sdate, edate, searDateType) { if(sdate && edate) { let f=document.scform; f.searDateType.value=searDateType; f.submit(); } } // 테이블 정렬 $(document).ready(function() { // 테이블을 tablesorter로 초기화 $("#myTable").tablesorter(); }); // 엑셀다운로드 $(document).ready(function() { $('.excelDown').on('click', function(){ let targetTable = $(this).data('target'); if(!targetTable){ return '엑셀전환 테이블이 없습니다.'; } var datatodisplay = $("