From: fomichev Date: Fri, 6 Jun 2025 08:09:07 +0000 (+0300) Subject: Добавление кодов X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=3f858f8975ca310afbf6f7a97d6bf7e639a8da9f;p=erp24_rep%2Fyii-erp24%2F.git Добавление кодов --- diff --git a/erp24/api2/controllers/MarketplaceController.php b/erp24/api2/controllers/MarketplaceController.php index 411c1109..4d2a9dfc 100644 --- a/erp24/api2/controllers/MarketplaceController.php +++ b/erp24/api2/controllers/MarketplaceController.php @@ -42,22 +42,26 @@ class MarketplaceController extends BaseController $marketplaceGuid = Yii::$app->request->post('guid'); $marketplaceOrder = MarketplaceOrders::find()->where(['guid' => $marketplaceGuid])->one(); /** @var $marketplaceOrder MarketplaceOrders */ - $statuses = MarketplaceOrder1cStatuses::find()->where(['marketplace_id' => $marketplaceOrder->marketplace_id])->orderBy(['posit' => SORT_ASC])->all(); + $statuses = MarketplaceOrder1cStatuses::find() + ->where(['marketplace_id' => $marketplaceOrder->marketplace_id]) + ->orderBy(['posit' => SORT_ASC]) + ->all(); $data = []; foreach ($statuses as $status) { /* @var $status MarketplaceOrder1cStatuses */ $relftions = $status->relationsFrom; $relationsToSend = []; foreach ($relftions as $relation) { - $status = MarketplaceOrder1cStatuses ::find()->where(['id' => $relation['status_id_to']])->one(); - if(!$status) { + $statusTo = MarketplaceOrder1cStatuses::find()->where(['id' => $relation['status_id_to']])->one(); + if(!$statusTo) { continue; } $order = $relation['order']; $description = $relation['description']; $buttonText = $relation['button_text']; $relationsToSend[] = [ - 'status' => $status->status, + 'status' => $statusTo->status, + 'status_id' => $statusTo->status_id, 'description' => $description, 'button_text' => $buttonText, 'order' => $order, @@ -66,6 +70,7 @@ class MarketplaceController extends BaseController $data []= [ 'marketplace' => [1 => "ФлауВау", 2 => "ЯндексМаркет"][$status->marketplace_id], 'status' => $status->status, + 'status_id' => $status->status_id, 'status_instruction' => $status->status_instruction, 'status_relations' => $relationsToSend ]; diff --git a/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php b/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php index e6908e4e..2e2dad4e 100644 --- a/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php +++ b/erp24/controllers/crud/MarketplaceOrder1cStatusesController.php @@ -59,8 +59,6 @@ class MarketplaceOrder1cStatusesController extends Controller } } - - $dataProvider = new ActiveDataProvider([ 'query' => MarketplaceOrder1cStatuses::find() ->with(['relationsFrom', 'nextStatuses']) diff --git a/erp24/views/crud/marketplace-order-1c-statuses/_form.php b/erp24/views/crud/marketplace-order-1c-statuses/_form.php deleted file mode 100644 index 98a26a06..00000000 --- a/erp24/views/crud/marketplace-order-1c-statuses/_form.php +++ /dev/null @@ -1,156 +0,0 @@ -registerJs( - "window.statusesByMarketplace = $jsonStatuses;", - View::POS_HEAD -); - -$this->registerJsFile( - '@web/js/Sortable.js', - ['position' => \yii\web\View::POS_END] -); -$this->registerJsFile( - '@web/js/crud/marketplace-order1c-statuses/index.js', - ['depends' => [\yii\web\JqueryAsset::class], 'position' => \yii\web\View::POS_END] -); - - -?> - -
- session->hasFlash('error')): ?> - - - - - - field($model, 'marketplace_id') - ->dropDownList( - [1 => 'ФлауВау', 2 => 'ЯндексМаркет'], - [ - 'prompt' => 'Выберите маркетплейс', - 'id' => 'marketplace-order1cstatuses-marketplace_id', - ] - ) ?> - - field($model, 'status')->textInput(['maxlength' => true]) ?> - - field($model, 'status_instruction')->textarea(['rows' => 4]) ?> - -
- -

Связанные статусы (relations)

-
- $rel): - $initialOrder = $rel->order ?: ($i + 1); - ?> -
- ☰ - Порядок: - - 'rel-order-input']) ?> - -
- 'control-label']) ?> - status_id_to, - [], - [ - 'prompt' => '— выберите статус —', - 'class' => 'form-control status-to-select', - - 'data-current' => $rel->status_id_to, - ] - ); ?> -
- -
- 'control-label']) ?> - description, - ['class' => 'form-control'] - ); ?> -
- -
- 'control-label']) ?> - button_text, - ['class' => 'form-control'] - ); ?> -
- - -
- -
- - - -
- 'btn btn-success']) ?> -
- - - - - -
\ No newline at end of file diff --git a/erp24/views/crud/marketplace-order-1c-statuses/create.php b/erp24/views/crud/marketplace-order-1c-statuses/create.php deleted file mode 100644 index e3140d6b..00000000 --- a/erp24/views/crud/marketplace-order-1c-statuses/create.php +++ /dev/null @@ -1,22 +0,0 @@ -title = 'Create Marketplace Order1c Statuses'; -$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order1c Statuses', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- - render('_form', [ - 'model' => $model, - 'relationModels' => $relationModels, - 'statusOptions' => $statusOptions, - ]) ?> - -
diff --git a/erp24/views/crud/marketplace-order-1c-statuses/index.php b/erp24/views/crud/marketplace-order-1c-statuses/index.php deleted file mode 100644 index 628305f2..00000000 --- a/erp24/views/crud/marketplace-order-1c-statuses/index.php +++ /dev/null @@ -1,76 +0,0 @@ -registerCssFile('/css/customSortable.css'); -$this->registerJsFile('/js/Sortable.js', ['position' => \yii\web\View::POS_END]); -$this->registerJsFile('/js/crud/marketplace-order1c-statuses/index.js', ['position' => \yii\web\View::POS_END]); - -$this->title = 'Маркетплейс статусы заказа'; -$this->params['breadcrumbs'][] = $this->title; -?> -
- -

