Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/wbs24.ozonapinew/ |
Upload File : |
class Wbs24OzonapinewRfbsStatuses { debug = false; constructor(accountIndex, postingNumber, langPhrazes) { this.accountIndex = accountIndex; this.postingNumber = postingNumber; this.langPhrazes = langPhrazes; this.buttons = { 'status_delivering': document.querySelector(".wbs24_status-delivering"), 'status_last-mile': document.querySelector(".wbs24_status-last-mile"), 'status_delivered': document.querySelector(".wbs24_status-delivered"), } } run() { for (const key in this.buttons) { this.statusChangeHandler(key, this.buttons[key], this.postingNumber); } } statusChangeHandler(action, statusButton, postingNumber) { let accountIndex = this.accountIndex; let langPhrazes = this.langPhrazes; statusButton.onclick = async (e) => { e.preventDefault(); let url = '/bitrix/tools/wbs24.ozonapinew/ajax.php?ACTION=' + action + '&posting_number=' + postingNumber + '&account_index=' + accountIndex ; let response = await fetch(url); let responseText = await response.text(); let data = JSON.parse(responseText); let responseHtml = document.querySelector(".js-rfbs-" + action); if (responseHtml) { responseHtml.style.padding = '5px'; responseHtml.style.borderRadius = '3px'; if (data['result'] == 'success') { responseHtml.style.backgroundColor = 'green'; responseHtml.innerHTML = langPhrazes.success; statusButton.setAttribute('disabled', true); } else { responseHtml.style.backgroundColor = 'red'; responseHtml.innerHTML = langPhrazes.error; } } }; } }