Commit a6ba09379ea6ef11104e3122e2166ef0d5dd843c

Authored by Alexey Boroda
1 parent a61ab7a7

-Stocks prettified

assets/StockAsset.php
1 1 <?php
2   -namespace artbox\stock\assets;
3   -
4   -use yii\web\AssetBundle;
5   -/**
6   - * Created by PhpStorm.
7   - * User: stes
8   - * Date: 26.07.17
9   - * Time: 16:10
10   - */
11   -class StockAsset extends AssetBundle
12   -{
13   - public $sourcePath = '@artbox/stock/web';
14   -
15   - public $css = [];
  2 + namespace artbox\stock\assets;
  3 +
  4 + use yii\web\AssetBundle;
16 5  
17 6 /**
18   - * @inheritdoc
  7 + * Class StockAsset
  8 + *
  9 + * @package artbox\stock\assets
19 10 */
20   - public $js = [
21   - 'js/stock.js',
22   -
23   - ];
24   -
25   - public $depends = [
26   - 'yii\web\JqueryAsset'
27   - ];
28   -}
29 11 \ No newline at end of file
  12 + class StockAsset extends AssetBundle
  13 + {
  14 + public $sourcePath = '@artbox/stock/web';
  15 +
  16 + public $css = [];
  17 +
  18 + /**
  19 + * @inheritdoc
  20 + */
  21 + public $js = [
  22 + 'js/stock.js',
  23 +
  24 + ];
  25 +
  26 + public $depends = [
  27 + 'yii\web\JqueryAsset',
  28 + ];
  29 + }
