From 86755c75e9f150e85e13edf918f9413bbb248488 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Tue, 18 Mar 2025 13:12:15 +0300 Subject: [PATCH] =?utf8?q?[ERP-372]=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2?= =?utf8?q?=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../controllers/MarketplaceController.php | 2 +- .../MarketplaceOrder1cStatusesController.php | 5 ++-- ...te_table_marketplace_order_1c_statuses.php | 28 +++++++++---------- .../marketplace-order-1c-statuses/index.php | 8 +++++- .../marketplace-order1c-statuses/index.js | 7 ++--- 5 files changed, 28 insertions(+), 22 deletions(-) diff --git a/erp24/api2/controllers/MarketplaceController.php b/erp24/api2/controllers/MarketplaceController.php index abee4e49..f39e7f54 100644 --- a/erp24/api2/controllers/MarketplaceController.php +++ b/erp24/api2/controllers/MarketplaceController.php @@ -24,7 +24,7 @@ class MarketplaceController extends BaseController foreach ($statuses as $status) { /* @var $status MarketplaceOrder1cStatuses */ $data []= [ - 'marketplace' => $status->marketplace_id, + 'marketplace' => [1 => "ФлауВау", 2 => "ЯндексМаркет"][$status->marketplace_id], 'status' => $status->status, 'status_instruction' => $status->status_instruction ]; diff --git a/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php b/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php index 3046f987..a39ca83a 100644 --- a/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php +++ b/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php @@ -42,17 +42,18 @@ class MarketplaceOrder1cStatusesController extends Controller public function actionIndex() { if (Yii::$app->request->isPost) { $action = Yii::$app->request->post('action'); + $marketplaceId = Yii::$app->request->post('marketplaceId'); if ($action == 'sorting') { $oldIndex = Yii::$app->request->post('oldIndex'); $newIndex = Yii::$app->request->post('newIndex'); - $mo1s = MarketplaceOrder1cStatuses::find()->orderBy(['posit' => SORT_ASC])->all(); + $mo1s = MarketplaceOrder1cStatuses::find()->where(['marketplace_id' => $marketplaceId])->orderBy(['posit' => SORT_ASC])->all(); LessonService::movePosition($mo1s, $oldIndex, $newIndex, 'posit'); return $oldIndex . ' ' . $newIndex; } else { $this->response->format = \yii\web\Response::FORMAT_JSON; - return $this->asJson(MarketplaceOrder1cStatuses::find()->orderBy(['posit' => SORT_ASC])->asArray()->all()); + return $this->asJson(MarketplaceOrder1cStatuses::find()->where(['marketplace_id' => $marketplaceId])->orderBy(['posit' => SORT_ASC])->asArray()->all()); } } diff --git a/erp24/migrations/m250314_114026_create_table_marketplace_order_1c_statuses.php b/erp24/migrations/m250314_114026_create_table_marketplace_order_1c_statuses.php index 4f059f61..72c3e9c0 100755 --- a/erp24/migrations/m250314_114026_create_table_marketplace_order_1c_statuses.php +++ b/erp24/migrations/m250314_114026_create_table_marketplace_order_1c_statuses.php @@ -25,20 +25,20 @@ class m250314_114026_create_table_marketplace_order_1c_statuses extends Migratio ]); $this->batchInsert(self::TABLE_NAME, ['marketplace_id', 'status', 'status_instruction', 'posit'], [ - [1, 'Новый', '', 1], - [1, 'Правки флориста', '', 2], - [1, 'В работе', '', 3], - [1, 'Собрано', '', 4], - [1, 'Передано курьеру', '', 5], - [1, 'Успех', '', 6], - [1, 'Отказ', '', 7], - [2, 'Новый', '', 7 + 1], - [2, 'Правки флориста', '', 7 + 2], - [2, 'В работе', '', 7 + 3], - [2, 'Собрано', '', 7 + 4], - [2, 'Передано курьеру', '', 7 + 5], - [2, 'Успех', '', 7 + 6], - [2, 'Отказ', '', 7 + 7], + [1, 'Новый', 'Задайте конкретные цели и KPI', 1], + [1, 'Правки флориста', 'Примените аналитические инструменты Ai Wiz для исследования данных и выявления трендов', 2], + [1, 'В работе', 'Разработайте гайд, используя шаблон', 3], + [1, 'Собрано', 'Включите автоматизацию для мониторинга выполнения задач и корректировки стратегии в реальном времени', 4], + [1, 'Передано курьеру', 'Включите и настройте Ai Wiz для вашей конкретной задачи', 5], + [1, 'Успех', 'Пользуйтесь рекомендациями нейросети для оптимизации ваших процессов', 6], + [1, 'Отказ', 'Используйте анализ данных для принятия обоснованных решений и адаптации стратегии', 7], + [2, 'Новый', 'Задайте конкретные цели и KPI', 7 + 1], + [2, 'Правки флориста', 'Примените аналитические инструменты Ai Wiz для исследования данных и выявления трендов', 7 + 2], + [2, 'В работе', 'Разработайте гайд, используя шаблон', 7 + 3], + [2, 'Собрано', 'Включите автоматизацию для мониторинга выполнения задач и корректировки стратегии в реальном времени', 7 + 4], + [2, 'Передано курьеру', 'Включите и настройте Ai Wiz для вашей конкретной задачи', 7 + 5], + [2, 'Успех', 'Пользуйтесь рекомендациями нейросети для оптимизации ваших процессов', 7 + 6], + [2, 'Отказ', 'Используйте анализ данных для принятия обоснованных решений и адаптации стратегии', 7 + 7], ]); } } diff --git a/erp24/views/crud/marketplace-order-1c-statuses/index.php b/erp24/views/crud/marketplace-order-1c-statuses/index.php index ef4ed362..153340db 100644 --- a/erp24/views/crud/marketplace-order-1c-statuses/index.php +++ b/erp24/views/crud/marketplace-order-1c-statuses/index.php @@ -22,7 +22,6 @@ $this->params['breadcrumbs'][] = $this->title;

