From: marina Date: Mon, 24 Mar 2025 06:12:53 +0000 (+0300) Subject: ERP-358 Сверстать интерфейс автопм X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=1105da807ab28e779464a2fe5ce9d62deae438c6;p=erp24_rep%2Fyii-erp24%2F.git ERP-358 Сверстать интерфейс автопм --- diff --git a/erp24/actions/shipment/AutoPlanogrammaAction.php b/erp24/actions/shipment/AutoPlanogrammaAction.php new file mode 100644 index 00000000..7479fee6 --- /dev/null +++ b/erp24/actions/shipment/AutoPlanogrammaAction.php @@ -0,0 +1,44 @@ +select([ + 'category', + new Expression("jsonb_object_agg(subcategory, products) AS subcategories") + ]) + ->from( + (new Query()) + ->select([ + 'category', + 'subcategory', + new Expression('array_agg(name) AS products') + ]) + ->from('products_1c_nomenclature') + ->andWhere(['ilike', 'name', 'роз']) + ->groupBy(['category', 'subcategory']) + ) + ->groupBy('category') + ->asArray() + ->all(); + + $dataProvider = new ArrayDataProvider([ + + ]); + + return $this->controller->render('auto-planogramma', [ + 'categories' => $categories + ]); + } +} diff --git a/erp24/controllers/ShipmentController.php b/erp24/controllers/ShipmentController.php index 9bc3b584..02f7e87b 100755 --- a/erp24/controllers/ShipmentController.php +++ b/erp24/controllers/ShipmentController.php @@ -11,6 +11,7 @@ class ShipmentController extends Controller public function actions() { return [ 'add' => \yii_app\actions\shipment\AddAction::class, + 'auto-planogramma' => \yii_app\actions\shipment\AutoPlanogrammaAction::class, ]; } @@ -39,10 +40,4 @@ class ShipmentController extends Controller public function actionConfigSort() { return $this->render('config-sort'); } public function actionFields() { return $this->render('fields'); } public function actionStatusesEdit() { return $this->render('statuses-edit'); } - public function actionAutoPolnogramma() { - - return $this->render('auto-polnogramma', [ - 'categories' => Products1cNomenclature::find()->select('type_num')->groupBy('type_num')->all() - ]); - } } \ No newline at end of file diff --git a/erp24/views/shipment/auto-planogramma.php b/erp24/views/shipment/auto-planogramma.php new file mode 100644 index 00000000..7d289a30 --- /dev/null +++ b/erp24/views/shipment/auto-planogramma.php @@ -0,0 +1,314 @@ + '01 Ванеева 181', 'Значение' => 300], + ['Адрес' => '02 Плотникова 4', 'Значение' => 300], + ['Адрес' => '03 Гагарина 60', 'Значение' => 100], + ['Адрес' => '04 Московское шоссе 9а', 'Значение' => 50], + ['Адрес' => '05 Белинского 71', 'Значение' => 300], + ['Адрес' => '06 Коминтерна 168', 'Значение' => 160], + ['Адрес' => '07 Аэродромная', 'Значение' => 300], +]; +$addresses = array_column($data, 'Адрес'); +$values = array_column($data, 'Значение'); + +$row = array_combine($addresses, $values); +$dataProvider = new ArrayDataProvider([ + 'allModels' => [$row], + 'pagination' => false, +]); + +$tooltipText = "Оффлайн: 50 Флаумак (off-line): 20 Флаумак (on-line): 10 Флаумак (market): 10 Изумительная (off-line): 30 Списания: 20"; + +$columns = []; +foreach ($addresses as $address) { + $columns[] = [ + 'attribute' => $address, + 'label' => $address, + 'format' => 'raw', + 'headerOptions' => ['style' => 'writing-mode: sideways-lr; text-align: center; white-space: nowrap; font-weight: bold; transform-origin: left bottom; padding-right: 7%;'], + 'value' => function ($model, $key, $index) use ($address, $tooltipText) { + return ' + + ' . Html::input('text', '', $model[$address], [ + 'class' => 'btn btn-primary', + 'data-bs-toggle' => 'tooltip', + 'data-bs-placement' => 'top', + 'title' => $tooltipText, + 'style' => 'background:#e73535;' + ]) . ' + + + + + ' . Html::input('text', '', $model[$address], [ + 'class' => 'btn btn-primary', + 'data-bs-toggle' => 'tooltip', + 'data-bs-placement' => 'top', + 'title' => $tooltipText, + 'style' => 'background:yellowgreen;' + ]) . ' + + + + ' . Html::input('text', '', $model[$address], [ + 'class' => 'btn btn-primary', + 'data-bs-toggle' => 'tooltip', + 'data-bs-placement' => 'top', + 'title' => $tooltipText, + 'style' => 'background:#3280cd;' + ]) . ' + + + + ' . Html::input('text', '', $model[$address], [ + 'class' => 'btn btn-primary', + 'data-bs-toggle' => 'tooltip', + 'data-bs-placement' => 'top', + 'title' => $tooltipText, + 'style' => 'background:yellowgreen;' + ]) . ' + + + + + '; + }, + ]; +} +?> +

