jQuery(function($){ // 상속 mplus_common.call(this); // super var self = this; /* 높이 계산 */ $(window).on('load resize',function(){ wh=$(window).height(); $('#page').height(wh); max=(wh-85); max2=(wh-40); $('.main-content').height(max2); //탭바꾸면 요 태그로 써야합니다. $('.main-content .tab-content .tab-pane').height(max2-20); $('.detail-main-content').height(max2); $('.detail-main-content2').height(wh-80); $('.detail-main-content2 .tab-content .tab-pane').height(wh-85); $('#sidebarMenu').height(wh); $('.sidebar-menu-inner>ul').height($('#sidebarMenu').height()-60); if ($('#openToggle').is('.on')){ $('#openToggle').stop().animate({bottom: wh-140 },500); $('#nursingPopup').height(max2-105); $('#nursingPopup .tab-content .tab-pane').height(max2-177); } /*$('.tab-content').height(wh-140) $('.card-box').height($('.tab-content').height()-30)*/ }); $('#menuToggle').on('click',function(){ $('#sidebarMenu').stop().animate({right:0},500); $(this).removeClass('cl'); }); $('#closeBtn').on('click',function(){ $('#sidebarMenu').stop().animate({right:-5000},500); $('#sidebarMenu li a').removeClass('active'); }); $(".popFootContent .btn-group > .btn").click(function(){ $(".popFootContent .btn-group > .btn").removeClass("active"); }); $('.sidebar-menu-inner>ul> li>a').on('click',function(){ if ($(this).is('.active')) { $('.sidebar-menu-inner>ul> li>ul').stop().slideUp(); $('.sidebar-menu-inner>ul> li>a').removeClass('active'); $('.sidebar-menu-inner>ul> li>a .fa').removeClass('fa-minus-circle'); $('.sidebar-menu-inner>ul> li>a .fa').addClass('fa-plus-circle'); }else{ $('.sidebar-menu-inner>ul> li>ul').hide(); $(this).next().stop().slideDown(); $('.sidebar-menu-inner>ul> li>a').removeClass('active'); $(this).addClass('active'); $(this).find('.fa').removeClass('fa-plus-circle'); $(this).find('.fa').addClass('fa-minus-circle'); } }); $('#sidebarMenu').click(function(e){ if(e.target.parentElement.className=='top-header'){ $('#sidebarMenu').stop().animate({right:-5000},500); $('#sidebarMenu li a').removeClass('active'); } }); $('#openToggle').on('click',function(){ if ($(this).is('.on')) { $(this).stop().animate({bottom:10},500); $('#overlay').stop().animate({bottom:-290},500); $('#nursingPopup').stop().animate({bottom:-max},500); $('#patientList, #outPatientList, #emerPatientList, #searchPatientList').css('margin-bottom', '0'); $(this).removeClass('on'); $(this).find('.fa').removeClass('fa-chevron-down'); $(this).find('.fa').addClass('fa-chevron-up'); }else{ if(window.location.search.split('=')[1]=='clinic'){ //진료화면 if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn' ||$("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut' ||$("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabEmer'){ //진료/외래/응급 탭 if($('#nursingPopupId').text()=='' && $('#nursingPopupNameNum').text()==''){ self.alert('환자를 선택해주세요.'); return; } else{ var patientId = JSON.parse(localStorage.patientInfo).patientId; $('.list-group-item[patientId='+patientId+']').addClass('active'); $('#nursingPopup [id*=popContent]').removeClass('in'); $('#nursingPopup #popContentNursingRecode').addClass('in'); if(!$('#openToggle').is('.on')){ $('#nursingRecodeTab.nav-tabs a[href="#tabInfo"]').tab('show'); }else{ mplusNursing.reInit($("ul#nursingRecodeTab.nav-tabs li.active a").attr('aria-controls')); } $('#newPopupFooter').css('display', 'block'); // 선택한 환자의 스크롤 위치 구하기 if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn'){ var pos = $('#tabIn').scrollTop() + $('#inUlPatientList li a.list-group-item[patientId='+patientId+']').offset().top; $('#patientList').css('margin-bottom', '100vh'); }else if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut'){ var pos = $('#tabOut').scrollTop() + $('#outUlPatientList li a.list-group-item[patientId='+patientId+']').offset().top; $('#outpatientList').css('margin-bottom', '100vh'); }else{ var pos = $('#tabEmer').scrollTop() + $('#emerUlPatientList li a.list-group-item[patientId='+patientId+']').offset().top; $('#emerpatientList').css('margin-bottom', '100vh'); } if( self.isTablet() ) { // 적절한 위치로 이동 if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn'){ $('#tabIn').animate({scrollTop: pos - 150}, 500); }else if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut'){ $('#tabOut').animate({scrollTop: pos - 150}, 500); }else{ $('#tabEmer').animate({scrollTop: pos - 150}, 500); } $('#nursingPopup').height(max2-245); $('#nursingPopup .tab-content .tab-pane').height(max2-317); $('#openToggle').stop().animate({bottom: wh-280 },500); }else{ // 적절한 위치로 이동 if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabIn'){ $('#tabIn').animate({scrollTop: pos - 77}, 500); }else if($("ul#clinicTab.nav-tabs li.active a").attr('aria-controls')=='tabOut'){ $('#tabOut').animate({scrollTop: pos - 77}, 500); }else{ $('#tabEmer').animate({scrollTop: pos - 77}, 500); }; $('#nursingPopup').height(max2-105); $('#nursingPopup .tab-content .tab-pane').height(max2-177); $('#openToggle').stop().animate({bottom: wh-140 },500); } $('#openToggle').addClass('on'); $('#openToggle').find('.fa').removeClass('fa-chevron-up'); $('#openToggle').find('.fa').addClass('fa-chevron-down'); $('#nursingPopup').stop().animate({bottom:0},500); $('#nursingPopup').css({'display': 'block'}); } }else { //검색 탭 var patientInfo = JSON.parse(localStorage.patientInfo); var patientId = patientInfo.patientId; $('.list-group-item[patientId='+patientId+']').addClass('active'); if($('input[type="radio"][name="plist-search"]:checked').val()=='treat'){ if($('input[type="radio"][name="treatment"]:checked').val()=='in'){ patientInfo.treatTyp='I'; } }else{ patientInfo.treatTyp='I'; } if(patientInfo.treatTyp=='I'){ $('#nursingPopup [id*=popContent]').removeClass('in'); $('#nursingPopup #popContentNursingRecode').addClass('in'); if(!$('#openToggle').is('.on')){ $('#nursingRecodeTab.nav-tabs a[href="#tabInfo"]').tab('show'); }else{ mplusNursing.reInit($("ul#nursingRecodeTab.nav-tabs li.active a").attr('aria-controls')); } $('#newPopupFooter').css('display', 'block'); /*$('#nursingPopup').css('display', 'block');*/ // 선택한 환자의 스크롤 위치 구하기 var pos = $('#tabSearch').scrollTop() + $('#searchPatientList li a.list-group-item[patientId='+patientId+']').offset().top; $('#searchPatientList').css('margin-bottom', '100vh'); if( self.isTablet() ) { // 적절한 위치로 이동 $('#tabSearch').animate({scrollTop: pos - 150}, 500); $('#nursingPopup').height(max2-245); $('#nursingPopup .tab-content .tab-pane').height(max2-317); $('#openToggle').stop().animate({bottom: wh-280 },500); }else{ // 적절한 위치로 이동 $('#tabSearch').animate({scrollTop: pos - 77}, 500); $('#nursingPopup').height(max2-105); $('#nursingPopup .tab-content .tab-pane').height(max2-177); $('#openToggle').stop().animate({bottom: wh-140 },500); } $('#openToggle').addClass('on'); $('#openToggle').find('.fa').removeClass('fa-chevron-up'); $('#openToggle').find('.fa').addClass('fa-chevron-down'); $('#nursingPopup').stop().animate({bottom:0},500); $('#nursingPopup').css({'display': 'block'}); }else{ $('#openToggle').stop().animate({bottom:240},500); $('#overlay').stop().animate({bottom:-49},500); $('#footer').css('overflow','visible'); $('#openToggle').addClass('on'); $('#openToggle').find('.fa').removeClass('fa-chevron-up'); $('#openToggle').find('.fa').addClass('fa-chevron-down'); } } }else if(window.location.search.split('=')[1]=='operation') { //수술스케줄화면 if( $('#divId').text()=='' && $('#divOpPatientName').text()==''){ self.alert('환자를 선택해주세요.'); return; } else { $('#openToggle').stop().animate({bottom:240},500); $('#overlay').stop().animate({bottom:-49},500); $('#footer').css('overflow','visible'); $('#openToggle').addClass('on'); $('#openToggle').find('.fa').removeClass('fa-chevron-up'); $('#openToggle').find('.fa').addClass('fa-chevron-down'); $('.pop-content ul').scrollTop(0); } } } });//end $('#page').not('#overlay').on('click', function(){ //list, overlay 팝업 이외의 곳을 클릭하면 팝업 사라지도록 if(event.target.className.indexOf('list-group-item')>-1 || (event.target.offsetParent!=null && event.target.offsetParent.className.indexOf('list-group-item')>-1)) return; if($('#overlay').css('bottom')=='-49px' || $('#nursingPopup').css('bottom')=='0px'){ $('#openToggle').stop().animate({bottom:10},500); $('#overlay').stop().animate({bottom:-290},500); $('#nursingPopup').stop().animate({bottom:-max},500); $('#newPopupFooter').css('display', 'none'); $('#patientList').css('margin-bottom', '0'); $('#searchPatientList').css('margin-bottom', '0'); $('#openToggle').removeClass('on'); $('#openToggle').find('.fa').removeClass('fa-chevron-down'); $('#openToggle').find('.fa').addClass('fa-chevron-up'); } }); $(".switch").click(function(){ var chk = $('#cb').is(":checked"); if(chk) { $('.sel1').removeClass('select'); $('.sel2').addClass('select'); } else { $('.sel2').removeClass('select'); $('.sel1').addClass('select'); } }); });