$(function() { // 결베방법 라벨버튼 클릭 시 이벤트 발생 var changePayMethod = function() { var $this = $(this); if (!$('.isLogged').length) { if ($this.val() == 'bank') { alert(LANG['use_bank_after_login']); return false; } else if ($this.val() == 'deposit') { alert(LANG['use_deposit_after_login']); return false; } } $('.paymentInfo:not(.' + this.value + 'Info)').hide(); $('.' + this.value + 'Info').show(); $('.bankSelectInfo').hide(); $('input[name=pg][value=paygate]').removeAttr('disabled'); $('.invoiceInfo').hide(); if (this.value == 'credit') { if ($('input[name="cardKind"]:checked').length != 0) { $('input[name="cardKind"]:checked').change(); $('#internalCard').prop('checked', true); $('input[name=pg][value=kcp]').prop('checked', true); $('input[name=pg]:checked').change(); } else { $('select[name="cardType"]').html($('#cardExternal').html()); $('.externalInfo').show(); $('.internalInfo').hide(); $('input[name=pg][value=paygate]').removeAttr('disabled'); } } else if (this.value == 'bank') { $('input[name=pg][value=kcp]').prop('checked', true); } else if (this.value == 'transfer') { $('input[name=pg][value=kcp]').prop('checked', true); } }; $('input[type="radio"][name="pay_method"]').click(changePayMethod); if ($('#emoneyMethod').length) { $('#emoneyMethod').click(); $('#emoneyMethod').prop('checked', 'checked'); } else if ($('#balanceMethod').length) { $('#balanceMethod').click(); $('#balanceMethod').prop('checked', 'checked'); } else { $('#paypalMethod').click(); $('#paypalMethod').prop('checked', 'checked'); } $('input[name="cardKind"]').change(function() { var $this = $(this); if ($this.val() == 'internal') { $('select[name="cardType"]').html($('#cardInternal').html()); $('.externalInfo').hide(); $('.internalInfo').show(); $('input[name=pg][value=paygate]').removeAttr('disabled'); $('input[name=pg]:checked').change(); } else if ($this.val() == 'external'){ $('select[name="cardType"]').html($('#cardExternal').html()); $('.cardKindInfo').show(); $('.externalInfo').show(); $('.internalInfo').hide(); $('input[name=pg][value=paygate]').removeAttr('disabled'); } }); $('input[type="radio"][name="bill"]').change(function() { if (this.value == 'tax') { $('.billTaxFormTr').show(); if ($('input[name="companyInputType"]:checked').val() == 'exist' && $('#companyId').val() == '' && $('#companyId').children().length > 1) { $('#companyId').val($('#companyId option:last-child').val()); } fillBill(); } else if (this.value == 'none') { $('.billTaxFormTr').hide(); } }); $('input[type="radio"][name="companyInputType"]').change(function() { if (this.value == 'exist') { fillBill(); } else if (this.value == 'new') { clearBill(); } }); var autocomplete = function() { if ($('#autocomplete:checked').val() == 'on') { $('#name').val($('#userName').val()); $('#email').val($('#userEmail').val()); $('#phone').val($('#userPhone').val()); $('#handPhone').val($('#userHandPhone').val()); } }; $('#autocomplete').change(autocomplete); $('#company_update').change(function() { if ($(this).attr('checked') == 'checked') { $('#company_update').val('true'); } else { $('#company_update').val(''); } }); $('#companyId').change(function() { fillBill(); }); $('#changeBillInfo').click(function() { var request = $.ajax({ url: "/ajax/change_bill_info.php", type: "POST", data: { depositor: $('#depositor').val(), checkConfirm: $('#checkConfirm:checked').length, orderId: $('#orderId').val() } }); request.always(function(msg) { alert(LANG['alert_change_information']); $('#orderStatus').html(msg.status + ' ' + (msg.description || '')); $('.orderStatus').html(msg.status); if ($('#checkConfirm:checked').length > 0) { $('#orderStatus').parent().addClass('checkedtr'); $('.depositInfo').removeClass('checkedtr'); } else { $('#orderStatus').parent().removeClass('checkedtr'); $('.depositInfo').addClass('checkedtr'); } }); }); $('.paymethod input[type="radio"]:enabled').first().click(); $('#billNone').click(); $('#billNone').prop('checked', 'checked'); $('#autocomplete').prop('checked', 'checked'); autocomplete(); $('.billTaxFormTr').hide(); if ($('#existCompany:checked').val() !== undefined && $('#existCompany:checked').val() !== 'admin') { fillBill(); } $('select[name=cardType]').change(function() { if($('select[name=cardType] option.kcp:selected').length > 0) { $('input[name=pg][value=kcp]').prop('checked', true); $('input[name=pg][value=paygate]').prop('disabled', true); } else { $('input[name=pg][value=paygate]').removeAttr('disabled'); } }); $('input[name="pg"]').change(function() { if ($(this).val() == 'kcp') { $('.cardKindInfo').hide(); $('.bankSelectInfo').hide(); $('.invoiceInfo').hide(); } else if ($('input[name=pay_method]:checked').val() == 'credit') { $('.cardKindInfo').show(); } else if ($('input[name=pay_method]:checked').val() == 'bank') { $('.invoiceInfo').show(); $('.bankSelectInfo').show(); } }); if ($('input[name="pg"]').val() == 'kcp') { $('.cardKindInfo').hide(); } else if ($('input[name=pay_method]:checked').val() == 'credit') { $('.cardKindInfo').show(); } else if ($('input[name=pay_method]:checked').val() == 'bank') { $('.bankSelectInfo').show(); } }); function clearBill() { $('#companyName').val(''); $('#registrationNumberLeft').val(''); $('#registrationNumberMiddle').val(''); $('#registrationNumberRight').val(''); $('#secondaryRegistrationNumber').val(''); $('#representative').val(''); $('#companyLocation').val(''); $('#companyType').val(''); $('#companyCategory').val(''); $('#contact1Name').val(''); $('#contact1Email').val(''); $('#contact1Phone').val(''); $('#contact2Name').val(''); $('#contact2Email').val(''); $('#contact2Phone').val(''); $('#company_update').val('true'); } function fillBill() { var id = $('#companyId').val(); if (!id) { clearBill(); } else { var registrationNumber = $('#registrationNumber_' + id).val(); registrationNumberToken = (registrationNumber || '').split('-'); $('#companyName').val($('#companyName_' + id).val()); $('#registrationNumberLeft').val(registrationNumberToken[0]); $('#registrationNumberMiddle').val(registrationNumberToken[1]); $('#registrationNumberRight').val(registrationNumberToken[2]); $('#secondaryRegistrationNumber').val($('#secondaryRegistrationNumber_' + id).val()); $('#representative').val($('#representative_' + id).val()); $('#companyLocation').val($('#company_location_' + id).val()); $('#companyType').val($('#company_type_' + id).val()); $('#companyCategory').val($('#company_category_' + id).val()); $('#contact1Name').val($('#contact1_name_' + id).val()); $('#contact1Email').val($('#contact1_email_' + id).val()); $('#contact1Phone').val($('#contact1_phone_' + id).val()); $('#contact2Name').val($('#contact2_name_' + id).val()); $('#contact2Email').val($('#contact2_email_' + id).val()); $('#contact2Phone').val($('#contact2_phone_' + id).val()); $('#existCompany').attr('checked', true); if ($('#company_update').attr('checked') == 'checked') { $('#company_update').val('true'); } else { $('#company_update').val(''); } } } function toggleBillForm(token) { $('.billTaxChecker.form tr').each(function() { if ($(this).hasClass('billTaxCheckerHead') != true) { if (token == 'show') { $(this).show(); } else { $(this).hide(); } } }); } function chargeEmoney(money, instantKey) { "use strict"; var wrap = $('
'); var height = 0; money = money || 0; height = 700; var target = '/body/payment/cash.html?amount=' + money; if (instantKey) { target += '&instantKey=' + instantKey; } else { var params = $('input[name=instantKey]').val(); if (params) { target += '&instantKey=' + params; } } openMessageBox(''); var $iframe = $('#messageBoxDisplay_emoney'); $iframe.one('load', function() { var iframe = $iframe[0]; var doc = iframe.contentDocument || iframe.contentWindow.document; }); } var yellowButton = { "background": "#F5E100", "height": "40px", "width": "110px", "font-size": "17px", "font-weight": "bold" }; var blueButton = { "width": "110px", "height": "40px", "font-size": "1.3em", "background-color": "#24589B", "color": "#fff", "font-weight": "bold" }; var formButton = { "width": "", "font-weight": "normal", "font-size": "10pt", "background": "#D6E7EF", "border-bottom": "1px solid #104A7B", "border-right": "1px solid #104A7B", "border-left": "1px solid #AFC4D5", "border-top": "1px solid #AFC4D5", "color": "#000066", "height": "25px", "text-decoration": "none", "cursor": "pointer", "vertical-align": "baseline" };