30 30 \ No newline at end of file
... ...
controllers/CityController.php
1 1 <?php
2   -
3   -namespace artbox\stock\controllers;
4   -
5   -use Yii;
6   -use artbox\stock\models\City;
7   -use yii\data\ActiveDataProvider;
8   -use yii\web\Controller;
9   -use yii\web\NotFoundHttpException;
10   -use yii\filters\VerbFilter;
11   -use yii\filters\AccessControl;
12   -use yii\web\Response;
13   -/**
14   - * CityController implements the CRUD actions for City model.
15   - */
16   -class CityController extends Controller
17   -{
  2 +
  3 + namespace artbox\stock\controllers;
  4 +
  5 + use artbox\stock\models\City;
  6 + use yii\data\ActiveDataProvider;
  7 + use yii\web\Controller;
  8 + use yii\web\NotFoundHttpException;
  9 + use yii\filters\VerbFilter;
  10 + use yii\filters\AccessControl;
  11 +
18 12 /**
19   - * @inheritdoc
  13 + * CityController implements the CRUD actions for City model.
20 14 */
21   - public function getViewPath()
  15 + class CityController extends Controller
22 16 {
23   - return '@artbox/stock/views/city';
24   - }
25   -
26   - public function behaviors()
27   - {
28   - return [
29   - 'access' => [
30   - 'class' => AccessControl::className(),
31   - 'rules' => [
32   - [
33   - 'actions' => [
34   - 'login',
35   - 'error',
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public function getViewPath()
  21 + {
  22 + return '@artbox/stock/views/city';
  23 + }
  24 +
  25 + public function behaviors()
  26 + {
  27 + return [
  28 + 'access' => [
  29 + 'class' => AccessControl::className(),
  30 + 'rules' => [
  31 + [
  32 + 'actions' => [
  33 + 'login',
  34 + 'error',
  35 + ],
  36 + 'allow' => true,
  37 + ],
  38 + [
  39 + 'allow' => true,
  40 + 'roles' => [ '@' ],
36 41 ],
37   - 'allow' => true,
38   - ],
39   - [
40   - 'allow' => true,
41   - 'roles' => [ '@' ],
42 42 ],
43 43 ],
44   - ],
45   - 'verbs' => [
46   - 'class' => VerbFilter::className(),
47   - 'actions' => [
48   - 'delete' => ['POST'],
  44 + 'verbs' => [
  45 + 'class' => VerbFilter::className(),
  46 + 'actions' => [
  47 + 'delete' => [ 'POST' ],
  48 + ],
49 49 ],
50   - ],
51   - ];
52   - }
53   -
54   - /**
55   - * Lists all City models.
56   - * @return mixed
57   - */
58   - public function actionIndex()
59   - {
60   - $dataProvider = new ActiveDataProvider([
61   - 'query' => City::find()->with(['lang']),
62   - ]);
63   -
64   - return $this->render('index', [
65   - 'dataProvider' => $dataProvider,
66   - ]);
67   - }
68   -
69   - /**
70   - * Displays a single City model.
71   - * @param integer $id
72   - * @return mixed
73   - */
74   - public function actionView($id)
75   - {
76   - return $this->render('view', [
77   - 'model' => $this->findModel($id),
78   - ]);
79   - }
80   -
81   - /**
82   - * Creates a new City model.
83   - * If creation is successful, the browser will be redirected to the 'view' page.
84   - * @return mixed
85   - */
86   - public function actionCreate()
87   - {
88   - $model = new City();
89   - $model->generateLangs();
90   - if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) {
91   - return $this->redirect(
  50 + ];
  51 + }
  52 +
  53 + /**
  54 + * Lists all City models.
  55 + *
  56 + * @return mixed
  57 + */
  58 + public function actionIndex()
  59 + {
  60 + $dataProvider = new ActiveDataProvider(
  61 + [
  62 + 'query' => City::find()
  63 + ->with([ 'lang' ]),
  64 + ]
  65 + );
  66 +
  67 + return $this->render(
  68 + 'index',
92 69 [
93   - 'view',
94   - 'id' => $model->id,
  70 + 'dataProvider' => $dataProvider,
95 71 ]
96 72 );
97 73 }
98   - return $this->render(
99   - 'create',
100   - [
101   - 'model' => $model,
102   - 'modelLangs' => $model->modelLangs,
103   - ]
104   - );
105   - }
106   -
107   - /**
108   - * Updates an existing City model.
109   - * If update is successful, the browser will be redirected to the 'view' page.
110   - * @param integer $id
111   - * @return mixed
112   - */
113   - public function actionUpdate($id)
114   - {
115   - $model = $this->findModel($id);
116   -
117   - $model->generateLangs();
118   -
119   - if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) {
120   - return $this->redirect(
  74 +
  75 + /**
  76 + * Displays a single City model.
  77 + *
  78 + * @param integer $id
  79 + *
  80 + * @return mixed
  81 + */
  82 + public function actionView($id)
  83 + {
  84 + return $this->render(
  85 + 'view',
121 86 [
122   - 'view',
123   - 'id' => $model->id,
  87 + 'model' => $this->findModel($id),
124 88 ]
125 89 );
126 90 }
127   - return $this->render(
128   - 'update',
129   - [
130   - 'model' => $model,
131   - 'modelLangs' => $model->modelLangs,
132   - ]
133   - );
134   - }
135   -
136   - /**
137   - * Deletes an existing City model.
138   - * If deletion is successful, the browser will be redirected to the 'index' page.
139   - * @param integer $id
140   - * @return mixed
141   - */
142   - public function actionDelete($id)
143   - {
144   - $this->findModel($id)->delete();
145   -
146   - return $this->redirect(['index']);
147   - }
148   -
149   - /**
150   - * Finds the City model based on its primary key value.
151   - * If the model is not found, a 404 HTTP exception will be thrown.
152   - * @param integer $id
153   - * @return City the loaded model
154   - * @throws NotFoundHttpException if the model cannot be found
155   - */
156   - protected function findModel($id)
157   - {
158   - if (($model = City::findOne($id)) !== null) {
159   - return $model;
160   - } else {
161   - throw new NotFoundHttpException('The requested page does not exist.');
  91 +
  92 + /**
  93 + * Creates a new City model.
  94 + * If creation is successful, the browser will be redirected to the 'view' page.
  95 + *
  96 + * @return mixed
  97 + */
  98 + public function actionCreate()
  99 + {
  100 + $model = new City();
  101 + $model->generateLangs();
  102 + if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) {
  103 + return $this->redirect(
  104 + [
  105 + 'view',
  106 + 'id' => $model->id,
  107 + ]
  108 + );
  109 + }
  110 + return $this->render(
  111 + 'create',
  112 + [
  113 + 'model' => $model,
  114 + 'modelLangs' => $model->modelLangs,
  115 + ]
  116 + );
  117 + }
  118 +
  119 + /**
  120 + * Updates an existing City model.
  121 + * If update is successful, the browser will be redirected to the 'view' page.
  122 + *
  123 + * @param integer $id
  124 + *
  125 + * @return mixed
  126 + */
  127 + public function actionUpdate($id)
  128 + {
  129 + $model = $this->findModel($id);
  130 +
  131 + $model->generateLangs();
  132 +
  133 + if ($model->loadWithLangs(\Yii::$app->request) && $model->saveWithLangs()) {
  134 + return $this->redirect(
  135 + [
  136 + 'view',
  137 + 'id' => $model->id,
  138 + ]
  139 + );
  140 + }
  141 + return $this->render(
  142 + 'update',
  143 + [
  144 + 'model' => $model,
  145 + 'modelLangs' => $model->modelLangs,
  146 + ]
  147 + );
  148 + }
  149 +
  150 + /**
  151 + * Deletes an existing City model.
  152 + * If deletion is successful, the browser will be redirected to the 'index' page.
  153 + *
  154 + * @param integer $id
  155 + *
  156 + * @return mixed
  157 + */
  158 + public function actionDelete($id)
  159 + {
  160 + $this->findModel($id)
  161 + ->delete();
  162 +
  163 + return $this->redirect([ 'index' ]);
  164 + }
  165 +
  166 + /**
  167 + * Finds the City model based on its primary key value.
  168 + * If the model is not found, a 404 HTTP exception will be thrown.
  169 + *
  170 + * @param integer $id
  171 + *
  172 + * @return City the loaded model
  173 + * @throws NotFoundHttpException if the model cannot be found
  174 + */
  175 + protected function findModel($id)
  176 + {
  177 + if (( $model = City::findOne($id) ) !== null) {
  178 + return $model;
  179 + } else {
  180 + throw new NotFoundHttpException('The requested page does not exist.');
  181 + }
162 182 }
163 183 }
164   -}
... ...
models/City.php
1 1 <?php
2   -
3   -namespace artbox\stock\models;
4   -
5   -use Yii;
6   -use artbox\core\models\Language;
7   -use artbox\core\behaviors\LanguageBehavior;
8   -use yii\db\ActiveQuery;
9   -use yii\db\ActiveRecord;
10   -use yii\web\Request;
11   -
12   -/**
13   - * This is the model class for table "city".
14   - *
15   - * @property integer $id
16   - * @property integer $sort
17   - * @property boolean $status
18   - *
19   - * @property CityLang[] $cityLangs
20   - * @property Language[] $languages
21   - * @property Shop[] $shops
22   - */
23   -class City extends \yii\db\ActiveRecord
24   -{
25   - /**
26   - * @inheritdoc
27   - */
28   - public static function tableName()
29   - {
30   - return 'city';
31   - }
32   -
33   - public function behaviors()
34   - {
35   - return [
36   - 'language' => [
37   - 'class' => LanguageBehavior::className(),
38   - ],
39   - ];
40   - }
41   -
42   - /**
43   - * @inheritdoc
44   - */
45   - public function rules()
46   - {
47   - return [
48   - [['sort'], 'integer'],
49   - [['status'], 'boolean'],
50   - ];
51   - }
52   -
53   - /**
54   - * @inheritdoc
55   - */
56   - public function attributeLabels()
57   - {
58   - return [
59   - 'id' => 'ID',
60   - 'sort' => Yii::t('stock', 'Sort'),
61   - 'status' => Yii::t('stock', 'Status'),
62   - ];
63   - }
64   -
65   - /**
66   - * @return \yii\db\ActiveQuery
67   - */
68   - public function getCityLangs()
69   - {
70   - return $this->hasMany(CityLang::className(), ['city_id' => 'id'])
71   - ->inverseOf('city');
72   - }
73   -
74   - /**
75   - * @return \yii\db\ActiveQuery
76   - */
77   - public function getLanguages()
78   - {
79   - return $this->hasMany(Language::className(), ['id' => 'language_id'])->viaTable('city_lang', ['city_id' => 'id']);
80   - }
  2 +
  3 + namespace artbox\stock\models;
  4 +
  5 + use Yii;
  6 + use artbox\core\models\Language;
  7 + use artbox\core\behaviors\LanguageBehavior;
  8 + use yii\db\ActiveRecord;
  9 + use yii\web\Request;
81 10  
82 11 /**
83   - * @return \yii\db\ActiveQuery
  12 + * This is the model class for table "city".
  13 + *
  14 + * @property integer $id
  15 + * @property integer $sort
  16 + * @property boolean $status
  17 + * @property CityLang[] $cityLangs
  18 + * @property Language[] $languages
  19 + * @property CityLang[] $modelLangs
  20 + * @property Shop[] $shops
  21 + *
  22 + * @method bool saveWithLangs()
  23 + * @method bool loadWithLangs( Request $request)
  24 + * @method void generateLangs()
84 25 */
85   - public function getShops()
  26 + class City extends ActiveRecord
86 27 {
87   - return $this->hasMany(Shop::className(), ['city_id' => 'id']);
  28 + /**
  29 + * @inheritdoc
  30 + */
  31 + public static function tableName()
  32 + {
  33 + return 'city';
  34 + }
  35 +
  36 + public function behaviors()
  37 + {
  38 + return [
  39 + 'language' => [
  40 + 'class' => LanguageBehavior::className(),
  41 + ],
  42 + ];
  43 + }
  44 +
  45 + /**
  46 + * @inheritdoc
  47 + */
  48 + public function rules()
  49 + {
  50 + return [
  51 + [
  52 + [ 'sort' ],
  53 + 'integer',
  54 + ],
  55 + [
  56 + [ 'status' ],
  57 + 'boolean',
  58 + ],
  59 + ];
  60 + }
  61 +
  62 + /**
  63 + * @inheritdoc
  64 + */
  65 + public function attributeLabels()
  66 + {
  67 + return [
  68 + 'id' => 'ID',
  69 + 'sort' => Yii::t('stock', 'Sort'),
  70 + 'status' => Yii::t('stock', 'Status'),
  71 + ];
  72 + }
  73 +
  74 + /**
  75 + * @return \yii\db\ActiveQuery
  76 + */
  77 + public function getCityLangs()
  78 + {
  79 + return $this->hasMany(CityLang::className(), [ 'city_id' => 'id' ])
  80 + ->inverseOf('city');
  81 + }
  82 +
  83 + /**
  84 + * @return \yii\db\ActiveQuery
  85 + */
  86 + public function getLanguages()
  87 + {
  88 + return $this->hasMany(Language::className(), [ 'id' => 'language_id' ])
  89 + ->viaTable('city_lang', [ 'city_id' => 'id' ]);
  90 + }
  91 +
  92 + /**
  93 + * @return \yii\db\ActiveQuery
  94 + */
  95 + public function getShops()
  96 + {
  97 + return $this->hasMany(Shop::className(), [ 'city_id' => 'id' ]);
  98 + }
88 99 }
89   -}
... ...
views/city/index.php
1 1 <?php
2   -
3   -use yii\helpers\Html;
4   -use yii\grid\GridView;
5   -use yiister\gentelella\widgets\Panel;
6   -/* @var $this yii\web\View */
7   -/* @var $dataProvider yii\data\ActiveDataProvider */
8   -
9   -$this->title = 'Cities';
10   -$this->params['breadcrumbs'][] = \Yii::t('stock', $this->title);
  2 +
  3 + use yii\data\ActiveDataProvider;
  4 + use yii\helpers\Html;
  5 + use yii\grid\GridView;
  6 + use yii\web\View;
  7 + use yiister\gentelella\widgets\Panel;
  8 +
  9 + /**
  10 + * @var View $this
  11 + * @var ActiveDataProvider $dataProvider
  12 + */
  13 +
  14 + $this->title = 'Cities';
  15 + $this->params[ 'breadcrumbs' ][] = \Yii::t('stock', $this->title);
11 16 ?>
12 17 <div class="city-index">
13 18 <?php
14   - $xPanel = Panel::begin(
15   - [
16   - 'header' => \Yii::t('stock', Html::encode($this->title)),
17   - ]
18   - );
19   - ?>
20   - <h1><?= \Yii::t('stock', Html::encode($this->title)) ?></h1>
21   -
22   - <p>
23   - <?= Html::a(\Yii::t('stock', 'Create City'), ['create'], ['class' => 'btn btn-success']) ?>
24   - </p>
25   - <?= GridView::widget([
26   - 'dataProvider' => $dataProvider,
27   - 'columns' => [
28   - ['class' => 'yii\grid\SerialColumn'],
29   -
30   - 'id',
  19 + $xPanel = Panel::begin(
31 20 [
32   - 'attribute' => \Yii::t('stock', 'Title'),
33   - 'value' => 'lang.title',
  21 + 'header' => \Yii::t('stock', Html::encode($this->title)),
  22 + ]
  23 + );
  24 + ?>
  25 + <h1><?= \Yii::t('stock', Html::encode($this->title)) ?></h1>
  26 +
  27 + <p>
  28 + <?= Html::a(\Yii::t('stock', 'Create City'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
  29 + </p>
  30 + <?= GridView::widget(
  31 + [
  32 + 'dataProvider' => $dataProvider,
  33 + 'columns' => [
  34 + [ 'class' => 'yii\grid\SerialColumn' ],
  35 +
  36 + 'id',
  37 + [
  38 + 'attribute' => \Yii::t('stock', 'Title'),
  39 + 'value' => 'lang.title',
  40 + ],
  41 + 'sort',
  42 + 'status:boolean',
  43 +
  44 + [ 'class' => 'yii\grid\ActionColumn' ],
34 45 ],
35   - 'sort',
36   - 'status:boolean',
37   -
38   - ['class' => 'yii\grid\ActionColumn'],
39   - ],
40   - ]); ?>
  46 + ]
  47 + ); ?>
41 48 <?php
42   - $xPanel::end();
  49 + $xPanel::end();
43 50 ?>
44 51 </div>
... ...
views/shop/_form.php
1 1 <?php
2   -
3   -use yii\helpers\Html;
4   -use yii\widgets\ActiveForm;
5   -use artbox\core\widgets\LanguageForm;
6   -use kartik\select2\Select2;
7   -/* @var $this yii\web\View */
8   -/* @var $model artbox\stock\models\Shop */
9   -/* @var $form yii\widgets\ActiveForm */
10   -$days = ['Пн', "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"];
11   -//print_r($model->modeStr); die();
12   -
13   -\artbox\stock\assets\StockAsset::register($this);
  2 +
  3 + use yii\helpers\Html;
  4 + use yii\widgets\ActiveForm;
  5 + use artbox\core\widgets\LanguageForm;
  6 + use kartik\select2\Select2;
  7 +
  8 + /* @var $this yii\web\View */
  9 + /* @var $model artbox\stock\models\Shop */
  10 + /* @var $form yii\widgets\ActiveForm */
  11 + $days = [
  12 + \Yii::t('stock', 'Пн'),
  13 + "Вт",
  14 + "Ср",
  15 + "Чт",
  16 + "Пт",
  17 + "Сб",
  18 + "Вс",
  19 + ];
  20 +
  21 + \artbox\stock\assets\StockAsset::register($this);
14 22  
15 23 ?>
16 24 <div class="shop-form">
... ... @@ -22,50 +30,70 @@ $days = [&#39;Пн&#39;, &quot;Вт&quot;, &quot;Ср&quot;, &quot;Чт&quot;, &quot;Пт&quot;, &quot;Сб&quot;, &quot;Вс&quot;];
22 30 'form' => $form,
23 31 ]
24 32 ) ?>
25   - <?php foreach($days as $key => $day):?>
26   - <?= Html::beginTag('div')?>
27   - <?= Html::label($day.' c'); ?>
28   - <?= Html::textInput("Shop[modeStr][$key][from]", (isset($model->modeStr[$key]['from'])) ? $model->modeStr[$key]['from'] : '09:00', [
29   - 'size' => 10,
30   - 'type'=> 'time',
31   -
32   - ])?>
33   - <?= Html::label(' до '); ?>
34   -
35   - <?= Html::textInput("Shop[modeStr][$key][to]", (isset($model->modeStr[$key]['to'])) ? $model->modeStr[$key]['to'] : '18:00', [
36   - 'size' => 10,
37   - 'type'=> 'time',
38   - ])?>
  33 + <?php foreach ($days as $key => $day): ?>
  34 + <?= Html::beginTag('div') ?>
  35 + <?= Html::label($day . ' c'); ?>
  36 + <?= Html::textInput(
  37 + "Shop[modeStr][$key][from]",
  38 + ( isset($model->modeStr[ $key ][ 'from' ]) ) ? $model->modeStr[ $key ][ 'from' ] : '09:00',
  39 + [
  40 + 'size' => 10,
  41 + 'type' => 'time',
  42 +
  43 + ]
  44 + ) ?>
  45 + <?= Html::label(' до '); ?>
  46 +
  47 + <?= Html::textInput(
  48 + "Shop[modeStr][$key][to]",
  49 + ( isset($model->modeStr[ $key ][ 'to' ]) ) ? $model->modeStr[ $key ][ 'to' ] : '18:00',
  50 + [
  51 + 'size' => 10,
  52 + 'type' => 'time',
  53 + ]
  54 + ) ?>
39 55 <?= Html::label(' выходной '); ?>
40   - <?= Html::checkbox("Shop[modeStr][$key][off]", (isset($model->modeStr[$key]['off'])) ? true : false)?>
41   - <?= Html::endTag('div');?>
42   - <?php endforeach;?>
43   - <?php if ($model->modeStr['data']):?>
44   -
45   - <?php foreach ($model->modeStr['data'] as $key => $data):?>
46   - <?= Html::beginTag('div')?>
  56 + <?= Html::checkbox("Shop[modeStr][$key][off]", ( isset($model->modeStr[ $key ][ 'off' ]) ) ? true : false) ?>
  57 + <?= Html::endTag('div'); ?>
  58 + <?php endforeach; ?>
  59 + <?php if ($model->modeStr[ 'data' ]): ?>
  60 +
  61 + <?php foreach ($model->modeStr[ 'data' ] as $key => $data): ?>
  62 + <?= Html::beginTag('div') ?>
47 63 <?= Html::label(' Дата'); ?>
48   - <?= Html::textInput("Shop[modeStr][data][$key][data]", (isset($data['data'])) ? $data['data'] : '', [
49   - 'size' => 10,
50   - 'type'=> 'data',
51   - ])?>
  64 + <?= Html::textInput(
  65 + "Shop[modeStr][data][$key][data]",
  66 + ( isset($data[ 'data' ]) ) ? $data[ 'data' ] : '',
  67 + [
  68 + 'size' => 10,
  69 + 'type' => 'data',
  70 + ]
  71 + ) ?>
52 72 <?= Html::label(' c'); ?>
53   - <?= Html::textInput("Shop[modeStr][data][$key][from]", (isset($data['from'])) ? $data['from'] : '', [
54   - 'size' => 10,
55   - 'type'=> 'time',
56   -
57   - ])?>
  73 + <?= Html::textInput(
  74 + "Shop[modeStr][data][$key][from]",
  75 + ( isset($data[ 'from' ]) ) ? $data[ 'from' ] : '',
  76 + [
  77 + 'size' => 10,
  78 + 'type' => 'time',
  79 +
  80 + ]
  81 + ) ?>
58 82 <?= Html::label(' до '); ?>
59   -
60   - <?= Html::textInput("Shop[modeStr][data][$key][to]", (isset($data['to'])) ? $data['to'] : '', [
61   - 'size' => 10,
62   - 'type'=> 'time',
63   - ])?>
  83 +
  84 + <?= Html::textInput(
  85 + "Shop[modeStr][data][$key][to]",
  86 + ( isset($data[ 'to' ]) ) ? $data[ 'to' ] : '',
  87 + [
  88 + 'size' => 10,
  89 + 'type' => 'time',
  90 + ]
  91 + ) ?>
64 92 <?= Html::label(' выходной '); ?>
65   - <?= Html::checkbox("Shop[modeStr][data][$key][off]", (isset($data['off'])) ? true : false)?>
66   - <?= Html::endTag('div');?>
67   - <?php endforeach;?>
68   - <?php endif?>
  93 + <?= Html::checkbox("Shop[modeStr][data][$key][off]", ( isset($data[ 'off' ]) ) ? true : false) ?>
  94 + <?= Html::endTag('div'); ?>
  95 + <?php endforeach; ?>
  96 + <?php endif ?>
69 97 <?= Html::button(
70 98 Html::tag(
71 99 'li',
... ... @@ -75,29 +103,36 @@ $days = [&#39;Пн&#39;, &quot;Вт&quot;, &quot;Ср&quot;, &quot;Чт&quot;, &quot;Пт&quot;, &quot;Сб&quot;, &quot;Вс&quot;];
75 103 ]
76 104 ) . ' Добавить дату',
77 105 [
78   - 'id' => 'add-data',
79   - 'class' => 'btn btn-success',
80   - 'data-count' => (isset($model->modeStr['data'])) ? count($model->modeStr['data']) : 0,
  106 + 'id' => 'add-data',
  107 + 'class' => 'btn btn-success',
  108 + 'data-count' => ( isset($model->modeStr[ 'data' ]) ) ? count($model->modeStr[ 'data' ]) : 0,
81 109 ]
82 110 ) ?>
83   -
84   -
85   -
86   - <?= Select2::widget([
87   - 'name' => 'Shop[city_id]',
88   - 'value' => array_keys($model->cities),
89   - 'data' => $model->cities,
90   - 'options' => ['placeholder' => 'Выберите город ...']
91   - ]); ?>
92   -
93   - <?= $form->field($model, 'sort')->textInput() ?>
94   -
95   - <?= $form->field($model, 'status')->checkbox() ?>
96   -
97   - <div class="form-group">
98   - <?= Html::submitButton($model->isNewRecord ? \Yii::t('stock', 'Create'): \Yii::t('stock', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
99   - </div>
100   -
  111 +
  112 +
  113 +
  114 + <?= Select2::widget(
  115 + [
  116 + 'name' => 'Shop[city_id]',
  117 + 'value' => array_keys($model->cities),
  118 + 'data' => $model->cities,
  119 + 'options' => [ 'placeholder' => 'Выберите город ...' ],
  120 + ]
  121 + ); ?>
  122 +
  123 + <?= $form->field($model, 'sort')
  124 + ->textInput() ?>
  125 +
  126 + <?= $form->field($model, 'status')
  127 + ->checkbox() ?>
  128 +
  129 + <div class="form-group">
  130 + <?= Html::submitButton(
  131 + $model->isNewRecord ? \Yii::t('stock', 'Create') : \Yii::t('stock', 'Update'),
  132 + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]
  133 + ) ?>
  134 + </div>
  135 +
101 136 <?php ActiveForm::end(); ?>
102 137 </div>
103 138 <!--<script>-->
... ...