$(function() { $('#side-menu').metisMenu(); $( '.check-all' ).click( function() { $( '.ab' ).prop( 'checked', this.checked ); } ); }); //Loads the correct sidebar on window load, //collapses the sidebar on window resize. // Sets the min-height of #page-wrapper to window size $(function() { $(window).bind("load resize", function() { topOffset = 50; width = (this.window.innerWidth > 0) ? this.window.innerWidth : this.screen.width; if (width < 768) { $('div.navbar-collapse').addClass('collapse'); topOffset = 100; // 2-row-menu } else { $('div.navbar-collapse').removeClass('collapse'); } height = ((this.window.innerHeight > 0) ? this.window.innerHeight : this.screen.height) - 1; height = height - topOffset; if (height < 1) height = 1; if (height > topOffset) { $("#page-wrapper").css("min-height", (height) + "px"); } }); var url = window.location; var element = $('ul.nav a').filter(function() { return this.href == url; }).addClass('active').parent().parent().addClass('in').parent(); if (element.is('li')) { element.addClass('active'); } }); function go_url(url){ $(location).attr('href',url); } //체크박스 선택여부 확인 function chk_fm() { var chk_num = $( "input:checked" ).length; if(chk_num==0) { alert("한개이상 선택하세요."); return false; } else{ var del_confirm = confirm("선택하신 데이터를 추가 하시겠습니까?"); if(del_confirm == true){ //$('#mode').val('LIST_DELETE_ACTION2'); //document.fs.submit(); } } } function select_change(val){ if(val != ""){ $.ajax({ type: "POST", url: "/common/area_change.php", data:{ 'value':val }, error:function(data,error) { //alert(error); }, success: function(data) { $("#gugun").html(data); } }); } } //어메니티 추가 function addSizetitle(){ var title = document.getElementById('add-size-title').value; var subtitle = document.getElementById('add-size-subtitle').value; var title_en = document.getElementById('add-size-title_en').value; var subtitle_en = document.getElementById('add-size-subtitle_en').value; if(title == ''){ alert('어메니티 제목을 추가하세요'); return false; } if(title_en == ''){ alert('어메니티 제목(영문)을 추가하세요'); return false; } if(subtitle == ''){ alert('어메니티 내용을 추가하세요'); return false; } if(subtitle_en == ''){ alert('어메니티 내용(영문)을 추가하세요'); return false; } addSize(title,subtitle,title_en,subtitle_en); document.getElementById('add-size-title').value = ""; document.getElementById('add-size-subtitle').value = ""; document.getElementById('add-size-title_en').value = ""; document.getElementById('add-size-subtitle_en').value = ""; } function addSize(title,subtitle,title_en,subtitle_en){ var tbody = document.getElementById('product-size').getElementsByTagName('tbody'); if(jQuery('.size_cnt').length > 0) var count = jQuery('.size_cnt').last().val(); else var count = 0; count = parseInt(count) + 1; var tr = document.createElement('tr'); tr.id = 'size_'+count; var html = ''; var titles = title.split(';'); for(i=0; i'; html = html + ''; html = html + ''; html = html + ''; html = html + ''; html = html + ''; html = html + ''; html = html + 'Remove'; tr.innerHTML = html; tbody[0].appendChild(tr); } function removeSize(e){ jQuery(e).parents('tr').remove(); } //옵션 추가 function addOptiontitle(){ var title = document.getElementById('add-option-title').value; var title_en = document.getElementById('add-option-title_en').value; var subtitle = document.getElementById('add-option-price').value; if(title == ''){ alert('옵션 제목을 추가하세요'); return false; } if(title_en == ''){ alert('옵션 제목(영문)을 추가하세요'); return false; } if(subtitle == ''){ alert('옵션 가격을 추가하세요'); return false; } addOption(title,subtitle,title_en); document.getElementById('add-option-title').value = ""; document.getElementById('add-option-title_en').value = ""; document.getElementById('add-option-price').value = ""; } function addOption(title,subtitle,title_en){ var tbody = document.getElementById('product-option').getElementsByTagName('tbody'); if(jQuery('.option_cnt').length > 0) var count = jQuery('.option_cnt').last().val(); else var count = 0; count = parseInt(count) + 1; var tr = document.createElement('tr'); tr.id = 'option_'+count; var html = ''; var titles = title.split(';'); for(i=0; i'; html = html + ''; html = html + ''; html = html + ''; html = html + ''; html = html + ''; html = html + 'Remove'; tr.innerHTML = html; tbody[0].appendChild(tr); } function removeOption(e){ jQuery(e).parents('tr').remove(); } //이미지 추가 function addImage(){ var tbody = document.getElementById('product-design').getElementsByTagName('tbody'); if(jQuery('.ordering').length > 0) var count = jQuery('.ordering').last().val(); else var count = 0; count = parseInt(count) + 1; var tr = document.createElement('tr'); tr.id = 'image_'+count; var html = ''; for(i=0; i<1; i++) html = html + ''; html = html + ''; html = html + ''; html = html + ''; html = html + ''; html = html + 'Remove'; tr.innerHTML = html; tbody[0].appendChild(tr); } function removeImage(e){ jQuery(e).parents('tr').remove(); } function select_room(val){ if(val != ""){ $.ajax({ type: "POST", url: "/adminNew/reservation/select_room.php", data:{ 'value':val }, error:function(data,error) { //alert(error); }, success: function(data) { $("#r_roomtype").val(data); } }); } } function comment_insert(b_class,b_no,c_mode){ if($('#bcm_comment').val() != ""){ $.ajax({ type: "POST", url: "/admin/board/comment.php", data:{ 'c_mode':c_mode, 'b_class':b_class, 'b_no':b_no, 'bcm_gubun':'BD', 'bcm_comment':$('#bcm_comment').val() }, error:function(data,error) { //alert(error); }, success: function(data) { location.reload(); } }); } else{ alert("댓글 내용을 입력하세요"); } } //mode=COMMENT_DELETE&p=&bcm_no=&bcm_gubun=&b_no= function comment_delete(b_class,b_no,c_mode,bcm_no){ if(bcm_no != ""){ $.ajax({ type: "POST", url: "/admin/board/comment.php", data:{ 'c_mode':c_mode, 'b_class':b_class, 'b_no':b_no, 'bcm_gubun':'BD', 'bcm_no':bcm_no }, error:function(data,error) { //alert(error); }, success: function(data) { location.reload(); } }); } } function link_show(value){ if(value == "PM"){ $("#link").show(); } else if(value == "MM"){ $("#link").show(); } else{ $("#link").hide(); } } function execDaumPostcode() { new daum.Postcode({ oncomplete: function(data) { // 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분. // 각 주소의 노출 규칙에 따라 주소를 조합한다. // 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다. var addr = ''; // 주소 변수 var extraAddr = ''; // 참고항목 변수 //사용자가 선택한 주소 타입에 따라 해당 주소 값을 가져온다. if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우 addr = data.roadAddress; } else { // 사용자가 지번 주소를 선택했을 경우(J) addr = data.jibunAddress; } // 사용자가 선택한 주소가 도로명 타입일때 참고항목을 조합한다. if(data.userSelectedType === 'R'){ // 법정동명이 있을 경우 추가한다. (법정리는 제외) // 법정동의 경우 마지막 문자가 "동/로/가"로 끝난다. if(data.bname !== '' && /[동|로|가]$/g.test(data.bname)){ extraAddr += data.bname; } // 건물명이 있고, 공동주택일 경우 추가한다. if(data.buildingName !== '' && data.apartment === 'Y'){ extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName); } // 표시할 참고항목이 있을 경우, 괄호까지 추가한 최종 문자열을 만든다. if(extraAddr !== ''){ extraAddr = ' (' + extraAddr + ')'; } // 조합된 참고항목을 해당 필드에 넣는다. //document.getElementById("sample6_extraAddress").value = extraAddr; } else { //document.getElementById("sample6_extraAddress").value = ''; } // 우편번호와 주소 정보를 해당 필드에 넣는다. //document.getElementById('sample6_postcode').value = data.zonecode; document.getElementById("addr1").value = addr + extraAddr; document.getElementById("addr2").focus(); // 커서를 상세주소 필드로 이동한다. //document.getElementById("sample6_detailAddress").focus(); } }).open(); }