![]() 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/ups/step-two/ |
/** * @api */ require(['jquery', 'Extmag_Shiplab/js/latinize', 'Extmag_Shiplab/js/depends', 'Magento_Ui/js/modal/modal', 'mage/translate', 'domReady!'], function ($, latinize, frontDepends) { 'use strict'; $('body').on('click', '.access-point-get-point', function () { let addressJson = $(this).attr("data-addressjson"); let modaltitle = $(this).attr("data-modaltitle"); let carrier = $(this).attr("data-carrier"); if (addressJson.length > 0) { openPopupAP(addressJson, modaltitle, carrier); } else { console.log("Error: Customer Address is wrong"); } }); function openPopupAP(addressJson, modalTitle, carrier) { let modalDialog = $('<div class="ui-dialog-content ui-widget-content"></div>').modal({ type: 'popup', modalClass: 'edit-ap-popup', title: $.mage.__(modalTitle), }), address = JSON.parse(addressJson), AddressRequestLine = []; if (address['city'].length > 0) { AddressRequestLine[AddressRequestLine.length] = 'city=' + encodeURIComponent(latinize.latinize(address['city'])); } if (address['state_code'] && 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 frame; let callbackUrl = encodeURIComponent($('.access-point-get-point').attr("data-callbackurl") + "?"); frame = $('<iframe src="' + $('.access-point-get-point').attr("data-iframeurl") + '?oId=' + (Math.floor(Math.random() * 1000000) + 1) + '&cburl=' + callbackUrl + '&' + AddressRequestLine.join("&") + frontDepends.getCarrierUrlParams(carrier, address) + '" style="width:100%; height: 77vh" frameborder="0"></iframe>'); modalDialog.html(frame).modal('openModal'); } window.setAccessPointAddress = setAccessPointAddress; window.closeAccessPointPopup = closeAccessPointPopup; function setAccessPointAddress(jsonData) { $('input[name="access_point_id"]').val(jsonData['appuId']).change(); $('input[name="access_point_name"]').val(jsonData['name']).change(); $('input[name="access_point_street_1"]').val(jsonData['addLine1']).change(); if (jsonData['addLine2']) { $('input[name="access_point_street_2"]').val(jsonData['addLine2']).change(); } if (jsonData['addLine3']) { $('input[name="access_point_street_3"]').val(jsonData['addLine3']).change(); } $('input[name="access_point_city"]').val(jsonData['city']).change(); $('input[name="access_point_postal_code"]').val(jsonData['postal']).change(); $('input[name="access_point_country_code"]').val(jsonData['country']).change(); if (jsonData['state']) { $('input[name="access_point_state_code"]').val(jsonData['state']).change(); } closeAccessPointPopup(); } function closeAccessPointPopup() { $('button.action-close').trigger("click"); } });