]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавление кодов
authorfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 6 Jun 2025 08:09:07 +0000 (11:09 +0300)
committerfomichev <vladimir.fomichev@erp-flowers.ru>
Fri, 6 Jun 2025 08:09:07 +0000 (11:09 +0300)
12 files changed:
erp24/api2/controllers/MarketplaceController.php
erp24/controllers/crud/MarketplaceOrder1cStatusesController.php
erp24/views/crud/marketplace-order-1c-statuses/_form.php [deleted file]
erp24/views/crud/marketplace-order-1c-statuses/create.php [deleted file]
erp24/views/crud/marketplace-order-1c-statuses/index.php [deleted file]
erp24/views/crud/marketplace-order-1c-statuses/update.php [deleted file]
erp24/views/crud/marketplace-order-1c-statuses/view.php [deleted file]
erp24/views/crud/marketplace-order1c-statuses/_form.php [new file with mode: 0644]
erp24/views/crud/marketplace-order1c-statuses/create.php [new file with mode: 0644]
erp24/views/crud/marketplace-order1c-statuses/index.php [new file with mode: 0644]
erp24/views/crud/marketplace-order1c-statuses/update.php [new file with mode: 0644]
erp24/views/crud/marketplace-order1c-statuses/view.php [new file with mode: 0644]

index 411c1109909a1a0336f40eed6730bcb99a9a6a5a..4d2a9dfce6707069b33a95044006cae0cec4d12f 100644 (file)
@@ -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
             ];
