"kartik-v/yii2-grid": "@dev",
"kartik-v/yii2-widget-datepicker": "dev-master",
"phpoffice/phpspreadsheet": "^2.2",
- "ext-xmlreader": "*"
+ "ext-xmlreader": "*",
+ "softark/yii2-dual-listbox": "^1.0"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.1.0",
--- /dev/null
+<?php
+
+namespace app\controllers;
+
+use Yii;
+use yii\data\ActiveDataProvider;
+use yii\web\Controller;
+use yii\web\NotFoundHttpException;
+use yii\filters\VerbFilter;
+use yii_app\records\CityStoreParams;
+
+/**
+ * CityStoreParamsController реализует CRUD для модели CityStoreParams.
+ */
+class CityStoreParamsController extends Controller
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function behaviors()
+ {
+ return [
+ 'verbs' => [
+ 'class' => VerbFilter::class,
+ 'actions' => [
+ 'delete' => ['post'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Список всех записей
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $dataProvider = new ActiveDataProvider([
+ 'query' => CityStoreParams::find(),
+ ]);
+
+ return $this->render('index', [
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Просмотр конкретной записи
+ * @param int $id
+ * @return mixed
+ * @throws NotFoundHttpException
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Создание новой записи
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new CityStoreParams();
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Обновление существующей записи
+ * @param int $id
+ * @return mixed
+ * @throws NotFoundHttpException
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+
+ if ($model->load(Yii::$app->request->post()) && $model->save()) {
+ return $this->redirect(['view', 'id' => $model->id]);
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Находит модель по первичному ключу
+ * @param int $id
+ * @return CityStoreParams
+ * @throws NotFoundHttpException
+ */
+ protected function findModel($id)
+ {
+ if (($model = CityStoreParams::findOne($id)) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%city_store_params}}`.
+ */
+class m250116_063609_create_city_store_params_table extends Migration
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $this->createTable('{{%erp24.city_store_params}}', [
+ 'id' => $this->primaryKey(),
+ 'store_id' => $this->integer()->notNull()->comment('ИД Магазина'),
+ 'stores_type' => $this->integer()->comment('Тип магазина'),
+ 'address_city' => $this->text()->comment('Город, где расположен магазин'),
+ 'address_region' => $this->text()->comment('Регион, где расположен магазин'),
+ 'address_district' => $this->text()->comment('Район, где расположен магазин'),
+ 'territorial_manager' => $this->integer()->comment('Территориально управляющий'),
+ 'bush_chef_florist' => $this->integer()->comment('Кустовой шеф-флорист'),
+ 'store_area' => $this->float()->comment('Площадь магазина'),
+ 'showcase_volume' => $this->float()->comment('Объем витрины'),
+ 'freeze_area' => $this->float()->comment('Площадь холодильника'),
+ 'freeze_volume' => $this->float()->comment('Объем холодильника'),
+ 'matrix_type' => $this->string()->comment('Тип матрицы'),
+ 'created_by' => $this->integer()->notNull()->comment('ИД создателя'),
+ 'created_at' => $this->timestamp()->notNull()->comment('Дата создания'),
+ 'updated_by' => $this->integer()->null()->comment('ИД редактировавшего'),
+ 'updated_at' => $this->timestamp()->null()->comment('Дата обновления')
+ ]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->dropTable('{{%erp24.city_store_params}}');
+ }
+}
const GROUP_WORKERS_ARCHIVE = 90;
const GROUP_ADMINISTRATORS = 50;
const GROUP_FLORIST_SUPPORT_NIGHT = 72;
+ const GROUP_BUSH_CHEF_FLORIST = 18;
+ const GROUP_BUSH_DIRECTOR = 7;
const GROUP_OPERATIONAL_DIRECTOR = 51;
const GROUP_IT = 81;
const GROUP_FINANCE_DIRECTOR = 9;
--- /dev/null
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+use yii\db\ActiveRecord;
+
+/**
+ * This is the model class for table "{{%city_store_params}}".
+ *
+ * @property int $id
+ * @property int $store_id
+ * @property int|null $stores_type
+ * @property string|null $address_city
+ * @property string|null $address_region
+ * @property string|null $address_district
+ * @property int|null $territorial_manager
+ * @property int|null $bush_chef_florist
+ * @property float|null $store_area
+ * @property float|null $showcase_volume
+ * @property float|null $freeze_area
+ * @property float|null $freeze_volume
+ * @property string|null $matrix_type
+ * @property int $created_by
+ * @property string $created_at
+ * @property int|null $updated_by
+ * @property string|null $updated_at
+ */
+class CityStoreParams extends ActiveRecord
+{
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return '{{%city_store_params}}';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['store_id', 'created_by', 'created_at'], 'required'],
+ [['store_id', 'stores_type', 'territorial_manager', 'bush_chef_florist', 'created_by', 'updated_by'], 'integer'],
+ [['store_area', 'showcase_volume', 'freeze_area', 'freeze_volume'], 'number'],
+ [['created_at', 'updated_at'], 'safe'],
+ [['address_city', 'address_region', 'address_district', 'matrix_type'], 'string'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID',
+ 'store_id' => 'ИД Магазина',
+ 'stores_type' => 'Тип магазина',
+ 'address_city' => 'Город, где расположен магазин',
+ 'address_region' => 'Регион, где расположен магазин',
+ 'address_district' => 'Район, где расположен магазин',
+ 'territorial_manager' => 'Территориально управляющий',
+ 'bush_chef_florist' => 'Кустовой шеф-флорист',
+ 'store_area' => 'Площадь магазина',
+ 'showcase_volume' => 'Объем витрины',
+ 'freeze_area' => 'Площадь холодильника',
+ 'freeze_volume' => 'Объем холодильника',
+ 'matrix_type' => 'Тип матрицы',
+ 'created_by' => 'ИД создателя',
+ 'created_at' => 'Дата создания',
+ 'updated_by' => 'ИД редактировавшего',
+ 'updated_at' => 'Дата обновления',
+ ];
+ }
+}
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+/* @var $this yii\web\View */
+/* @var $model app\models\CityStoreParams */
+/* @var $form yii\widgets\ActiveForm */
+?>
+
+<div class="city-store-params-form">
+
+ <?php $form = ActiveForm::begin(); ?>
+
+ <?= $form->field($model, 'store_id')->textInput() ?>
+
+ <?= $form->field($model, 'stores_type')->textInput() ?>
+
+ <?= $form->field($model, 'address_city')->textInput() ?>
+
+ <?= $form->field($model, 'address_region')->textInput() ?>
+
+ <?= $form->field($model, 'address_district')->textInput() ?>
+
+ <?= $form->field($model, 'territorial_manager')->textInput() ?>
+
+ <?= $form->field($model, 'bush_chef_florist')->textInput() ?>
+
+ <?= $form->field($model, 'store_area')->textInput() ?>
+
+ <?= $form->field($model, 'showcase_volume')->textInput() ?>
+
+ <?= $form->field($model, 'freeze_area')->textInput() ?>
+
+ <?= $form->field($model, 'freeze_volume')->textInput() ?>
+
+ <?= $form->field($model, 'matrix_type')->textInput() ?>
+
+ <div class="form-group">
+ <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Save', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
+ </div>
+
+ <?php ActiveForm::end(); ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+
+/* @var $this yii\web\View */
+/* @var $model app\models\CityStoreParams */
+
+$this->title = 'Create City Store Param';
+$this->params['breadcrumbs'][] = ['label' => 'City Store Params', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="city-store-params-create">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <?= $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use kartik\select2\Select2;
+use softark\duallistbox\DualListbox;
+use yii\helpers\Html;
+use yii\grid\GridView;
+use yii_app\records\City;
+
+/* @var $this yii\web\View */
+/* @var $dataProvider yii\data\ActiveDataProvider */
+
+$this->title = 'City Store Params';
+$this->params['breadcrumbs'][] = $this->title;
+?>
+ <div class="container mt-4 border-bottom">
+ <div class="row">
+ <div class="col-md-2">
+ <div class="card p-3 bg-light shadow-sm">
+ <?= Html::dropDownList('address_city', null, \yii\helpers\ArrayHelper::map(City::find()->all(), 'id_city', 'city_name_ru'), ['prompt' => 'Выберите город', 'class' => 'form-select']); ?>
+ </div>
+ </div>
+
+ <div class="col-md-2">
+ <div class="card p-3 bg-light shadow-sm">
+ <?= Html::dropDownList('address_region', null, \yii\helpers\ArrayHelper::map(City::find()->where(['!=', 'region_name', ''])->all(), 'id_region', 'region_name'), ['prompt' => 'Выберите регион', 'class' => 'form-select']); ?>
+ <?= Html::a('Редактировать', [\yii\helpers\Url::to('/store_type')], ['class' => 'd-block mt-2 text-decoration-none']); ?>
+ </div>
+ </div>
+
+ <div class="col-md-2 border-end border-2">
+ <div class="card p-3 bg-light shadow-sm">
+ <?= Html::dropDownList('address_district', null, \yii\helpers\ArrayHelper::map(City::find()->where(['!=', 'region_name', ''])->all(), 'id_region', 'region_name'), ['prompt' => 'Выберите район', 'class' => 'form-select']); ?>
+ </div>
+ </div>
+
+ <div class="col-md-2 border-end border-2">
+ <div class="card p-3 bg-light shadow-sm">
+ <?= Html::dropDownList('store_type', null, \yii\helpers\ArrayHelper::map(City::find()->where(['!=', 'region_name', ''])->all(), 'id_region', 'region_name'), ['prompt' => 'Выберите тип магазина', 'class' => 'form-select']); ?>
+ <?= Html::a('Редактировать', [\yii\helpers\Url::to('/store_type')], ['class' => 'd-block mt-2 text-decoration-none']); ?>
+ </div>
+ </div>
+
+ <div class="col-md-2 border-end border-2">
+ <div class="card p-3 bg-light shadow-sm">
+ <?= Html::dropDownList('territorial_manager', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Выберите территориального управляющего', 'class' => 'form-select']); ?>
+ </div>
+ </div>
+ </div>
+
+ <div class="row mt-3">
+ <div class="col-md-2"></div>
+
+ <div class="col-md-2"></div>
+
+ <div class="col-md-2"></div>
+
+ <div class="col-md-2 border-end border-2">
+ <div class="card p-3 bg-light shadow-sm">
+ <?= Html::dropDownList('bush_chef_florist', null, \yii\helpers\ArrayHelper::map(\yii_app\records\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_CHEF_FLORIST]), 'id', 'name_full'), ['prompt' => 'Выберите кустового шеф флориста', 'class' => 'form-select']); ?>
+ </div>
+ </div>
+
+ <div class="col-md-2"></div>
+
+ <div class="col-md-2 d-flex justify-content-center align-items-center">
+ <div class="card p-45 bg-light shadow-sm w-100">
+ <?= Html::button('Применить', ['class' => 'btn btn-primary w-100']); ?>
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="container mt-4">
+ <div class="row">
+ <div class="col-md-3">
+ <div class="form-group">
+ <?= Html::dropDownList('selectedValues[]', null, [
+ '1' => 'Option 1',
+ '2' => 'Option 2',
+ '3' => 'Option 3',
+ '4' => 'Option 4',
+ ], [
+ 'multiple' => true,
+ 'size' => 10, // Количество отображаемых строк
+ 'class' => 'form-control', // Стиль для кнопки
+ 'id' => 'selectedValues', // ID для элемента
+ ]) ?>
+ </div>
+ </div>
+ <div class="col-md-9">
+ <div class="form-group">
+ <div class="row">
+ <div class="col-md-1"></div>
+ <div class="col-md-3">
+ <?= Html::label('Название'); ?>
+ </div>
+ <div class="col-md-5">
+ <?= Html::dropDownList('store_type', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Тип магазина', 'class' => 'form-select']); ?>
+ <?= Html::a('Редактировать', [\yii\helpers\Url::to('/store_type')], ['class' => 'd-block mt-2 text-decoration-none']); ?>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-2 py-6">
+ <?= Html::label('Адрес', null, ['class' => 'h5']) ?>
+ </div>
+ <div class="col-md-3">
+ <?= Html::label('Регион'); ?>
+ <?= Html::dropDownList('city', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+ </div>
+ <div class="col-md-3">
+ <?= Html::label('Город'); ?>
+ <?= Html::dropDownList('city', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+ </div>
+ <div class="col-md-3">
+ <?= Html::label('Район'); ?>
+ <?= Html::dropDownList('city', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-2">
+ <?= Html::label('Территориально управляющий') ?>
+ <?= Html::a('Редактировать', [\yii\helpers\Url::to('/store_type')], ['class' => 'd-block mb-5 text-decoration-none']); ?>
+
+ </div>
+ <div class="col-md-9">
+ <?= Html::dropDownList('city', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+ </div>
+ </div>
+ <div class="row border-bottom">
+ <div class="col-md-2">
+ <?= Html::label('КШФ') ?>
+ <?= Html::a('Редактировать', [\yii\helpers\Url::to('/store_type')], ['class' => 'd-block mb-5 text-decoration-none']); ?>
+
+ </div>
+ <div class="col-md-9">
+ <?= Html::dropDownList('city', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+ </div>
+ </div>
+ <div class="row">
+ <!-- Лейбл и одиночные дропдауны -->
+ <div class="col-md-4">
+ <!-- Лейбл для первого города -->
+ <?= Html::label('Город 1', null, ['class' => 'form-label']); ?>
+ <?= Html::dropDownList('city1', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+
+ <!-- Лейбл для второго города -->
+ <?= Html::label('Город 2', null, ['class' => 'form-label']); ?>
+ <?= Html::dropDownList('city2', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+
+ <!-- Лейбл для третьего города -->
+ <?= Html::label('Город 3', null, ['class' => 'form-label']); ?>
+ <?= Html::dropDownList('city3', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+
+ <!-- Лейбл для четвертого города -->
+ <?= Html::label('Город 4', null, ['class' => 'form-label']); ?>
+ <?= Html::dropDownList('city4', null, \yii\helpers\ArrayHelper::map(\yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]), 'id', 'name_full'), ['prompt' => 'Город', 'class' => 'form-select']); ?>
+ </div>
+
+ <!-- Многовыборный дропдаун -->
+ <div class="col-md-8">
+ <div class="container mt-5">
+ <?= DualListbox::widget([
+ 'name' => 'matrix_type',
+ 'items' => \yii\helpers\ArrayHelper::map(
+ \yii_app\api3\modules\v1\models\Admin::findAll(['group_id' => \yii_app\records\AdminGroup::GROUP_BUSH_DIRECTOR]),
+ 'id', 'name_full'
+ ),
+ 'options' => [
+ 'size' => false
+ ],
+ 'clientOptions' => [
+ 'moveOnSelect' => false,
+ 'nonSelectedListLabel' => "Тип матрицы <br>" . Html::a('Редактировать', '#'), // Перенос строки с ссылкой
+ 'selectedListLabel' => " <br><br>",
+ 'showFilterInputs' => false,
+ 'clearButton' => false,
+ ],
+ ]); ?>
+ </div>
+ </div>
+ </div>
+
+ </div>
+ </div>
+ </div>
+ </div>
+
+
+<?php
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+
+/* @var $this yii\web\View */
+/* @var $model app\models\CityStoreParams */
+
+$this->title = 'Update City Store Param: ' . $model->id;
+$this->params['breadcrumbs'][] = ['label' => 'City Store Params', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="city-store-params-update">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <?= $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+</div>
--- /dev/null
+<?php
+
+use yii\helpers\Html;
+
+/* @var $this yii\web\View */
+/* @var $model app\models\CityStoreParams */
+
+$this->title = 'View City Store Param: ' . $model->id;
+$this->params['breadcrumbs'][] = ['label' => 'City Store Params', 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+<div class="city-store-params-view">
+
+ <h1><?= Html::encode($this->title) ?></h1>
+
+ <p>
+ <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ </p>
+
+ <table class="table table-bordered">
+ <tr>
+ <th>ID</th>
+ <td><?= Html::encode($model->id) ?></td>
+ </tr>
+ <tr>
+ <th>Store ID</th>
+ <td><?= Html::encode($model->store_id) ?></td>
+ </tr>
+ <!-- Добавьте остальные поля по аналогии -->
+ </table>
+</div>