title) ?>

- -

- 'btn btn-success']) ?> -

- - - $dataProvider, - 'columns' => [ - ['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' => 'Маркетплейс', - 'value' => function ($model) { - return [1 => 'ФлауВау', 2 => 'ЯндексМаркет'][$model->marketplace_id]; - } - ], - 'status', - 'status_instruction:ntext', - [ - 'class' => ActionColumn::class, - 'urlCreator' => function ($action, MarketplaceOrder1cStatuses $model, $key, $index, $column) { - return Url::toRoute([$action, 'id' => $model->id]); - } - ], - [ - 'label' => 'Связанные статусы', - 'format' => 'raw', - 'value' => function (MarketplaceOrder1cStatuses $model) { - $links = []; - foreach ($model->nextStatuses as $nextStatus) { - $links[] = Html::a( - Html::encode($nextStatus->status), - ['/crud/marketplace-order-1c-statuses/view', 'id' => $nextStatus->id] - ); - } - return empty($links) - ? '— нет связи —' - : implode('
', $links); - }, - ], - ], - ]); ?> - - -
diff --git a/erp24/views/crud/marketplace-order-1c-statuses/update.php b/erp24/views/crud/marketplace-order-1c-statuses/update.php deleted file mode 100644 index 2bdf182b..00000000 --- a/erp24/views/crud/marketplace-order-1c-statuses/update.php +++ /dev/null @@ -1,26 +0,0 @@ -title = 'Обновить маркетплейс статус заказа: ' . $model->id; -$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статус заказа', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update'; -?> -
- -

- 'btn btn-secondary btn-sm'])?> - title) ?> -

- - render('_form', [ - 'model' => $model, - 'relationModels' => $relationModels, - 'statusOptions' => $statusOptions, - ]) ?> - -
diff --git a/erp24/views/crud/marketplace-order-1c-statuses/view.php b/erp24/views/crud/marketplace-order-1c-statuses/view.php deleted file mode 100644 index 05b484fd..00000000 --- a/erp24/views/crud/marketplace-order-1c-statuses/view.php +++ /dev/null @@ -1,64 +0,0 @@ -title = $model->id; -$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статусы заказа', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -\yii\web\YiiAsset::register($this); -?> -
- -

- 'btn btn-secondary btn-sm'])?> - title) ?> -