index e6908e4e0201557333caf460ae91ed76efa862c5..2e2dad4e51ed152ee8ce1d94de70e3c2632416cd 100644 (file)
@@ -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 (file)
index 98a26a0..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-use yii\helpers\Html;
-use yii\helpers\Json;
-use yii\web\View;
-use yii\widgets\ActiveForm;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
-/** @var yii_app\records\MarketplaceOrder1cStatusesRelations[] $relationModels */
-/** @var array $statusOptions  (ключ = id, значение = статус) */
-
-$jsonStatuses = Json::encode($statusOptions);
-
-
-$this->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]
-);
-
-
-?>
-
-<div class="marketplace-order1c-statuses-form">
-    <?php if (Yii::$app->session->hasFlash('error')): ?>
-        <div class="alert alert-danger" role="alert">
-            <?= Yii::$app->session->getFlash('error') ?>
-        </div>
-    <?php endif; ?>
-
-    <?php $form = ActiveForm::begin(); ?>
-
-    <?= $form->field($model, 'marketplace_id')
-        ->dropDownList(
-            [1 => 'ФлауВау', 2 => 'ЯндексМаркет'],
-            [
-                'prompt' => 'Выберите маркетплейс',
-                'id' => 'marketplace-order1cstatuses-marketplace_id',
-            ]
-        ) ?>
-
-    <?= $form->field($model, 'status')->textInput(['maxlength' => true]) ?>
-
-    <?= $form->field($model, 'status_instruction')->textarea(['rows' => 4]) ?>
-
-    <hr>
-
-    <h4>Связанные статусы (relations)</h4>
-    <div id="relations-container">
-        <?php foreach ($relationModels as $i => $rel):
-            $initialOrder = $rel->order ?: ($i + 1);
-            ?>
-            <div class="relation-item" style="border:1px solid #ddd; padding:10px; margin-bottom:10px; position: relative; background:#f9f9f9;">
-                <span class="drag-handle" style="cursor:move; font-size:18px; margin-right:8px;" title="Перетащите, чтобы изменить порядок">☰</span>
-                <strong>Порядок: <span class="order-label"><?= $initialOrder ?></span></strong>
-
-                <?= Html::hiddenInput("Relations[{$i}][order]", $initialOrder, ['class' => 'rel-order-input']) ?>
-
-                <div style="margin-top:8px;">
-                    <?= Html::label('Статус-назначения', null, ['class' => 'control-label']) ?>
-                    <?= Html::dropDownList(
-                        "Relations[{$i}][status_id_to]",
-                        $rel->status_id_to,
-                        [],
-                        [
-                            'prompt'       => '— выберите статус —',
-                            'class'        => 'form-control status-to-select',
-
-                            'data-current' => $rel->status_id_to,
-                        ]
-                    ); ?>
-                </div>
-
-                <div style="margin-top:8px;">
-                    <?= Html::label('Описание (description)', null, ['class' => 'control-label']) ?>
-                    <?= Html::textInput(
-                        "Relations[{$i}][description]",
-                        $rel->description,
-                        ['class' => 'form-control']
-                    ); ?>
-                </div>
-
-                <div style="margin-top:8px;">
-                    <?= Html::label('Текст кнопки (button_text)', null, ['class' => 'control-label']) ?>
-                    <?= Html::textInput(
-                        "Relations[{$i}][button_text]",
-                        $rel->button_text,
-                        ['class' => 'form-control']
-                    ); ?>
-                </div>
-
-                <button type="button" class="btn btn-danger btn-sm remove-relation-btn"
-                        style="position:absolute; top:10px; right:10px;">
-                   Удалить
-                </button>
-            </div>
-        <?php endforeach; ?>
-    </div>
-
-    <button type="button" id="add-relation-btn" class="btn btn-primary btn-sm" style="margin-bottom:15px;">
-        &plus; Добавить ещё одну связь
-    </button>
-
-    <div class="form-group">
-        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
-    </div>
-
-    <?php ActiveForm::end(); ?>
-
-
-    <div id="relation-template" style="display:none;">
-        <div class="relation-item template" style="border:1px solid #ddd; padding:10px; margin-bottom:10px; position: relative; background:#f9f9f9;">
-            <span class="drag-handle" style="cursor:move; font-size:18px; margin-right:8px;" title="Перетащите, чтобы изменить порядок">☰</span>
-            <strong>Порядок: <span class="order-label">__order__</span></strong>
-
-            <?= Html::hiddenInput("Relations[__index__][order]", "__order__", ['class' => 'rel-order-input']) ?>
-
-            <div style="margin-top:8px;">
-                <?= Html::label('Статус-назначения', null, ['class' => 'control-label']) ?>
-                <?= Html::dropDownList(
-                    "Relations[__index__][status_id_to]",
-                    null,
-                    [],
-                    [
-                        'prompt'       => '— выберите статус —',
-                        'class'        => 'form-control status-to-select',
-                        'data-current' => '',
-                    ]
-                ); ?>
-            </div>
-
-            <div style="margin-top:8px;">
-                <?= Html::label('Описание (description)', null, ['class' => 'control-label']) ?>
-                <?= Html::textInput("Relations[__index__][description]", null, ['class' => 'form-control']) ?>
-            </div>
-
-            <div style="margin-top:8px;">
-                <?= Html::label('Текст кнопки (button_text)', null, ['class' => 'control-label']) ?>
-                <?= Html::textInput("Relations[__index__][button_text]", null, ['class' => 'form-control']) ?>
-            </div>
-
-            <button type="button" class="btn btn-danger btn-sm remove-relation-btn"
-                    style="position:absolute; top:10px; right:10px;">
-                Удалить
-            </button>
-        </div>
-    </div>
-</div>
\ 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 (file)
index e3140d6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-use yii\helpers\Html;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
-
-$this->title = 'Create Marketplace Order1c Statuses';
-$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order1c Statuses', 'url' => ['index']];
-$this->params['breadcrumbs'][] = $this->title;
-?>
-<div class="marketplace-order1c-statuses-create m-5">
-
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <?= $this->render('_form', [
-        'model'           => $model,
-        'relationModels'  => $relationModels,
-        'statusOptions'   => $statusOptions,
-    ]) ?>
-
-</div>
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 (file)
index 628305f..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-
-use yii_app\records\MarketplaceOrder1cStatuses;
-use yii\helpers\Html;
-use yii\helpers\Url;
-use yii\grid\ActionColumn;
-use yii\grid\GridView;
-
-/** @var yii\web\View $this */
-/** @var yii\data\ActiveDataProvider $dataProvider */
-
-$this->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;
-?>
-<div class="marketplace-order1c-statuses-index m-5">
-
-    <h1><?= Html::encode($this->title) ?></h1>
-
-    <p>
-        <?= Html::a('Создать Маркетплейс Статус Заказа', ['create'], ['class' => 'btn btn-success']) ?>
-    </p>
-
-
-    <?= GridView::widget([
-        'dataProvider' => $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)
-                        ? '<span class="text-muted">— нет связи —</span>'
-                        : implode('<br>', $links);
-                },
-            ],
-        ],
-    ]); ?>
-
-
-</div>
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 (file)
index 2bdf182..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-use yii\helpers\Html;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
-
-$this->title = 'Обновить маркетплейс статус заказа: ' . $model->id;
-$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статус заказа', 'url' => ['index']];
-$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
-$this->params['breadcrumbs'][] = 'Update';
-?>
-<div class="marketplace-order1c-statuses-update m-5">
-
-    <h1>
-        <?= Html::a('Назад', ['index'], ['class' => 'btn btn-secondary btn-sm'])?>
-        <?= Html::encode($this->title) ?>
-    </h1>
-
-    <?= $this->render('_form', [
-        'model'           => $model,
-        'relationModels'  => $relationModels,
-        'statusOptions'   => $statusOptions,
-    ]) ?>
-
-</div>
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 (file)
index 05b484f..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-use yii\helpers\Html;
-use yii\widgets\DetailView;
-use yii_app\records\MarketplaceOrder1cStatuses;
-
-/** @var yii\web\View $this */
-/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
-
-$this->title = $model->id;
-$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статусы заказа', 'url' => ['index']];
-$this->params['breadcrumbs'][] = $this->title;
-\yii\web\YiiAsset::register($this);
-?>
-<div class="marketplace-order1c-statuses-view m-5">
-
-    <h1>
-        <?= Html::a('Назад', ['index'], ['class' => 'btn btn-secondary btn-sm'])?>
-        <?= Html::encode($this->title) ?>
-    </h1>
-
-    <p>
-        <?= Html::a('Обновить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
-        <?= Html::a('Удалить', ['delete', 'id' => $model->id], [
-            'class' => 'btn btn-danger',
-            'data' => [
-                'confirm' => 'Вы уверены, что хотите удалить эту запись?',
-                'method' => 'post',
-            ],
-        ]) ?>
-    </p>
-
-    <?= DetailView::widget([
-        'model' => $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)
-                        ? '<span class="text-muted">— нет связи —</span>'
-                        : implode('<br>', $links);
-                },
-            ],
-        ],
-    ]) ?>
-
-</div>
diff --git a/erp24/views/crud/marketplace-order1c-statuses/_form.php b/erp24/views/crud/marketplace-order1c-statuses/_form.php
new file mode 100644 (file)
index 0000000..98a26a0
--- /dev/null
@@ -0,0 +1,156 @@
+<?php
+use yii\helpers\Html;
+use yii\helpers\Json;
+use yii\web\View;
+use yii\widgets\ActiveForm;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
+/** @var yii_app\records\MarketplaceOrder1cStatusesRelations[] $relationModels */
+/** @var array $statusOptions  (ключ = id, значение = статус) */
+
+$jsonStatuses = Json::encode($statusOptions);
+
+
+$this->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]
+);
+
+
+?>
+
+<div class="marketplace-order1c-statuses-form">
+    <?php if (Yii::$app->session->hasFlash('error')): ?>
+        <div class="alert alert-danger" role="alert">
+            <?= Yii::$app->session->getFlash('error') ?>
+        </div>
+    <?php endif; ?>
+
+    <?php $form = ActiveForm::begin(); ?>
+
+    <?= $form->field($model, 'marketplace_id')
+        ->dropDownList(
+            [1 => 'ФлауВау', 2 => 'ЯндексМаркет'],
+            [
+                'prompt' => 'Выберите маркетплейс',
+                'id' => 'marketplace-order1cstatuses-marketplace_id',
+            ]
+        ) ?>
+
+    <?= $form->field($model, 'status')->textInput(['maxlength' => true]) ?>
+
+    <?= $form->field($model, 'status_instruction')->textarea(['rows' => 4]) ?>
+
+    <hr>
+
+    <h4>Связанные статусы (relations)</h4>
+    <div id="relations-container">
+        <?php foreach ($relationModels as $i => $rel):
+            $initialOrder = $rel->order ?: ($i + 1);
+            ?>
+            <div class="relation-item" style="border:1px solid #ddd; padding:10px; margin-bottom:10px; position: relative; background:#f9f9f9;">
+                <span class="drag-handle" style="cursor:move; font-size:18px; margin-right:8px;" title="Перетащите, чтобы изменить порядок">☰</span>
+                <strong>Порядок: <span class="order-label"><?= $initialOrder ?></span></strong>
+
+                <?= Html::hiddenInput("Relations[{$i}][order]", $initialOrder, ['class' => 'rel-order-input']) ?>
+
+                <div style="margin-top:8px;">
+                    <?= Html::label('Статус-назначения', null, ['class' => 'control-label']) ?>
+                    <?= Html::dropDownList(
+                        "Relations[{$i}][status_id_to]",
+                        $rel->status_id_to,
+                        [],
+                        [
+                            'prompt'       => '— выберите статус —',
+                            'class'        => 'form-control status-to-select',
+
+                            'data-current' => $rel->status_id_to,
+                        ]
+                    ); ?>
+                </div>
+
+                <div style="margin-top:8px;">
+                    <?= Html::label('Описание (description)', null, ['class' => 'control-label']) ?>
+                    <?= Html::textInput(
+                        "Relations[{$i}][description]",
+                        $rel->description,
+                        ['class' => 'form-control']
+                    ); ?>
+                </div>
+
+                <div style="margin-top:8px;">
+                    <?= Html::label('Текст кнопки (button_text)', null, ['class' => 'control-label']) ?>
+                    <?= Html::textInput(
+                        "Relations[{$i}][button_text]",
+                        $rel->button_text,
+                        ['class' => 'form-control']
+                    ); ?>
+                </div>
+
+                <button type="button" class="btn btn-danger btn-sm remove-relation-btn"
+                        style="position:absolute; top:10px; right:10px;">
+                   Удалить
+                </button>
+            </div>
+        <?php endforeach; ?>
+    </div>
+
+    <button type="button" id="add-relation-btn" class="btn btn-primary btn-sm" style="margin-bottom:15px;">
+        &plus; Добавить ещё одну связь
+    </button>
+
+    <div class="form-group">
+        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
+    </div>
+
+    <?php ActiveForm::end(); ?>
+
+
+    <div id="relation-template" style="display:none;">
+        <div class="relation-item template" style="border:1px solid #ddd; padding:10px; margin-bottom:10px; position: relative; background:#f9f9f9;">
+            <span class="drag-handle" style="cursor:move; font-size:18px; margin-right:8px;" title="Перетащите, чтобы изменить порядок">☰</span>
+            <strong>Порядок: <span class="order-label">__order__</span></strong>
+
+            <?= Html::hiddenInput("Relations[__index__][order]", "__order__", ['class' => 'rel-order-input']) ?>
+
+            <div style="margin-top:8px;">
+                <?= Html::label('Статус-назначения', null, ['class' => 'control-label']) ?>
+                <?= Html::dropDownList(
+                    "Relations[__index__][status_id_to]",
+                    null,
+                    [],
+                    [
+                        'prompt'       => '— выберите статус —',
+                        'class'        => 'form-control status-to-select',
+                        'data-current' => '',
+                    ]
+                ); ?>
+            </div>
+
+            <div style="margin-top:8px;">
+                <?= Html::label('Описание (description)', null, ['class' => 'control-label']) ?>
+                <?= Html::textInput("Relations[__index__][description]", null, ['class' => 'form-control']) ?>
+            </div>
+
+            <div style="margin-top:8px;">
+                <?= Html::label('Текст кнопки (button_text)', null, ['class' => 'control-label']) ?>
+                <?= Html::textInput("Relations[__index__][button_text]", null, ['class' => 'form-control']) ?>
+            </div>
+
+            <button type="button" class="btn btn-danger btn-sm remove-relation-btn"
+                    style="position:absolute; top:10px; right:10px;">
+                Удалить
+            </button>
+        </div>
+    </div>
+</div>
\ 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 (file)
index 0000000..e3140d6
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
+
+$this->title = 'Create Marketplace Order1c Statuses';
+$this->params['breadcrumbs'][] = ['label' => 'Marketplace Order1c Statuses', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="marketplace-order1c-statuses-create m-5">
+
+    <h1><?= Html::encode($this->title) ?></h1>
+
+    <?= $this->render('_form', [
+        'model'           => $model,
+        'relationModels'  => $relationModels,
+        'statusOptions'   => $statusOptions,
+    ]) ?>
+
+</div>
diff --git a/erp24/views/crud/marketplace-order1c-statuses/index.php b/erp24/views/crud/marketplace-order1c-statuses/index.php
new file mode 100644 (file)
index 0000000..628305f
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+
+use yii_app\records\MarketplaceOrder1cStatuses;
+use yii\helpers\Html;
+use yii\helpers\Url;
+use yii\grid\ActionColumn;
+use yii\grid\GridView;
+
+/** @var yii\web\View $this */
+/** @var yii\data\ActiveDataProvider $dataProvider */
+
+$this->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;
+?>
+<div class="marketplace-order1c-statuses-index m-5">
+
+    <h1><?= Html::encode($this->title) ?></h1>
+
+    <p>
+        <?= Html::a('Создать Маркетплейс Статус Заказа', ['create'], ['class' => 'btn btn-success']) ?>
+    </p>
+
+
+    <?= GridView::widget([
+        'dataProvider' => $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)
+                        ? '<span class="text-muted">— нет связи —</span>'
+                        : implode('<br>', $links);
+                },
+            ],
+        ],
+    ]); ?>
+
+
+</div>
diff --git a/erp24/views/crud/marketplace-order1c-statuses/update.php b/erp24/views/crud/marketplace-order1c-statuses/update.php
new file mode 100644 (file)
index 0000000..2bdf182
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+use yii\helpers\Html;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
+
+$this->title = 'Обновить маркетплейс статус заказа: ' . $model->id;
+$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статус заказа', 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = 'Update';
+?>
+<div class="marketplace-order1c-statuses-update m-5">
+
+    <h1>
+        <?= Html::a('Назад', ['index'], ['class' => 'btn btn-secondary btn-sm'])?>
+        <?= Html::encode($this->title) ?>
+    </h1>
+
+    <?= $this->render('_form', [
+        'model'           => $model,
+        'relationModels'  => $relationModels,
+        'statusOptions'   => $statusOptions,
+    ]) ?>
+
+</div>
diff --git a/erp24/views/crud/marketplace-order1c-statuses/view.php b/erp24/views/crud/marketplace-order1c-statuses/view.php
new file mode 100644 (file)
index 0000000..05b484f
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+use yii_app\records\MarketplaceOrder1cStatuses;
+
+/** @var yii\web\View $this */
+/** @var yii_app\records\MarketplaceOrder1cStatuses $model */
+
+$this->title = $model->id;
+$this->params['breadcrumbs'][] = ['label' => 'Маркетплейс статусы заказа', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+\yii\web\YiiAsset::register($this);
+?>
+<div class="marketplace-order1c-statuses-view m-5">
+
+    <h1>
+        <?= Html::a('Назад', ['index'], ['class' => 'btn btn-secondary btn-sm'])?>
+        <?= Html::encode($this->title) ?>
+    </h1>
+
+    <p>
+        <?= Html::a('Обновить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+        <?= Html::a('Удалить', ['delete', 'id' => $model->id], [
+            'class' => 'btn btn-danger',
+            'data' => [
+                'confirm' => 'Вы уверены, что хотите удалить эту запись?',
+                'method' => 'post',
+            ],
+        ]) ?>
+    </p>
+
+    <?= DetailView::widget([
+        'model' => $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)
+                        ? '<span class="text-muted">— нет связи —</span>'
+                        : implode('<br>', $links);
+                },
+            ],
+        ],
+    ]) ?>
+
+</div>