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/modules/wbs24.ozonapinew/lib/ |
Upload File : |
<?php namespace Wbs24\Ozonapinew; use Bitrix\Main\SystemException; use Bitrix\Main\Localization\Loc; class RfbsStatuses { const STATUSES = [ 'delivering', 'last-mile', 'delivered' ]; public function __construct($objects = []) { $this->main = $objects['Main'] ?? new Main(); $this->moduleId = $this->main->getModuleId(); $this->wrappers = new Wrappers($objects); $this->suffix = strtoupper($this->moduleId); } protected function getTitle(): string { return '<tr class="heading">' .'<td colspan="2">' .'<div>'.Loc::getMessage($this->suffix . "." . "RFBS_TEXT").'</div>' .'</td>' .'</tr>' ; } public function getButtons($orderInfo): string { $statuses = self::STATUSES; $html = $this->getTitle(); foreach ($statuses as $status) { $clearStatus = str_replace('-', '_', $status); $html .= '<tr class="js-order-rfbs-status-tr">' .'<td>' .'<div style="display:flex;justify-content:end;align-items:center;">' .\ShowJSHint(Loc::getMessage($this->suffix. "." .strtoupper($status) . "_HINT"), ['return' => true]) .'<div style="padding-right:10px;margin-left:10px;">'. Loc::getMessage($this->suffix . "." . "BUTTON_TEXT") .'</div>' .'<input '.($orderInfo[$clearStatus . "_order_status"] ? "disabled" : "").' type="submit" class="wbs24_status-'. $status .'" value="'.Loc::getMessage($this->suffix. "." .strtoupper($status)).'">' .'</div>' .'</td>' .'<td>' .'<span class="js-rfbs-status_'. $status .'" style="'. ($orderInfo[$clearStatus . "_order_status"] ? "background-color:green;padding:5px;border-radius:3px;" : "") .'">' .($orderInfo[$clearStatus . "_order_status"] ? Loc::getMessage($this->suffix . "." . "RFBS_SUCCESS_STATUS_TRANSFER") : "") .'</span>' .'</td>' .'</tr>' ; } $html .= '<tr>' .'<td colspan="2">' .'<div class="adm-info-message-wrap" style="text-align:center;">' .'<div class="adm-info-message">' .'<div>'. Loc::getMessage($this->suffix . "." . "RFBS_NOTE") .'</div>' .'</div>' .'</div>' .'</td>' .'</tr>' ; return $html; } public function addScript() { \Bitrix\Main\Page\Asset::getInstance()->addJs("/bitrix/js/wbs24.ozonapinew/rfbsStatuses.js"); } public function getLangPhrases() { $suffix = $this->suffix; $lang = [ 'success' => Loc::getMessage($suffix.".RFBS_SUCCESS_STATUS_TRANSFER"), 'error' => Loc::getMessage($suffix.".RFBS_ERROR_STATUS_TRANSFER"), ]; return $lang; } }