From c41e5d4c1c93390e7b5d416eb39597cf719b63e6 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Nov 2022 06:25:46 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=B4?= =?UTF-8?q?=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controllers/OfferController.php | 6 ++- mirzaev/skillparts/system/models/Supply.php | 12 +++++- .../system/models/connection/Dellin.php | 16 ++------ .../skillparts/system/views/account/index.php | 2 +- .../skillparts/system/views/offer/index.php | 9 +++++ .../system/views/offer/supplier.php | 9 +++++ .../skillparts/system/views/product/index.php | 8 ++-- .../skillparts/system/views/product/list.php | 2 +- mirzaev/skillparts/system/web/css/main.css | 4 ++ mirzaev/skillparts/system/web/js/account.js | 38 +++++++++++++++---- .../skillparts/system/web/js/profile_panel.js | 3 ++ 11 files changed, 81 insertions(+), 28 deletions(-) diff --git a/mirzaev/skillparts/system/controllers/OfferController.php b/mirzaev/skillparts/system/controllers/OfferController.php index 9cf748b..47e713c 100644 --- a/mirzaev/skillparts/system/controllers/OfferController.php +++ b/mirzaev/skillparts/system/controllers/OfferController.php @@ -18,10 +18,14 @@ class OfferController extends Controller 'access' => [ 'class' => AccessControl::class, 'rules' => [ + [ + 'allow' => true, + 'actions' => ['index', 'suppliers'], + ], [ 'allow' => true, 'roles' => ['@'], - 'actions' => ['index', 'suppliers', 'accept', 'accept-suppliers'] + 'actions' => ['accept', 'accept-suppliers'] ], [ 'allow' => false, diff --git a/mirzaev/skillparts/system/models/Supply.php b/mirzaev/skillparts/system/models/Supply.php index fe38ea5..29bc6de 100644 --- a/mirzaev/skillparts/system/models/Supply.php +++ b/mirzaev/skillparts/system/models/Supply.php @@ -428,7 +428,6 @@ class Supply extends Product implements ProductInterface, OfferInterface if (!file_exists($path)) if (!mkdir($path, 0775, true)) throw new Exception('Не удалось создать директорию', 500); - $this->file_excel->saveAs($path = "$path/" . $this->file_excel->baseName . '.' . $this->file_excel->extension); // Инициализация инстанции файла @@ -585,8 +584,17 @@ class Supply extends Product implements ProductInterface, OfferInterface // Запись артикула (каталожного номера) в буфер $_row['catn'] = $_supply; + + // Запись цены в буфер $_row['cost'] = (float) preg_replace('/[^\d\.]+/', '', preg_replace('/\,+/', ' ', (string) ($row['Стоимость'] ?? $row['стоимость'] ?? $row['Цена'] ?? $row['цена'] ?? $row['Cost'] ?? $row['cost'] ?? $row['Price'] ?? $row['price']))) ?? 0; - $_row['prod'] = $prod; + + // Запись производителя в буфер + $_row['prod'] = match($prod = ucwords(strtolower(preg_replace('/[^A-zА-я\s]/', ' ', $prod, 300)))) { + 'Сatterpillar', 'Cat' => 'CAT', + default => $prod + }; + + // Запись аналогов в буфер $_row['oemn'] = array_walk($analogs, 'trim'); // Инициализация буфера поставки diff --git a/mirzaev/skillparts/system/models/connection/Dellin.php b/mirzaev/skillparts/system/models/connection/Dellin.php index 3d8a844..ae0d856 100644 --- a/mirzaev/skillparts/system/models/connection/Dellin.php +++ b/mirzaev/skillparts/system/models/connection/Dellin.php @@ -67,10 +67,10 @@ class Dellin extends Model * * @param int $from Идентификатор терминала Dellin * @param int $to Идентификатор терминала Dellin - * @param int $weight Вес (г) - * @param int $x Ширина (cм) - * @param int $y Высота (cм) - * @param int $z Длинна (cм) + * @param int $weight Вес (кг) + * @param int $x Ширина (м) + * @param int $y Высота (м) + * @param int $z Длинна (м) * @param int $amount Количество * @param Account|int|null $account Аккаунт * @@ -96,14 +96,6 @@ class Dellin extends Model if (empty($z) || $z === 0) $z = 25; if (empty($weight) || $weight === 0) $weight = 300; - // Конвертация из сантиметров в метры - $x /= 100; - $y /= 100; - $z /= 100; - - // Конвертация из граммов в килограммы - $weight /= 1000; - // Вычисление самой крупной стороны, так как ДеловыеЛинии имеют ограничения на все три поля и у длинны оно больше всех if ($x > $z && $x > $y) { // "X" больше всех diff --git a/mirzaev/skillparts/system/views/account/index.php b/mirzaev/skillparts/system/views/account/index.php index 09619b8..3086d2a 100644 --- a/mirzaev/skillparts/system/views/account/index.php +++ b/mirzaev/skillparts/system/views/account/index.php @@ -70,7 +70,7 @@ use app\models\AccountForm; field($model, 'mail', ['enableLabel' => false, 'options' => ['class' => 'mb-2'], 'inputOptions' => ['class' => 'form-control button_clean'], 'errorOptions' => ['class' => 'help-block help-block-error px-2 small']])->textInput(['autofocus' => true, 'placeholder' => $model->getAttributeLabel('mail')]) ?> field($model, 'pswd', ['enableLabel' => false, 'inputOptions' => ['class' => 'form-control button_clean'], 'errorOptions' => ['class' => 'help-block help-block-error px-2 small']])->passwordInput(['placeholder' => $model->getAttributeLabel('pswd')]) ?> -
+
'submitAuthentication', 'onclick' => 'authentication(this.parentElement.parentElement, \'' . $target . '\');', 'class' => 'flex-grow-1 mr-2 btn btn-primary button_clean']) ?> field($model, 'auto', ['checkboxTemplate' => '
{beginLabel}' . Html::submitButton('{labelTitle}', ['name' => 'submit', 'data-toggle' => 'button', 'class' => 'w-100 btn btn-primary button_clean', 'aria-pressed' => 'false', 'onclick' => 'return authentication_auto_button_status_switch(this);']) . diff --git a/mirzaev/skillparts/system/views/offer/index.php b/mirzaev/skillparts/system/views/offer/index.php index 273f536..a043f3c 100644 --- a/mirzaev/skillparts/system/views/offer/index.php +++ b/mirzaev/skillparts/system/views/offer/index.php @@ -1,3 +1,10 @@ + +
@@ -42,8 +49,10 @@
+ user->isGuest): ?> +
diff --git a/mirzaev/skillparts/system/views/offer/supplier.php b/mirzaev/skillparts/system/views/offer/supplier.php index fc9ef9e..4b33a1a 100644 --- a/mirzaev/skillparts/system/views/offer/supplier.php +++ b/mirzaev/skillparts/system/views/offer/supplier.php @@ -1,3 +1,10 @@ + +
@@ -54,8 +61,10 @@
+ user->isGuest): ?>
Принять
+ diff --git a/mirzaev/skillparts/system/views/product/index.php b/mirzaev/skillparts/system/views/product/index.php index e1e3858..fb44b40 100644 --- a/mirzaev/skillparts/system/views/product/index.php +++ b/mirzaev/skillparts/system/views/product/index.php @@ -157,22 +157,22 @@ use app\models\Search;

- Габариты:смxсмxсм + Габариты:мxмxм

- Вес:г + Вес:кг

- Габариты:смxсмxсм + Габариты:мxмxм

- Вес:г + Вес:кг

diff --git a/mirzaev/skillparts/system/views/product/list.php b/mirzaev/skillparts/system/views/product/list.php index 0b9e215..a24408b 100644 --- a/mirzaev/skillparts/system/views/product/list.php +++ b/mirzaev/skillparts/system/views/product/list.php @@ -15,7 +15,7 @@ preg_match_all('/UTC([\+\-0-9:]*)/', $account->zone ?? Settings::searchActive()[ $timezone = $timezone[1][0]; ?> - 1) : ?> + 1 && count($products) > 0) : ?> diff --git a/mirzaev/skillparts/system/web/css/main.css b/mirzaev/skillparts/system/web/css/main.css index ed1c915..f067825 100644 --- a/mirzaev/skillparts/system/web/css/main.css +++ b/mirzaev/skillparts/system/web/css/main.css @@ -267,6 +267,10 @@ main { border-top: 1px solid #CEDCFF !important; } +.help-block-error { + color: #e60000; +} + /* @media (max-width: 400px) {} */ /* Малые девайсы («ландшафтные телефоны», >= 576px) */ diff --git a/mirzaev/skillparts/system/web/js/account.js b/mirzaev/skillparts/system/web/js/account.js index f708094..a649455 100644 --- a/mirzaev/skillparts/system/web/js/account.js +++ b/mirzaev/skillparts/system/web/js/account.js @@ -70,7 +70,6 @@ function restore(form, target = 'main') { dataType: 'json', data: form, success: function (data, status, xhr) { - if (data !== undefined) { // Получены данные с сервера @@ -78,11 +77,36 @@ function restore(form, target = 'main') { if (typeof data.status === 'boolean') { // Успешное выполнение - // Инициализация панели - const panel = document.getElementById('form_account_panel'); + // Инициализация оболочки для уведомлений, оболочки для уведомлений и оболочки формы + let id, body, alert; - // Инициализация оболочки для уведомлений - let alert = document.getElementById('form_account_panel_alert'); + console.log(window.location.pathname); + console.log(window.location.pathname === '/authentication'); + + if (window.location.pathname === '/authentication') { + // Страница аутентификации + + // Запись оболочки формы + body = document.getElementById('form_account'); + + // Запись оболочки для уведомлений + id = 'form_account_alert'; + + // Запись оболочки для уведомлений + alert = document.getElementById(id); + } + else { + // Панель аутентификации + + // Запись оболочки формы + body = document.getElementById('form_account_panel'); + + // Запись идентификатора оболочки для уведомлений + id = 'form_account_panel_alert'; + + // Запись оболочки для уведомлений + alert = document.getElementById(id); + } if (!(alert instanceof HTMLElement)) { // Не найдена оболочка для уведомлений (подразумевается) @@ -91,12 +115,12 @@ function restore(form, target = 'main') { const wrap = document.createElement('small'); wrap.classList.add('d-flex'); const element = document.createElement('small'); - element.id = 'form_account_panel_alert'; + element.id = id; element.classList.add('mx-auto'); // Запись в панель wrap.appendChild(element); - panel.appendChild(wrap); + body.appendChild(wrap); // Реинициализация оболочки для уведомлений alert = element; diff --git a/mirzaev/skillparts/system/web/js/profile_panel.js b/mirzaev/skillparts/system/web/js/profile_panel.js index ab8de00..15b5585 100644 --- a/mirzaev/skillparts/system/web/js/profile_panel.js +++ b/mirzaev/skillparts/system/web/js/profile_panel.js @@ -784,6 +784,9 @@ function profile_panel_input_suppliers_accounts_create_product(button, catn, pro function profile_panel_products_read(search = '@last', type = '@last', from = '@last', to = '@last', page = 1, purge = false) { // '@last' - оставить без изменений и взять данные из cookie + // Реинициализация cookie с номером страницы + Cookies.set('profile_panel_products_read_page', page, { path: window.location.pathname }); + if (search.length > 1) { // Проверка на длину запроса пройдена