- -

- $model->id], ['class' => 'btn btn-primary']) ?> - $model->id], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => 'Вы уверены, что хотите удалить эту запись?', - 'method' => 'post', - ], - ]) ?> -

- - $model, - 'attributes' => [ - 'id', - [ - 'attribute' => 'marketplace_id', - 'value' => function ($data) { - return [1 => 'ФлауВау', 2 => 'ЯндексМаркет'][$data->marketplace_id]; - } - ], - 'status', - 'status_instruction:ntext', - [ - 'label' => 'Связанные статусы', - 'format' => 'raw', - 'value' => function (MarketplaceOrder1cStatuses $model) { - $links = []; - foreach ($model->nextStatuses as $nextStatus) { - $links[] = Html::a( - Html::encode($nextStatus->status), - ['/crud/marketplace-order-1c-statuses/view', 'id' => $nextStatus->id] - ); - } - return empty($links) - ? '— нет связи —' - : implode('
', $links); - }, - ], - ], - ]) ?> - -
diff --git a/erp24/views/crud/marketplace-order1c-statuses/_form.php b/erp24/views/crud/marketplace-order1c-statuses/_form.php new file mode 100644 index 00000000..98a26a06 --- /dev/null +++ b/erp24/views/crud/marketplace-order1c-statuses/_form.php @@ -0,0 +1,156 @@ +registerJs( + "window.statusesByMarketplace = $jsonStatuses;", + View::POS_HEAD +); + +$this->registerJsFile( + '@web/js/Sortable.js', + ['position' => \yii\web\View::POS_END] +); +$this->registerJsFile( + '@web/js/crud/marketplace-order1c-statuses/index.js', + ['depends' => [\yii\web\JqueryAsset::class], 'position' => \yii\web\View::POS_END] +); + + +?> + +
+ session->hasFlash('error')): ?> + + + + + + field($model, 'marketplace_id') + ->dropDownList( + [1 => 'ФлауВау', 2 => 'ЯндексМаркет'], + [ + 'prompt' => 'Выберите маркетплейс', + 'id' => 'marketplace-order1cstatuses-marketplace_id', + ] + ) ?> + + field($model, 'status')->textInput(['maxlength' => true]) ?> + + field($model, 'status_instruction')->textarea(['rows' => 4]) ?> + +
+ +

Связанные статусы (relations)

+
+ $rel): + $initialOrder = $rel->order ?: ($i + 1); + ?> +
+ ☰ + Порядок: + + 'rel-order-input']) ?> + +
+ 'control-label']) ?> + status_id_to, + [], + [ + 'prompt' => '— выберите статус —', + 'class' => 'form-control status-to-select', + + 'data-current' => $rel->status_id_to, + ] + ); ?> +
+ +
+ 'control-label']) ?> + description, + ['class' => 'form-control'] + ); ?> +
+ +
+ 'control-label']) ?> + button_text, + ['class' => 'form-control'] + ); ?> +
+ + +
+ +
+ + + +
+ 'btn btn-success']) ?> +
+ + + + + +
\ No newline at end of file diff --git a/erp24/views/crud/marketplace-order1c-statuses/create.php b/erp24/views/crud/marketplace-order1c-statuses/create.php new file mode 100644 index 00000000..e3140d6b --- /dev/null +++ b/erp24/views/crud/marketplace-order1c-statuses/create.php @@ -0,0 +1,22 @@ +title = 'Create Marketplace Order1c Statuses'; +$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order1c Statuses', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'relationModels' => $relationModels, + 'statusOptions' => $statusOptions, + ]) ?> + +
diff --git a/erp24/views/crud/marketplace-order1c-statuses/index.php b/erp24/views/crud/marketplace-order1c-statuses/index.php new file mode 100644 index 00000000..628305f2 --- /dev/null +++ b/erp24/views/crud/marketplace-order1c-statuses/index.php @@ -0,0 +1,76 @@ +registerCssFile('/css/customSortable.css'); +$this->registerJsFile('/js/Sortable.js', ['position' => \yii\web\View::POS_END]); +$this->registerJsFile('/js/crud/marketplace-order1c-statuses/index.js', ['position' => \yii\web\View::POS_END]); + +$this->title = 'Маркетплейс статусы заказа'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ 'btn btn-success']) ?> +