+
+
+
+
+
+
+
+ 'year-filter', + 'data' => array_combine(range(date('Y') - 5, date('Y') + 5), range(date('Y') - 5, date('Y') + 5)), + 'options' => ['placeholder' => 'Год', 'id' => 'year'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+ 'city-filter', + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_CITY]), 'id', 'name'), + 'options' => ['placeholder' => 'Город', 'id' => 'city'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+ 'store-type-filter', + 'data' => ArrayHelper::map(StoreType::find()->orderBy('sequence_number')->all(), 'id', 'name'), + 'options' => ['placeholder' => 'Тип магазина', 'id' => 'store-type', 'style' => 'width: 110%;'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+ 'territorial-manager-filter', + 'data' => ArrayHelper::map( + array_merge( + Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_DIRECTOR]), + Admin::findAll(['id' => StoreDynamic::find()->andWhere(['category' => 3, 'active' => 1])->select('value_int')->column()]) + ), + 'id', + 'name', + ), + 'options' => ['placeholder' => 'Тер. управляющий', 'id' => 'territorial-manger'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+ 'polnogramma-type-filter', + 'data' => ['min' => 'min', 'max' => 'max'], + 'options' => ['placeholder' => 'Тип п-ма', 'id' => 'polnogramma-type'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+ 'btn btn-apply btn-primary', 'style' => 'width:100%']); ?> +
+
+
+
+ 'week-filter', + 'data' => ['1' => '1', '2' => '2'], + 'options' => ['placeholder' => 'Неделя', 'id' => 'week'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+ 'region-filter', + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_REGION]), 'id', 'name'), + 'options' => ['placeholder' => 'Регион', 'id' => 'region'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+
+
+ 'bush_chef_florist', + 'value' => null, + 'data' => ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name'), + 'options' => [ + 'placeholder' => 'Кустовой шеф-флорист', + 'class' => 'form-select', + 'id' => 'bush_chef_florist', + ], + 'pluginOptions' => [ + 'allowClear' => true, + ], + ]); ?> +
+
+
+
+
+
+
+ +
+
+ 'district-filter', + 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_DISTRICT]), 'id', 'name'), + 'options' => ['placeholder' => 'Район', 'id' => 'district'], + 'pluginOptions' => ['allowClear' => true], + ]) ?> +
+
+
+
+
+ 'btn btn-success btn-save', 'style' => 'width:100%']); ?> +
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+ 'btn btn-success', 'style' => 'width:25%']) ?> + 'btn btn-success', 'style' => 'width:25%']) ?> +
+
+
+
+ + + + +
+ +
+ + $products): ?> + +
+ +
+ + +
+ +
+ +
+ +
+ + + + + +
+
+ +
+
+ +
+
+ +
+ $dataProvider, + 'layout' => '{items}', // Только таблица, без пагинации + 'tableOptions' => ['class' => 'table table-bordered mt-2'], + 'columns' => $columns, + ]); + + ?> + +
+
+ diff --git a/erp24/views/shipment/auto-polnogramma.php b/erp24/views/shipment/auto-polnogramma.php deleted file mode 100644 index aa536f07..00000000 --- a/erp24/views/shipment/auto-polnogramma.php +++ /dev/null @@ -1,125 +0,0 @@ - -
-
-
- -
-
-
- 'year-filter', - 'data' => array_combine(range(date('Y') - 5, date('Y') + 5), range(date('Y') - 5, date('Y') + 5)), - 'options' => ['placeholder' => 'Год', 'id' => 'year'], - 'pluginOptions' => ['allowClear' => true], - ]) ?> -
-
- 'city-filter', - 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_CITY]), 'id', 'name'), - 'options' => ['placeholder' => 'Город', 'id' => 'city'], - 'pluginOptions' => ['allowClear' => true], - ]) ?> -
-
- 'store-type-filter', - 'data' => ArrayHelper::map(StoreType::find()->orderBy('sequence_number')->all(), 'id', 'name'), - 'options' => ['placeholder' => 'Тип магазина', 'id' => 'store-type', 'style' => 'width: 110%;'], - 'pluginOptions' => ['allowClear' => true], - ]) ?> -
-
- 'territorial-manager-filter', - 'data' => ArrayHelper::map( - array_merge( - Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_DIRECTOR]), - Admin::findAll(['id' => StoreDynamic::find()->andWhere(['category' => 3, 'active' => 1])->select('value_int')->column()]) - ), - 'id', - 'name', - ), - 'options' => ['placeholder' => 'Тер. управляющий', 'id' => 'territorial-manger'], - 'pluginOptions' => ['allowClear' => true], - ]) ?> -
-
- 'polnogramma-type-filter', - 'data' => ['min' => 'min', 'max' => 'max'], - 'options' => ['placeholder' => 'Тип п-ма', 'id' => 'polnogramma-type'], - 'pluginOptions' => ['allowClear' => true], - ]) ?> -
-
- 'btn btn-apply btn-primary', 'style' => 'width:100%']);?> -
-
-
-
- 'week-filter', - 'data' => ['1' => '1', '2' => '2'], - 'options' => ['placeholder' => 'Неделя', 'id' => 'week'], - 'pluginOptions' => ['allowClear' => true], - ]) ?> -
-
- 'region-filter', - 'data' => ArrayHelper::map(StoreCityList::findAll(['type' => StoreCityList::TYPE_REGION]), 'id', 'name'), - 'options' => ['placeholder' => 'Регион', 'id' => 'region'], - 'pluginOptions' => ['allowClear' => true], - ]) ?> -
-
- -
-
- 'bush_chef_florist', - 'value' => null, - 'data' => ArrayHelper::map(Admin::findAll(['group_id' => AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name'), - 'options' => [ - 'placeholder' => 'Кустовой шеф-флорист', - 'class' => 'form-select', - 'id' => 'bush_chef_florist', - ], - 'pluginOptions' => [ - 'allowClear' => true, - ], - ]); ?> -
-
- -
-
- 'btn btn-apply btn-save', 'style' => 'width:100%']);?> -
-
-
-
-
- $category->type_num"; - echo "
id}\">
"; - } - Bandoneon::end() ?> -
-
- -
\ No newline at end of file