'btn btn-success']) ?> - 'btn btn-secondary', 'onclick' => 'showSortingDialog()']) ?>

@@ -32,6 +31,13 @@ $this->params['breadcrumbs'][] = $this->title; ['class' => 'yii\grid\SerialColumn'], 'id', + [ + 'label' => '', + 'format' => 'raw', + 'value' => function ($model) { + return Html::button('Сортировка', ['class' => 'btn btn-secondary', 'onclick' => 'showSortingDialog(' . $model->marketplace_id . ')']); + } + ], [ 'attribute' => 'marketplace_id', 'label' => 'Маркетплейс', diff --git a/erp24/web/js/crud/marketplace-order1c-statuses/index.js b/erp24/web/js/crud/marketplace-order1c-statuses/index.js index 327d307f..e4bd4bb5 100644 --- a/erp24/web/js/crud/marketplace-order1c-statuses/index.js +++ b/erp24/web/js/crud/marketplace-order1c-statuses/index.js @@ -3,11 +3,11 @@ const param31 = $('meta[name=csrf-param]').attr("content"); const token31 = $('meta[name=csrf-token]').attr("content"); -function showSortingDialog() { +function showSortingDialog(marketplaceId) { $.ajax({ method : "POST", url : window.location.href, - data : {[param31] : token31}, + data : {marketplaceId, [param31] : token31}, dataType : "json", success: function (data) { const $mainModal = $('#mainModal'); @@ -43,12 +43,11 @@ function showSortingDialog() { scroll: true, handle: ".drag-handler", onEnd: function (e) { - const name = $(e.from).data('name'); const oldIndex = e.oldIndex; const newIndex = e.newIndex; $.post(window.location.href, { action: 'sorting', - name : name, + marketplaceId : marketplaceId, oldIndex : oldIndex, newIndex : newIndex, [param31] : token31 -- 2.39.5