597 lines
23 KiB
JavaScript
597 lines
23 KiB
JavaScript
// ==UserScript==
|
|
// @name A
|
|
// @version 2.2
|
|
// @grant none
|
|
// ==/UserScript==
|
|
|
|
(function() {
|
|
'use strict';
|
|
|
|
const currentUrl = window.location.href;
|
|
|
|
const patterns = [
|
|
/^https:\/\/projectpro\.apilo\.com\/order\/order\/news\/?$/,
|
|
/^https:\/\/projectpro\.apilo\.com\/order\/order\/in-progress\/?$/,
|
|
/^https:\/\/projectpro\.apilo\.com\/order\/order\/to-send\/?$/,
|
|
/^https:\/\/projectpro\.apilo\.com\/order\/order\/completed\/?$/,
|
|
/^https:\/\/projectpro\.apilo\.com\/order\/order\/all\/?$/
|
|
];
|
|
|
|
const orderDetailUrlPattern = /https:\/\/projectpro\.apilo\.com\/order\/order\/detail\/.*\?static=shipment/;
|
|
if (orderDetailUrlPattern.test(currentUrl)) {
|
|
handlePrintButton();
|
|
}
|
|
|
|
function handlePrintButton() {
|
|
const checkInterval = 250;
|
|
const maxRetries = 20;
|
|
let attempts = 0;
|
|
|
|
const intervalId = setInterval(() => {
|
|
const alertElevateElements = document.querySelectorAll('.alert-elevate');
|
|
if (alertElevateElements.length > 0) {
|
|
let printButtons = [];
|
|
alertElevateElements.forEach(alert => {
|
|
const buttons = Array.from(alert.querySelectorAll('a')).filter(button => button.textContent.trim() === "Drukuj");
|
|
printButtons = printButtons.concat(buttons);
|
|
});
|
|
|
|
if (printButtons.length > 0) {
|
|
clearInterval(intervalId);
|
|
const lastPrintButton = printButtons[printButtons.length - 1];
|
|
lastPrintButton.click();
|
|
waitForModalAndClickXprinter();
|
|
}
|
|
}
|
|
|
|
attempts++;
|
|
if (attempts > maxRetries) {
|
|
clearInterval(intervalId);
|
|
console.error("Nie znaleziono przycisku 'Drukuj' po maksymalnej liczbie prób.");
|
|
}
|
|
}, checkInterval);
|
|
}
|
|
|
|
function waitForModalAndClickXprinter() {
|
|
const modalCheckInterval = 250;
|
|
const maxModalRetries = 20;
|
|
let modalAttempts = 0;
|
|
|
|
const modalIntervalId = setInterval(() => {
|
|
const modal = document.querySelector('.modal');
|
|
if (modal) {
|
|
const xprinterButton = Array.from(modal.querySelectorAll('a')).find(button => button.textContent.trim() === "Xprinter XP-420B");
|
|
if (xprinterButton) {
|
|
clearInterval(modalIntervalId);
|
|
xprinterButton.click();
|
|
}
|
|
}
|
|
|
|
modalAttempts++;
|
|
if (modalAttempts > maxModalRetries) {
|
|
clearInterval(modalIntervalId);
|
|
console.error("Nie znaleziono przycisku 'Xprinter XP-420B' po maksymalnej liczbie prób.");
|
|
}
|
|
}, modalCheckInterval);
|
|
}
|
|
|
|
if (patterns.some(pattern => pattern.test(currentUrl))) {
|
|
waitForElement('.dataTables_scrollBody').then(() => {
|
|
waitForTableAndSetImage();
|
|
attachTableReloadListener();
|
|
}).catch(error => {
|
|
console.error('Nie udało się znaleźć elementu .dataTables_scrollBody:', error);
|
|
});
|
|
}
|
|
|
|
const currentUrl2 = window.location.href;
|
|
const patternWarehouse = /^https:\/\/projectpro\.apilo\.com\/warehouse\/shipment\/new-for-order\/.+/;
|
|
|
|
if (patternWarehouse.test(currentUrl2)) {
|
|
waitForElement('.kt-portlet__body').then(portletBody => {
|
|
const buttonContainer = createButtonContainer();
|
|
portletBody.parentNode.insertBefore(buttonContainer, portletBody);
|
|
|
|
const buttons = [
|
|
createButton('Apaczka D2D Inpost', '#7039df', 'ApaczkaD2D'),
|
|
createButton('Apaczka P2P Inpost', '#7039df', 'ApaczkaP2P'),
|
|
createButton('Furgonetka P2D Inpost', '#ff7800', 'P2D.inpost', 'RZE14N||RZE14N'),
|
|
createButton('Furgonetka D2P Inpost', '#ff7800', 'D2P.inpost'),
|
|
createButton('Furgonetka D2D Inpost', '#ff7800', 'D2D.inpostkurier'),
|
|
createButton('Furgonetka P2P Inpost', '#ff7800', 'P2P.inpost', 'RZE14N||RZE14N')
|
|
];
|
|
|
|
buttons.forEach(button => buttonContainer.appendChild(button));
|
|
}).catch(error => {
|
|
console.error('Nie udało się znaleźć elementu .kt-portlet__body:', error);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja oczekująca na pojawienie się elementu w DOM.
|
|
* @param {string|Element} selector - Selektor CSS lub bezpośredni element.
|
|
* @param {number} interval - Czas oczekiwania między próbami w ms.
|
|
* @param {number} retries - Maksymalna liczba prób.
|
|
* @returns {Promise<Element>} - Obietnica z elementem lub odrzucenie.
|
|
*/
|
|
function waitForElement(selector, interval = 500, retries = 10) {
|
|
return retryUntilSuccess(() => {
|
|
return new Promise((resolve, reject) => {
|
|
let element;
|
|
if (typeof selector === 'string') {
|
|
element = document.querySelector(selector);
|
|
} else if (selector instanceof Element) {
|
|
element = selector;
|
|
}
|
|
|
|
if (element) {
|
|
resolve(element);
|
|
} else {
|
|
reject(`Element nie znaleziony: ${selector}`);
|
|
}
|
|
});
|
|
}, interval, retries);
|
|
}
|
|
|
|
/**
|
|
* Funkcja retryUntilSuccess próbuje wykonać funkcję do skutku z określonymi interwałami i limitami prób.
|
|
* @param {Function} fn - Funkcja zwracająca obietnicę.
|
|
* @param {number} interval - Czas oczekiwania między próbami w ms.
|
|
* @param {number} retries - Maksymalna liczba prób.
|
|
* @returns {Promise} - Obietnica rozwiązana lub odrzucona.
|
|
*/
|
|
function retryUntilSuccess(fn, interval = 500, retries = 10) {
|
|
return new Promise((resolve, reject) => {
|
|
const attempt = async () => {
|
|
try {
|
|
console.log(`Próba wykonania funkcji. Pozostało prób: ${retries}`);
|
|
const result = await fn();
|
|
resolve(result);
|
|
} catch (err) {
|
|
if (retries === 0) {
|
|
console.error('Maksymalna liczba prób osiągnięta. Funkcja nie powiodła się:', err);
|
|
reject(err);
|
|
} else {
|
|
console.warn(`Nie znaleziono elementu. Próba ponowna za ${interval} ms. Pozostało prób: ${retries}`);
|
|
setTimeout(() => {
|
|
retries--;
|
|
attempt();
|
|
}, interval);
|
|
}
|
|
}
|
|
};
|
|
attempt();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja oczekująca na pojawienie się tabeli i ustawiająca obrazki.
|
|
*/
|
|
function waitForTableAndSetImage() {
|
|
waitForElement('.dataTables_scrollBody').then(() => {
|
|
const dataTables_tbody = document.querySelector('.dataTables_scrollBody tbody');
|
|
const rows = dataTables_tbody ? dataTables_tbody.getElementsByTagName('tr') : [];
|
|
|
|
if (rows.length > 0) {
|
|
setImageToProduct();
|
|
} else {
|
|
console.warn('Brak wierszy w tabeli. Czekam na pojawienie się danych...');
|
|
// Można dodać dodatkowe logiki tutaj, jeśli potrzebne
|
|
}
|
|
}).catch(error => {
|
|
console.error('Nie udało się znaleźć tabeli .dataTables_scrollBody:', error);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja dołączająca nasłuchiwacz na zmiany w tabeli.
|
|
*/
|
|
function attachTableReloadListener() {
|
|
waitForElement('.dataTables_scrollBody table').then(table => {
|
|
const observer = new MutationObserver((mutationsList, observer) => {
|
|
for (const mutation of mutationsList) {
|
|
if (mutation.type === 'childList') {
|
|
console.log('Zawartość tabeli została zmieniona.');
|
|
waitForTableAndSetImage();
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
|
|
const tbody = table.querySelector('tbody');
|
|
if (tbody) {
|
|
observer.observe(tbody, { childList: true, subtree: true });
|
|
console.log('Obserwator zmian w tabeli został ustawiony.');
|
|
} else {
|
|
console.warn('Nie znaleziono tbody w tabeli.');
|
|
}
|
|
}).catch(error => {
|
|
console.error('Nie udało się znaleźć tabeli do dołączenia obserwatora:', error);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca obrazki do produktów.
|
|
* @param {string} img - URL obrazka (opcjonalny).
|
|
*/
|
|
function setImageToProduct(img = '') {
|
|
waitForElement('.dataTables_scrollBody').then(dataTablesScrollBody => {
|
|
const dataTables_tbody = dataTablesScrollBody.querySelector('tbody');
|
|
const rows = dataTables_tbody ? dataTables_tbody.getElementsByTagName('tr') : [];
|
|
|
|
for (let i = 0; i < rows.length; i++) {
|
|
const cells = rows[i].getElementsByTagName('td');
|
|
|
|
if (cells.length > 1) {
|
|
const secondCellText = cells[1].textContent.trim();
|
|
let domain;
|
|
|
|
if (secondCellText.includes('marianek.pl')) {
|
|
domain = 'marianek.pl';
|
|
} else if (secondCellText.includes('pomysloweprezenty.pl')) {
|
|
domain = 'pomysloweprezenty.pl';
|
|
} else {
|
|
continue;
|
|
}
|
|
|
|
if (cells.length >= 5) {
|
|
const fifthCell = cells[4];
|
|
const divsInFifthCell = fifthCell.children;
|
|
|
|
for (let j = 0; j < divsInFifthCell.length; j++) {
|
|
const currentDiv = divsInFifthCell[j];
|
|
const imgDiv = currentDiv.getElementsByTagName('div')[0];
|
|
const dataDiv = currentDiv.getElementsByTagName('div')[1];
|
|
|
|
if (dataDiv) {
|
|
const skuMatch = dataDiv.innerHTML.match(/SKU:\s*([A-Za-z0-9-]+)/);
|
|
|
|
if (skuMatch && skuMatch[1]) {
|
|
const sku = skuMatch[1];
|
|
getProductData(sku, domain).then(data => {
|
|
if (!data) {
|
|
console.log('Produkt nie znaleziony:', sku);
|
|
return;
|
|
}
|
|
|
|
console.log('Produkt znaleziony:', sku);
|
|
imgDiv.innerHTML = '';
|
|
const imgElement = makeImg(data);
|
|
imgDiv.appendChild(imgElement);
|
|
|
|
// Dodanie eventu na hover
|
|
imgElement.addEventListener('mouseover', () => {
|
|
showLargeImage(data, imgElement);
|
|
});
|
|
|
|
imgElement.addEventListener('mouseout', hideLargeImage);
|
|
}).catch(error => {
|
|
console.error('Błąd podczas pobierania danych produktu:', error);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}).catch(error => {
|
|
console.error('Nie udało się ustawić obrazków do produktów:', error);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja tworząca element obrazka.
|
|
* @param {string} src - URL obrazka.
|
|
* @returns {HTMLImageElement} - Element img.
|
|
*/
|
|
function makeImg(src = 'https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png') {
|
|
const img = document.createElement('img');
|
|
img.src = src;
|
|
img.alt = 'image';
|
|
img.className = 'img-fluid center-block';
|
|
img.style.maxWidth = '48px';
|
|
img.style.maxHeight = '48px';
|
|
img.style.cursor = 'pointer';
|
|
|
|
return img;
|
|
}
|
|
|
|
/**
|
|
* Funkcja pokazująca powiększony obrazek przy najechaniu kursorem.
|
|
* @param {string} src - URL dużego obrazka.
|
|
* @param {HTMLImageElement} imgElement - Element img, na którym najechano.
|
|
*/
|
|
function showLargeImage(src, imgElement) {
|
|
const existingLargeImg = document.getElementById('largeImagePreview');
|
|
if (existingLargeImg) {
|
|
existingLargeImg.remove();
|
|
}
|
|
|
|
const largeImg = document.createElement('img');
|
|
largeImg.src = src;
|
|
largeImg.style.position = 'absolute';
|
|
largeImg.style.maxWidth = '400px';
|
|
largeImg.style.maxHeight = '400px';
|
|
largeImg.style.border = '1px solid #ccc';
|
|
largeImg.style.background = '#fff';
|
|
largeImg.style.zIndex = '1000';
|
|
largeImg.style.top = (imgElement.getBoundingClientRect().top + window.scrollY) + 'px';
|
|
largeImg.style.left = (imgElement.getBoundingClientRect().left + imgElement.offsetWidth + 10) + 'px';
|
|
largeImg.id = 'largeImagePreview';
|
|
|
|
document.body.appendChild(largeImg);
|
|
}
|
|
|
|
/**
|
|
* Funkcja ukrywająca powiększony obrazek.
|
|
*/
|
|
function hideLargeImage() {
|
|
const largeImg = document.getElementById('largeImagePreview');
|
|
if (largeImg) {
|
|
largeImg.remove();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Funkcja pobierająca dane produktu na podstawie SKU i domeny.
|
|
* @param {string} sku - SKU produktu.
|
|
* @param {string} domain - Domena (marianek.pl lub pomysloweprezenty.pl).
|
|
* @returns {Promise<string|null>} - URL obrazka lub null w przypadku błędu.
|
|
*/
|
|
async function getProductData(sku, domain) {
|
|
let url;
|
|
if (domain === 'marianek.pl') {
|
|
url = `https://marianek.pl/api/v1/product.php?sku=${sku}`;
|
|
} else if (domain === 'pomysloweprezenty.pl') {
|
|
url = `https://pomysloweprezenty.pl/api/v1/product.php?sku=${sku}`;
|
|
} else {
|
|
console.error('Niewspierana domena:', domain);
|
|
return null;
|
|
}
|
|
|
|
try {
|
|
const response = await fetch(url);
|
|
if (!response.ok) {
|
|
throw new Error(`Błąd HTTP! status: ${response.status}`);
|
|
}
|
|
|
|
const data = await response.json();
|
|
console.log('Dane produktu:', data);
|
|
return data.img || null;
|
|
} catch (error) {
|
|
console.error('Błąd podczas pobierania danych produktu:', url, error);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Funkcja tworząca kontener na przyciski.
|
|
* @returns {HTMLDivElement} - Kontener z przyciskami.
|
|
*/
|
|
function createButtonContainer() {
|
|
const buttonContainer = document.createElement('div');
|
|
buttonContainer.className = 'custom-button-container';
|
|
buttonContainer.style.display = 'flex';
|
|
buttonContainer.style.gap = '10px';
|
|
buttonContainer.style.marginBottom = '15px';
|
|
return buttonContainer;
|
|
}
|
|
|
|
/**
|
|
* Funkcja tworząca przycisk.
|
|
* @param {string} text - Tekst na przycisku.
|
|
* @param {string} backgroundColor - Kolor tła przycisku.
|
|
* @param {string} method - Metoda wysyłki.
|
|
* @param {string|null} dropoffPoint - Punkt odbioru (opcjonalny).
|
|
* @returns {HTMLButtonElement} - Element przycisku.
|
|
*/
|
|
function createButton(text, backgroundColor, method, dropoffPoint = null) {
|
|
const button = document.createElement('button');
|
|
button.textContent = text;
|
|
button.style.background = backgroundColor;
|
|
button.style.display = 'inline-flex';
|
|
button.style.width = '200px';
|
|
button.style.height = '40px';
|
|
button.style.alignItems = 'center';
|
|
button.style.justifyContent = 'center';
|
|
button.style.color = '#FFF';
|
|
button.style.border = 'none';
|
|
button.style.cursor = 'pointer';
|
|
button.style.borderRadius = '4px';
|
|
button.style.fontSize = '14px';
|
|
|
|
button.addEventListener('click', () => handleShipment(method, dropoffPoint));
|
|
|
|
return button;
|
|
}
|
|
|
|
/**
|
|
* Funkcja obsługująca kliknięcie przycisku wysyłki.
|
|
* @param {string} method - Metoda wysyłki.
|
|
* @param {string|null} dropoffPoint - Punkt odbioru (opcjonalny).
|
|
*/
|
|
async function handleShipment(method, dropoffPoint = null) {
|
|
try {
|
|
if (method.startsWith('Apaczka')) {
|
|
console.log('Ustawianie wysyłki Apaczka...');
|
|
await setCarrierAccount();
|
|
await setShipmentMethodApaczka(method);
|
|
|
|
if (method === 'ApaczkaP2P') {
|
|
await setDropoffPoint('RZE14N||RZE14N');
|
|
}
|
|
|
|
await setPreferencesContentApaczka();
|
|
await setParcelWeight('1');
|
|
await submitShipment();
|
|
} else {
|
|
console.log(`Ustawianie wysyłki metodą: ${method}`);
|
|
await selectPackageType();
|
|
await setShipmentMethod(method);
|
|
if (dropoffPoint) {
|
|
await setDropoffPoint(dropoffPoint);
|
|
}
|
|
await setParcelWeight('1');
|
|
await submitShipment();
|
|
}
|
|
console.log('Wysyłka została pomyślnie ustawiona.');
|
|
} catch (error) {
|
|
console.error('Wystąpił błąd podczas ustawiania wysyłki:', error);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca konto przewoźnika.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function setCarrierAccount() {
|
|
return retryUntilSuccess(() => {
|
|
return new Promise((resolve, reject) => {
|
|
const carrierAccountElement = document.getElementById('warehousebundle_shipment_carrierAccount');
|
|
if (carrierAccountElement) {
|
|
carrierAccountElement.value = '17';
|
|
const event = new Event('change', { bubbles: true });
|
|
carrierAccountElement.dispatchEvent(event);
|
|
console.log('Konto przewoźnika ustawione na 17.');
|
|
resolve();
|
|
} else {
|
|
reject('Nie znaleziono elementu warehousebundle_shipment_carrierAccount');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca metodę wysyłki na podstawie typu Apaczki.
|
|
* Upewnia się, że select nie jest pusty przed ustawieniem wartości.
|
|
* @param {string} method - Typ Apaczki ('ApaczkaD2D' lub 'ApaczkaP2P').
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function setShipmentMethodApaczka(method) {
|
|
return retryUntilSuccess(() => {
|
|
return new Promise((resolve, reject) => {
|
|
const methodElement = document.getElementById('warehousebundle_shipment_method'); console.log( methodElement );
|
|
if (methodElement) {
|
|
if (methodElement.options.length > 0) {
|
|
methodElement.value = (method === 'ApaczkaP2P') ? '41' : '42';
|
|
const event = new Event('change', { bubbles: true });
|
|
methodElement.dispatchEvent(event);
|
|
console.log(`Metoda wysyłki ustawiona na ${(method === 'ApaczkaP2P') ? '49 (ApaczkaP2P)' : '42 (ApaczkaD2D)'}.`);
|
|
resolve();
|
|
} else {
|
|
reject('Select #warehousebundle_shipment_method jest pusty.');
|
|
}
|
|
} else {
|
|
reject('Nie znaleziono elementu warehousebundle_shipment_method');
|
|
}
|
|
});
|
|
}, 500, 20).catch(error => {
|
|
console.error('Nie udało się ustawić metody wysyłki:', error);
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca preferencje zawartości na "prezent" dla Apaczki.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function setPreferencesContentApaczka() {
|
|
return retryUntilSuccess(() => {
|
|
return new Promise((resolve, reject) => {
|
|
const contentElement = document.getElementById('warehousebundle_shipment_preferences_content');
|
|
if (contentElement) {
|
|
contentElement.value = 'prezent';
|
|
const event = new Event('input', { bubbles: true });
|
|
contentElement.dispatchEvent(event);
|
|
console.log('Preferencje zawartości ustawione na "prezent".');
|
|
resolve();
|
|
} else {
|
|
reject('Nie znaleziono elementu warehousebundle_shipment_preferences_content');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca typ paczki dla innych metod niż Apaczka.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function selectPackageType() {
|
|
return waitForElement('#warehousebundle_shipment_packageType').then(selectElement => {
|
|
selectElement.value = 'package';
|
|
const event = new Event('change', { bubbles: true });
|
|
selectElement.dispatchEvent(event);
|
|
console.log('Typ paczki ustawiony na package.');
|
|
}).catch(error => {
|
|
console.error('Nie udało się ustawić typu paczki:', error);
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca metodę wysyłki.
|
|
* @param {string} method - Metoda wysyłki do ustawienia.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function setShipmentMethod(method) {
|
|
return waitForElement('#warehousebundle_shipment_method').then(methodElement => {
|
|
methodElement.value = method;
|
|
const event = new Event('change', { bubbles: true });
|
|
methodElement.dispatchEvent(event);
|
|
console.log(`Metoda wysyłki ustawiona na ${method}.`);
|
|
}).catch(error => {
|
|
console.error('Nie udało się ustawić metody wysyłki:', error);
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca punkt odbioru.
|
|
* @param {string} dropoffPoint - Punkt odbioru do ustawienia.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function setDropoffPoint(dropoffPoint) {
|
|
return waitForElement('#warehousebundle_shipment_preferences_dropoffPoint').then(dropoffPointElement => {
|
|
dropoffPointElement.value = dropoffPoint;
|
|
const event = new Event('change', { bubbles: true });
|
|
dropoffPointElement.dispatchEvent(event);
|
|
console.log(`Punkt odbioru ustawiony na ${dropoffPoint}.`);
|
|
}).catch(error => {
|
|
console.error('Nie udało się ustawić punktu odbioru:', error);
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja ustawiająca wagę paczki.
|
|
* @param {string} weight - Waga paczki do ustawienia.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function setParcelWeight(weight) {
|
|
return waitForElement('#warehousebundle_shipment_shipmentParcels_0_weight').then(weightElement => {
|
|
weightElement.value = weight;
|
|
const event = new Event('change', { bubbles: true });
|
|
weightElement.dispatchEvent(event);
|
|
console.log(`Waga paczki ustawiona na ${weight}.`);
|
|
}).catch(error => {
|
|
console.error('Nie udało się ustawić wagi paczki:', error);
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Funkcja wysyłająca formularz wysyłki.
|
|
* @returns {Promise<void>}
|
|
*/
|
|
function submitShipment() {
|
|
return waitForElement('#warehousebundle_shipment_buttons_submit').then(submitButton => {
|
|
submitButton.click();
|
|
console.log('Przycisk submit został kliknięty.');
|
|
}).catch(error => {
|
|
console.error('Nie udało się znaleźć przycisku submit:', error);
|
|
throw error;
|
|
});
|
|
}
|
|
|
|
})();
|