![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/extmag/shiplab/view/adminhtml/web/js/order/create/ |
/** * @api */ define(['jquery', 'Extmag_Shiplab/js/latinize', 'Extmag_Shiplab/js/depends', 'Magento_Ui/js/modal/modal', 'mage/translate'], function ($, latinize, frontDepends) { 'use strict'; var ExtmagAccessPoint = { startAction: function () { let address = {}, addressType = 'shipping_address'; if ($('[name="shipping_same_as_billing"]').prop("checked")) { addressType = 'billing_address'; } address['city'] = $('[name="order[' + addressType + '][city]"]').val(); address['state_code'] = $('[name="order[' + addressType + '][region]"]').val(); if (!address['state_code']) { address['state_code'] = $('[name="order[' + addressType + '][region_id]"]').val(); } address['postal_code'] = $('[name="order[' + addressType + '][postcode]"]').val(); address['country_code'] = $('[name="order[' + addressType + '][country_id]"]').val(); this.openPopupAP(address); }, openPopupAP: function (address) { let carrierCode = $('[name="order[shipping_method]"]:checked').attr("data-access_point_carrier_code"); let modalDialog = $('<div class="ui-dialog-content ui-widget-content"></div>').modal({ type: 'popup', modalClass: 'edit-ap-popup', title: frontDepends.getPopupTitle(carrierCode), }), AddressRequestLine = []; if (address['city'].length > 0) { AddressRequestLine[AddressRequestLine.length] = 'city=' + encodeURIComponent(latinize.latinize(address['city'])); } if (address['state_code'].length > 0) { AddressRequestLine[AddressRequestLine.length] = 'state=' + encodeURIComponent(latinize.latinize(address['state_code'])); } if (address['postal_code'].length > 0) { AddressRequestLine[AddressRequestLine.length] = 'postal=' + encodeURIComponent(latinize.latinize(address['postal_code'])); } if (address['country_code'].length > 0) { AddressRequestLine[AddressRequestLine.length] = 'country=' + encodeURIComponent(address['country_code']); AddressRequestLine[AddressRequestLine.length] = 'searchCountry=' + encodeURIComponent(address['country_code']); AddressRequestLine[AddressRequestLine.length] = 'countrySite=' + encodeURIComponent(address['country_code']); } let callbackUrl = encodeURIComponent($('[name="order[shipping_method]"]:checked').attr("data-callbackurl") + "?"); let frame = $('<iframe src="'+$('[name="order[shipping_method]"]:checked').attr("data-iframeurl")+'?oId=' + (Math.floor(Math.random() * 1000000) + 1) + '&cburl=' + callbackUrl + '&' + AddressRequestLine.join("&") + frontDepends.getCarrierUrlParams(carrierCode, address) + '" style="width:100%; height: 77vh" frameborder="0"></iframe>'); modalDialog.html(frame).modal('openModal'); }, setAccessPointAddress: function () { this.closeAccessPointPopup(); ExtmagAdminOrder.prototype.submitAP(); }, closeAccessPointPopup: function () { $('button.action-close').trigger("click"); } }; window.setAccessPointAddress = ExtmagAccessPoint.setAccessPointAddress; window.closeAccessPointPopup = ExtmagAccessPoint.closeAccessPointPopup; return ExtmagAccessPoint; });