{
$request = Yii::$app->request;
$post = $request->post();
- $month = $post['DynamicModel']['month'] ?? 5;
- $year = $post['DynamicModel']['year'] ?? 2025;
+ $month = $post['DynamicModel']['month'] ?? (int)date('m');
+ $year = $post['DynamicModel']['year'] ?? (int)date('Y');
$model = DynamicModel::validateData(
['month' => $month, 'year' => $year],
[
[['month', 'year'], 'required'],
['month', 'integer', 'min' => 1, 'max' => 12],
- ['year', 'integer', 'min' => 2000, 'max' => 2100],
+ ['year', 'integer', 'min' => 2020, 'max' => 2100],
]
);
$request->post('DynamicModel', [])
);
- $month = $params['month'] ?? 5;
- $year = $params['year'] ?? 2025;
+ $month = $params['month'] ?? (int)date('m');
+ $year = $params['year'] ?? (int)date('Y');
$storeId = $params['storeId'] ?? 2;
$matrix = $params['matrix'] ?? [];
[['month','year','storeId'], 'required'],
['month','integer','min'=>1,'max'=>12],
['storeId','integer','min'=>1],
- ['year','integer','min'=>2000,'max'=>2100],
+ ['year','integer','min'=>2020,'max'=>2100],
]
);
'matrixGroups' => $matrixGroups,
]);
}
- public function actionGetGuidBouquets()
+ public function actionImportMatrixBouquetsForecast()
{
$model = new DynamicModel(['excelFile']);
$model->addRule('excelFile', 'file', ['extensions' => ['xls', 'xlsx'], 'skipOnEmpty' => false]);
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
- return $this->render('get-guid-bouquet', [
+ return $this->render('import-matrix-bouquets-forecast', [
'searchModel' => $searchModel,
'model' => $model,
'dataProvider' => $dataProvider,
+++ /dev/null
-<?php
-
-use yii\widgets\ActiveForm;
-use yii\helpers\Html;
-use kartik\grid\GridView;
-use yii_app\records\MatrixBouquetForecastSearch;
-
-/** @var yii\web\View $this */
-/** @var yii\data\ActiveDataProvider $dataProvider */
-/** @var \yii\base\DynamicModel $model */
-/** @var yii_app\records\MatrixBouquetForecastSearch $searchModel */
-
-$this->title = 'Импорт прогноза по букетам';
-?>
-<div class="get-bouquet-guid p-4">
- <h1><?= Html::encode($this->title) ?></h1>
-
-<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
-<?= $form->field($model, 'excelFile')->fileInput() ?>
- <div class="form-group">
- <?= Html::submitButton('Загрузить', ['class' => 'btn btn-success']) ?>
- </div>
-<?php ActiveForm::end(); ?>
-
-<?php if (!empty($dataProvider)): ?>
- <?= GridView::widget([
- 'dataProvider' => $dataProvider,
- 'filterModel' => $searchModel,
- 'columns' => [
- 'id',
- 'guid',
- [
- 'attribute' => 'group',
- 'label' => 'Группа букета',
- ],
- [
- 'attribute' => 'name',
- 'label' => 'Название букета',
- ],
- 'year',
- 'month',
- 's_store',
- 'm_store',
- 'l_store',
- 'xl_store',
- 'marketplace',
- 'internet',
- ],
- ]) ?>
-<?php endif; ?>
-
-</div>
--- /dev/null
+<?php
+
+use yii\widgets\ActiveForm;
+use yii\helpers\Html;
+use kartik\grid\GridView;
+use yii_app\records\MatrixBouquetForecastSearch;
+
+/** @var yii\web\View $this */
+/** @var yii\data\ActiveDataProvider $dataProvider */
+/** @var \yii\base\DynamicModel $model */
+/** @var yii_app\records\MatrixBouquetForecastSearch $searchModel */
+
+$this->title = 'Импорт прогноза по букетам';
+?>
+<div class="get-bouquet-guid p-4">
+ <h1><?= Html::encode($this->title) ?></h1>
+
+<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
+<?= $form->field($model, 'excelFile')->fileInput() ?>
+ <div class="form-group">
+ <?= Html::submitButton('Загрузить', ['class' => 'btn btn-success']) ?>
+ </div>
+<?php ActiveForm::end(); ?>
+
+<?php if (!empty($dataProvider)): ?>
+ <?= GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ 'id',
+ 'guid',
+ [
+ 'attribute' => 'group',
+ 'label' => 'Группа букета',
+ ],
+ [
+ 'attribute' => 'name',
+ 'label' => 'Название букета',
+ ],
+ 'year',
+ 'month',
+ 's_store',
+ 'm_store',
+ 'l_store',
+ 'xl_store',
+ 'marketplace',
+ 'internet',
+ ],
+ ]) ?>
+<?php endif; ?>
+
+</div>