+ + + $dataProvider, + 'columns' => [ + ['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' => 'Маркетплейс', + 'value' => function ($model) { + return [1 => 'ФлауВау', 2 => 'ЯндексМаркет'][$model->marketplace_id]; + } + ], + 'status', + 'status_instruction:ntext', + [ + 'class' => ActionColumn::class, + 'urlCreator' => function ($action, MarketplaceOrder1cStatuses $model, $key, $index, $column) { + return Url::toRoute([$action, 'id' => $model->id]); + } + ], + [ + 'label' => 'Связанные статусы', + 'format' => 'raw', + 'value' => function (MarketplaceOrder1cStatuses $model) { + $links = []; + foreach ($model->nextStatuses as $nextStatus) { + $links[] = Html::a( + Html::encode($nextStatus->status), + ['/crud/marketplace-order-1c-statuses/view', 'id' => $nextStatus->id] + ); + } + return empty($links) + ? '— нет связи —' + : implode('
', $links); + }, + ], + ], + ]); ?> + + +
diff --git a/erp24/views/crud/marketplace-order1c-statuses/update.php b/erp24/views/crud/marketplace-order1c-statuses/update.php new file mode 100644 index 00000000..2bdf182b --- /dev/null +++ b/erp24/views/crud/marketplace-order1c-statuses/update.php @@ -0,0 +1,26 @@ +title = 'Обновить маркетплейс статус заказа: ' . $model->id; +$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статус заказа', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Update'; +?> +
+ +

+ 'btn btn-secondary btn-sm'])?> + title) ?> +

+ + render('_form', [ + 'model' => $model, + 'relationModels' => $relationModels, + 'statusOptions' => $statusOptions, + ]) ?> + +
diff --git a/erp24/views/crud/marketplace-order1c-statuses/view.php b/erp24/views/crud/marketplace-order1c-statuses/view.php new file mode 100644 index 00000000..05b484fd --- /dev/null +++ b/erp24/views/crud/marketplace-order1c-statuses/view.php @@ -0,0 +1,64 @@ +title = $model->id; +$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статусы заказа', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +\yii\web\YiiAsset::register($this); +?> +
+ +

+ 'btn btn-secondary btn-sm'])?> + title) ?> +

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Вы уверены, что хотите удалить эту запись?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id', + [ + 'attribute' => 'marketplace_id', + 'value' => function ($data) { + return [1 => 'ФлауВау', 2 => 'ЯндексМаркет'][$data->marketplace_id]; + } + ], + 'status', + 'status_instruction:ntext', + [ + 'label' => 'Связанные статусы', + 'format' => 'raw', + 'value' => function (MarketplaceOrder1cStatuses $model) { + $links = []; + foreach ($model->nextStatuses as $nextStatus) { + $links[] = Html::a( + Html::encode($nextStatus->status), + ['/crud/marketplace-order-1c-statuses/view', 'id' => $nextStatus->id] + ); + } + return empty($links) + ? '— нет связи —' + : implode('
', $links); + }, + ], + ], + ]) ?> + +