Dodano obsługę nowych metod wysyłki: D2P Apaczka, P2P Apaczka oraz P2P Orlen, zaktualizowano logikę ustawiania preferencji wysyłki.
This commit is contained in:
77
apilo.js
77
apilo.js
@@ -181,12 +181,18 @@ if (pattern.test(currentUrl2)) {
|
||||
const buttonD2P = createButton('Inpost D2P', '#28a745', 'D2P.inpost');
|
||||
const buttonP2P = createButton('Inpost P2P', '#ffc107', 'P2P.inpost', 'RZE14N||RZE14N');
|
||||
const buttonD2Dapaczka = createButton('D2D Apaczka', '#ff7800', 'D2D.apaczka');
|
||||
const buttonD2PApaczka = createButton('D2P Apaczka', '#28a745', 'D2P.apaczka');
|
||||
const buttonP2Papaczka = createButton('P2P Apaczka', '#ffc107', 'P2P.apaczka');
|
||||
const buttonOrlen = createButton('Orlen', 'rgb(255, 7, 193)', 'P2P.orlen');
|
||||
|
||||
buttonContainer.appendChild(buttonP2D);
|
||||
// buttonContainer.appendChild(buttonP2D);
|
||||
buttonContainer.appendChild(buttonD2Dapaczka);
|
||||
buttonContainer.appendChild(buttonD2PApaczka);
|
||||
buttonContainer.appendChild(buttonP2Papaczka);
|
||||
buttonContainer.appendChild(buttonOrlen);
|
||||
// buttonContainer.appendChild(buttonD2D);
|
||||
buttonContainer.appendChild(buttonD2P);
|
||||
buttonContainer.appendChild(buttonP2P);
|
||||
// buttonContainer.appendChild(buttonD2P);
|
||||
// buttonContainer.appendChild(buttonP2P);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +251,7 @@ function retryUntilSuccess(fn, interval = 1000, retries = 10) {
|
||||
}
|
||||
|
||||
function setContent( method ) {
|
||||
if ( method == 'D2D.apaczka' ) {
|
||||
if ( method == 'D2D.apaczka' || method == 'D2P.apaczka' || method == 'P2P.apaczka' || method == 'P2P.orlen' ) {
|
||||
return retryUntilSuccess(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const selectElement = document.getElementById('warehousebundle_shipment_preferences_content');
|
||||
@@ -263,7 +269,66 @@ function selectPackageType(method) {
|
||||
return retryUntilSuccess(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
if ( method == 'D2D.apaczka' ) {
|
||||
if ( method == 'P2P.orlen' ) {
|
||||
|
||||
//warehousebundle_shipment_carrierAccount
|
||||
const selectElement = document.getElementById('warehousebundle_shipment_carrierAccount');
|
||||
selectElement.value = 17;
|
||||
const event = document.createEvent('HTMLEvents');
|
||||
event.initEvent('change', true, false);
|
||||
selectElement.dispatchEvent(event);
|
||||
|
||||
// settimeout
|
||||
setTimeout(() => {
|
||||
const selectElement2 = document.getElementById('warehousebundle_shipment_method');
|
||||
selectElement2.value = 50;
|
||||
const event2 = document.createEvent('HTMLEvents');
|
||||
event2.initEvent('change', true, false);
|
||||
selectElement2.dispatchEvent(event2);
|
||||
|
||||
// settimeout
|
||||
setTimeout(() => {
|
||||
const selectElement3 = document.getElementById('warehousebundle_shipment_preferences_packageType');
|
||||
selectElement3.value = 'PACZKA';
|
||||
const event3 = document.createEvent('HTMLEvents');
|
||||
event3.initEvent('change', true, false);
|
||||
selectElement3.dispatchEvent(event3);
|
||||
resolve();
|
||||
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
|
||||
} else if ( method == 'D2P.apaczka' || method == 'P2P.apaczka' ) {
|
||||
|
||||
//warehousebundle_shipment_carrierAccount
|
||||
const selectElement = document.getElementById('warehousebundle_shipment_carrierAccount');
|
||||
selectElement.value = 17;
|
||||
const event = document.createEvent('HTMLEvents');
|
||||
event.initEvent('change', true, false);
|
||||
selectElement.dispatchEvent(event);
|
||||
|
||||
// settimeout
|
||||
setTimeout(() => {
|
||||
const selectElement2 = document.getElementById('warehousebundle_shipment_method');
|
||||
selectElement2.value = 41;
|
||||
const event2 = document.createEvent('HTMLEvents');
|
||||
event2.initEvent('change', true, false);
|
||||
selectElement2.dispatchEvent(event2);
|
||||
|
||||
// settimeout
|
||||
setTimeout(() => {
|
||||
const selectElement3 = document.getElementById('warehousebundle_shipment_preferences_packageType');
|
||||
selectElement3.value = 'PACZKA';
|
||||
const event3 = document.createEvent('HTMLEvents');
|
||||
event3.initEvent('change', true, false);
|
||||
selectElement3.dispatchEvent(event3);
|
||||
resolve();
|
||||
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
|
||||
|
||||
} else if ( method == 'D2D.apaczka' ) {
|
||||
|
||||
const selectElement = document.getElementById('warehousebundle_shipment_carrierAccount');
|
||||
selectElement.value = 17;
|
||||
@@ -308,7 +373,7 @@ function selectPackageType(method) {
|
||||
}
|
||||
|
||||
function setShipmentMethod(method) {
|
||||
if ( method == 'D2D.apaczka' ) {
|
||||
if ( method == 'D2D.apaczka' || method == 'D2P.apaczka' || method == 'P2P.apaczka' || method == 'P2P.orlen' ) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user