Commit 2a0504102b0a2a38a0139dbc8584ffafa19b8f19
1 parent
ed038e99
Order
Showing
50 changed files
with
3304 additions
and
23 deletions
Show diff stats
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\assets; | ||
4 | + | ||
5 | + use yii\web\AssetBundle; | ||
6 | + | ||
7 | + /** | ||
8 | + * Asset class for artbox-order | ||
9 | + */ | ||
10 | + class OrderAsset extends AssetBundle | ||
11 | + { | ||
12 | + /** | ||
13 | + * @inheritdoc | ||
14 | + */ | ||
15 | + public $sourcePath = '@artbox/order/web'; | ||
16 | + | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public $css = []; | ||
21 | + | ||
22 | + /** | ||
23 | + * @inheritdoc | ||
24 | + */ | ||
25 | + public $js = [ | ||
26 | + 'js/order.js', | ||
27 | + ]; | ||
28 | + } |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\controllers; | ||
4 | + | ||
5 | + use artbox\order\models\DeliverySearch; | ||
6 | + use Yii; | ||
7 | + use artbox\order\models\Delivery; | ||
8 | + use yii\web\Controller; | ||
9 | + use yii\web\NotFoundHttpException; | ||
10 | + use yii\filters\VerbFilter; | ||
11 | + | ||
12 | + /** | ||
13 | + * DeliveryController implements the CRUD actions for Delivery model. | ||
14 | + */ | ||
15 | + class DeliveryController extends Controller | ||
16 | + { | ||
17 | + /** | ||
18 | + * @return bool|string | ||
19 | + */ | ||
20 | + public function getViewPath() | ||
21 | + { | ||
22 | + return \Yii::getAlias('@artbox/order/views/delivery'); | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public function behaviors() | ||
29 | + { | ||
30 | + return [ | ||
31 | + 'verbs' => [ | ||
32 | + 'class' => VerbFilter::className(), | ||
33 | + 'actions' => [ | ||
34 | + 'delete' => [ 'POST' ], | ||
35 | + ], | ||
36 | + ], | ||
37 | + ]; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Lists all Delivery models. | ||
42 | + * | ||
43 | + * @return mixed | ||
44 | + */ | ||
45 | + public function actionIndex() | ||
46 | + { | ||
47 | + $searchModel = new DeliverySearch(); | ||
48 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
49 | + | ||
50 | + return $this->render( | ||
51 | + 'index', | ||
52 | + [ | ||
53 | + 'searchModel' => $searchModel, | ||
54 | + 'dataProvider' => $dataProvider, | ||
55 | + ] | ||
56 | + ); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Displays a single Delivery model. | ||
61 | + * | ||
62 | + * @param integer $id | ||
63 | + * | ||
64 | + * @return mixed | ||
65 | + */ | ||
66 | + public function actionView($id) | ||
67 | + { | ||
68 | + return $this->render( | ||
69 | + 'view', | ||
70 | + [ | ||
71 | + 'model' => $this->findModel($id), | ||
72 | + ] | ||
73 | + ); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Creates a new Delivery model. | ||
78 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
79 | + * | ||
80 | + * @return mixed | ||
81 | + */ | ||
82 | + public function actionCreate() | ||
83 | + { | ||
84 | + $model = new Delivery(); | ||
85 | + $model->generateLangs(); | ||
86 | + if ($model->loadWithLangs(Yii::$app->request) && $model->saveWithLangs()) { | ||
87 | + return $this->redirect( | ||
88 | + [ | ||
89 | + 'view', | ||
90 | + 'id' => $model->id, | ||
91 | + ] | ||
92 | + ); | ||
93 | + } else { | ||
94 | + return $this->render( | ||
95 | + 'create', | ||
96 | + [ | ||
97 | + 'model' => $model, | ||
98 | + 'modelLangs' => $model->modelLangs, | ||
99 | + ] | ||
100 | + ); | ||
101 | + } | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Updates an existing Delivery model. | ||
106 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
107 | + * | ||
108 | + * @param integer $id | ||
109 | + * | ||
110 | + * @return mixed | ||
111 | + */ | ||
112 | + public function actionUpdate($id) | ||
113 | + { | ||
114 | + $model = $this->findModel($id); | ||
115 | + $model->generateLangs(); | ||
116 | + | ||
117 | + if ($model->loadWithLangs(Yii::$app->request) && $model->saveWithLangs()) { | ||
118 | + return $this->redirect( | ||
119 | + [ | ||
120 | + 'view', | ||
121 | + 'id' => $model->id, | ||
122 | + ] | ||
123 | + ); | ||
124 | + } else { | ||
125 | + return $this->render( | ||
126 | + 'update', | ||
127 | + [ | ||
128 | + 'model' => $model, | ||
129 | + 'modelLangs' => $model->modelLangs, | ||
130 | + ] | ||
131 | + ); | ||
132 | + } | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * Deletes an existing Delivery model. | ||
137 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
138 | + * | ||
139 | + * @param integer $id | ||
140 | + * | ||
141 | + * @return mixed | ||
142 | + */ | ||
143 | + public function actionDelete($id) | ||
144 | + { | ||
145 | + $this->findModel($id) | ||
146 | + ->delete(); | ||
147 | + | ||
148 | + return $this->redirect([ 'index' ]); | ||
149 | + } | ||
150 | + | ||
151 | + /** | ||
152 | + * Finds the Delivery model based on its primary key value. | ||
153 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
154 | + * | ||
155 | + * @param integer $id | ||
156 | + * | ||
157 | + * @return Delivery the loaded model | ||
158 | + * @throws NotFoundHttpException if the model cannot be found | ||
159 | + */ | ||
160 | + protected function findModel($id) | ||
161 | + { | ||
162 | + if (( $model = Delivery::findOne($id) ) !== null) { | ||
163 | + return $model; | ||
164 | + } else { | ||
165 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
166 | + } | ||
167 | + } | ||
168 | + } |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\controllers; | ||
4 | + | ||
5 | + use artbox\order\models\LabelSearch; | ||
6 | + use Yii; | ||
7 | + use artbox\order\models\Label; | ||
8 | + use yii\web\Controller; | ||
9 | + use yii\web\NotFoundHttpException; | ||
10 | + use yii\filters\VerbFilter; | ||
11 | + | ||
12 | + /** | ||
13 | + * LabelController implements the CRUD actions for Label model. | ||
14 | + */ | ||
15 | + class LabelController extends Controller | ||
16 | + { | ||
17 | + /** | ||
18 | + * @return bool|string | ||
19 | + */ | ||
20 | + public function getViewPath() | ||
21 | + { | ||
22 | + return \Yii::getAlias('@artbox/order/views/label'); | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public function behaviors() | ||
29 | + { | ||
30 | + return [ | ||
31 | + 'verbs' => [ | ||
32 | + 'class' => VerbFilter::className(), | ||
33 | + 'actions' => [ | ||
34 | + 'delete' => [ 'POST' ], | ||
35 | + ], | ||
36 | + ], | ||
37 | + ]; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Lists all Label models. | ||
42 | + * | ||
43 | + * @return mixed | ||
44 | + */ | ||
45 | + public function actionIndex() | ||
46 | + { | ||
47 | + $searchModel = new LabelSearch(); | ||
48 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
49 | + | ||
50 | + return $this->render( | ||
51 | + 'index', | ||
52 | + [ | ||
53 | + 'searchModel' => $searchModel, | ||
54 | + 'dataProvider' => $dataProvider, | ||
55 | + ] | ||
56 | + ); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Displays a single Label model. | ||
61 | + * | ||
62 | + * @param integer $id | ||
63 | + * | ||
64 | + * @return mixed | ||
65 | + */ | ||
66 | + public function actionView($id) | ||
67 | + { | ||
68 | + return $this->render( | ||
69 | + 'view', | ||
70 | + [ | ||
71 | + 'model' => $this->findModel($id), | ||
72 | + ] | ||
73 | + ); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Creates a new Label model. | ||
78 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
79 | + * | ||
80 | + * @return mixed | ||
81 | + */ | ||
82 | + public function actionCreate() | ||
83 | + { | ||
84 | + $model = new Label(); | ||
85 | + $model->generateLangs(); | ||
86 | + if ($model->loadWithLangs(Yii::$app->request) && $model->saveWithLangs()) { | ||
87 | + return $this->redirect( | ||
88 | + [ | ||
89 | + 'view', | ||
90 | + 'id' => $model->id, | ||
91 | + ] | ||
92 | + ); | ||
93 | + } else { | ||
94 | + return $this->render( | ||
95 | + 'create', | ||
96 | + [ | ||
97 | + 'model' => $model, | ||
98 | + 'modelLangs' => $model->modelLangs, | ||
99 | + ] | ||
100 | + ); | ||
101 | + } | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Updates an existing Label model. | ||
106 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
107 | + * | ||
108 | + * @param integer $id | ||
109 | + * | ||
110 | + * @return mixed | ||
111 | + */ | ||
112 | + public function actionUpdate($id) | ||
113 | + { | ||
114 | + $model = $this->findModel($id); | ||
115 | + $model->generateLangs(); | ||
116 | + | ||
117 | + if ($model->loadWithLangs(Yii::$app->request) && $model->saveWithLangs()) { | ||
118 | + return $this->redirect( | ||
119 | + [ | ||
120 | + 'view', | ||
121 | + 'id' => $model->id, | ||
122 | + ] | ||
123 | + ); | ||
124 | + } else { | ||
125 | + return $this->render( | ||
126 | + 'update', | ||
127 | + [ | ||
128 | + 'model' => $model, | ||
129 | + 'modelLangs' => $model->modelLangs, | ||
130 | + ] | ||
131 | + ); | ||
132 | + } | ||
133 | + } | ||
134 | + | ||
135 | + /** | ||
136 | + * Deletes an existing Label model. | ||
137 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
138 | + * | ||
139 | + * @param integer $id | ||
140 | + * | ||
141 | + * @return mixed | ||
142 | + */ | ||
143 | + public function actionDelete($id) | ||
144 | + { | ||
145 | + $this->findModel($id) | ||
146 | + ->delete(); | ||
147 | + | ||
148 | + return $this->redirect([ 'index' ]); | ||
149 | + } | ||
150 | + | ||
151 | + /** | ||
152 | + * Finds the Label model based on its primary key value. | ||
153 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
154 | + * | ||
155 | + * @param integer $id | ||
156 | + * | ||
157 | + * @return Label the loaded model | ||
158 | + * @throws NotFoundHttpException if the model cannot be found | ||
159 | + */ | ||
160 | + protected function findModel($id) | ||
161 | + { | ||
162 | + if (( $model = Label::findOne($id) ) !== null) { | ||
163 | + return $model; | ||
164 | + } else { | ||
165 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
166 | + } | ||
167 | + } | ||
168 | + } |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\controllers; | ||
4 | + | ||
5 | + use artbox\order\models\Delivery; | ||
6 | + use artbox\order\models\Label; | ||
7 | + use artbox\order\models\Payment; | ||
8 | + use Yii; | ||
9 | + use artbox\order\models\Order; | ||
10 | + use artbox\order\models\OrderSearch; | ||
11 | + use yii\base\Model; | ||
12 | + use yii\web\Controller; | ||
13 | + use yii\web\NotFoundHttpException; | ||
14 | + use yii\filters\VerbFilter; | ||
15 | + | ||
16 | + /** | ||
17 | + * OrderController implements the CRUD actions for Order model. | ||
18 | + */ | ||
19 | + class OrderController extends Controller | ||
20 | + { | ||
21 | + /** | ||
22 | + * @inheritdoc | ||
23 | + */ | ||
24 | + public function behaviors() | ||
25 | + { | ||
26 | + return [ | ||
27 | + 'verbs' => [ | ||
28 | + 'class' => VerbFilter::className(), | ||
29 | + 'actions' => [ | ||
30 | + 'delete' => [ 'POST' ], | ||
31 | + ], | ||
32 | + ], | ||
33 | + ]; | ||
34 | + } | ||
35 | + | ||
36 | + /** | ||
37 | + * Lists all Order models. | ||
38 | + * | ||
39 | + * @return mixed | ||
40 | + */ | ||
41 | + public function actionIndex() | ||
42 | + { | ||
43 | + $searchModel = new OrderSearch(); | ||
44 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
45 | + $labels = Label::find() | ||
46 | + ->select( | ||
47 | + [ | ||
48 | + 'title', | ||
49 | + 'id', | ||
50 | + ] | ||
51 | + ) | ||
52 | + ->joinWith('lang') | ||
53 | + ->andWhere( | ||
54 | + [ | ||
55 | + 'status' => true, | ||
56 | + ] | ||
57 | + ) | ||
58 | + ->indexBy('id') | ||
59 | + ->column(); | ||
60 | + | ||
61 | + return $this->render( | ||
62 | + '@artbox/order/views/order/index', | ||
63 | + [ | ||
64 | + 'searchModel' => $searchModel, | ||
65 | + 'dataProvider' => $dataProvider, | ||
66 | + 'labels' => $labels, | ||
67 | + ] | ||
68 | + ); | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Displays a single Order model. | ||
73 | + * | ||
74 | + * @param integer $id | ||
75 | + * | ||
76 | + * @return mixed | ||
77 | + */ | ||
78 | + public function actionView($id) | ||
79 | + { | ||
80 | + return $this->render( | ||
81 | + '@artbox/order/views/order/view', | ||
82 | + [ | ||
83 | + 'model' => $this->findModel($id), | ||
84 | + ] | ||
85 | + ); | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Creates a new Order model. | ||
90 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
91 | + * | ||
92 | + * @return mixed | ||
93 | + */ | ||
94 | + public function actionCreate() | ||
95 | + { | ||
96 | + $model = new Order(); | ||
97 | + | ||
98 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
99 | + return $this->redirect( | ||
100 | + [ | ||
101 | + 'view', | ||
102 | + 'id' => $model->id, | ||
103 | + ] | ||
104 | + ); | ||
105 | + } else { | ||
106 | + $labels = Label::find() | ||
107 | + ->joinWith('lang') | ||
108 | + ->select( | ||
109 | + [ | ||
110 | + 'title', | ||
111 | + 'id', | ||
112 | + ] | ||
113 | + ) | ||
114 | + ->where( | ||
115 | + [ | ||
116 | + 'status' => true, | ||
117 | + ] | ||
118 | + ) | ||
119 | + ->indexBy('id') | ||
120 | + ->column(); | ||
121 | + $deliveries = Delivery::find() | ||
122 | + ->joinWith('lang') | ||
123 | + ->select( | ||
124 | + [ | ||
125 | + 'title', | ||
126 | + 'id', | ||
127 | + ] | ||
128 | + ) | ||
129 | + ->where( | ||
130 | + [ | ||
131 | + 'status' => true, | ||
132 | + ] | ||
133 | + ) | ||
134 | + ->indexBy('id') | ||
135 | + ->column(); | ||
136 | + $payments = Payment::find() | ||
137 | + ->joinWith('lang') | ||
138 | + ->select( | ||
139 | + [ | ||
140 | + 'title', | ||
141 | + 'id', | ||
142 | + ] | ||
143 | + ) | ||
144 | + ->where( | ||
145 | + [ | ||
146 | + 'status' => true, | ||
147 | + ] | ||
148 | + ) | ||
149 | + ->indexBy('id') | ||
150 | + ->column(); | ||
151 | + return $this->render( | ||
152 | + '@artbox/order/views/order/create', | ||
153 | + [ | ||
154 | + 'model' => $model, | ||
155 | + 'labels' => $labels, | ||
156 | + 'payments' => $payments, | ||
157 | + 'deliveries' => $deliveries, | ||
158 | + ] | ||
159 | + ); | ||
160 | + } | ||
161 | + } | ||
162 | + | ||
163 | + /** | ||
164 | + * Updates an existing Order model. | ||
165 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
166 | + * | ||
167 | + * @param integer $id | ||
168 | + * | ||
169 | + * @return mixed | ||
170 | + */ | ||
171 | + public function actionUpdate($id) | ||
172 | + { | ||
173 | + $model = $this->findModel($id); | ||
174 | + | ||
175 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
176 | + if (Model::loadMultiple($model->orderProducts, \Yii::$app->request->post()) && Model::validateMultiple( | ||
177 | + $model->orderProducts | ||
178 | + ) | ||
179 | + ) { | ||
180 | + foreach ($model->orderProducts as $orderProduct) { | ||
181 | + $orderProduct->save(false); | ||
182 | + } | ||
183 | + } | ||
184 | + return $this->redirect( | ||
185 | + [ | ||
186 | + 'view', | ||
187 | + 'id' => $model->id, | ||
188 | + ] | ||
189 | + ); | ||
190 | + } else { | ||
191 | + $labels = Label::find() | ||
192 | + ->joinWith('lang') | ||
193 | + ->select( | ||
194 | + [ | ||
195 | + 'title', | ||
196 | + 'id', | ||
197 | + ] | ||
198 | + ) | ||
199 | + ->where( | ||
200 | + [ | ||
201 | + 'status' => true, | ||
202 | + ] | ||
203 | + ) | ||
204 | + ->indexBy('id') | ||
205 | + ->column(); | ||
206 | + $deliveries = Delivery::find() | ||
207 | + ->joinWith('lang') | ||
208 | + ->select( | ||
209 | + [ | ||
210 | + 'title', | ||
211 | + 'id', | ||
212 | + ] | ||
213 | + ) | ||
214 | + ->where( | ||
215 | + [ | ||
216 | + 'status' => true, | ||
217 | + ] | ||
218 | + ) | ||
219 | + ->indexBy('id') | ||
220 | + ->column(); | ||
221 | + $payments = Payment::find() | ||
222 | + ->joinWith('lang') | ||
223 | + ->select( | ||
224 | + [ | ||
225 | + 'title', | ||
226 | + 'id', | ||
227 | + ] | ||
228 | + ) | ||
229 | + ->where( | ||
230 | + [ | ||
231 | + 'status' => true, | ||
232 | + ] | ||
233 | + ) | ||
234 | + ->indexBy('id') | ||
235 | + ->column(); | ||
236 | + return $this->render( | ||
237 | + '@artbox/order/views/order/update', | ||
238 | + [ | ||
239 | + 'model' => $model, | ||
240 | + 'labels' => $labels, | ||
241 | + 'payments' => $payments, | ||
242 | + 'deliveries' => $deliveries, | ||
243 | + ] | ||
244 | + ); | ||
245 | + } | ||
246 | + } | ||
247 | + | ||
248 | + /** | ||
249 | + * Deletes an existing Order model. | ||
250 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
251 | + * | ||
252 | + * @param integer $id | ||
253 | + * | ||
254 | + * @return mixed | ||
255 | + */ | ||
256 | + public function actionDelete($id) | ||
257 | + { | ||
258 | + $this->findModel($id) | ||
259 | + ->delete(); | ||
260 | + | ||
261 | + return $this->redirect([ 'index' ]); | ||
262 | + } | ||
263 | + | ||
264 | + /** | ||
265 | + * Finds the Order model based on its primary key value. | ||
266 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
267 | + * | ||
268 | + * @param integer $id | ||
269 | + * | ||
270 | + * @return Order the loaded model | ||
271 | + * @throws NotFoundHttpException if the model cannot be found | ||
272 | + */ | ||
273 | + protected function findModel($id) | ||
274 | + { | ||
275 | + if (( $model = Order::findOne($id) ) !== null) { | ||
276 | + return $model; | ||
277 | + } else { | ||
278 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
279 | + } | ||
280 | + } | ||
281 | + } |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\controllers; | ||
4 | + | ||
5 | + use artbox\order\models\OrderProductSearch; | ||
6 | + use Yii; | ||
7 | + use artbox\order\models\OrderProduct; | ||
8 | + use yii\web\Controller; | ||
9 | + use yii\web\NotFoundHttpException; | ||
10 | + use yii\filters\VerbFilter; | ||
11 | + | ||
12 | + /** | ||
13 | + * OrderProductController implements the CRUD actions for OrderProduct model. | ||
14 | + */ | ||
15 | + class OrderProductController extends Controller | ||
16 | + { | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function behaviors() | ||
21 | + { | ||
22 | + return [ | ||
23 | + 'verbs' => [ | ||
24 | + 'class' => VerbFilter::className(), | ||
25 | + 'actions' => [ | ||
26 | + 'delete' => [ 'POST' ], | ||
27 | + ], | ||
28 | + ], | ||
29 | + ]; | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * Lists all OrderProduct models. | ||
34 | + * | ||
35 | + * @return mixed | ||
36 | + */ | ||
37 | + public function actionIndex() | ||
38 | + { | ||
39 | + $searchModel = new OrderProductSearch(); | ||
40 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
41 | + | ||
42 | + return $this->render( | ||
43 | + '@artbox/order/views/order-product/index', | ||
44 | + [ | ||
45 | + 'searchModel' => $searchModel, | ||
46 | + 'dataProvider' => $dataProvider, | ||
47 | + ] | ||
48 | + ); | ||
49 | + } | ||
50 | + | ||
51 | + /** | ||
52 | + * Displays a single OrderProduct model. | ||
53 | + * | ||
54 | + * @param integer $id | ||
55 | + * | ||
56 | + * @return mixed | ||
57 | + */ | ||
58 | + public function actionView($id) | ||
59 | + { | ||
60 | + return $this->render( | ||
61 | + '@artbox/order/views/order-product/view', | ||
62 | + [ | ||
63 | + 'model' => $this->findModel($id), | ||
64 | + ] | ||
65 | + ); | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Creates a new OrderProduct model. | ||
70 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
71 | + * | ||
72 | + * @return mixed | ||
73 | + */ | ||
74 | + public function actionCreate() | ||
75 | + { | ||
76 | + $model = new OrderProduct(); | ||
77 | + | ||
78 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
79 | + return $this->redirect( | ||
80 | + [ | ||
81 | + 'view', | ||
82 | + 'id' => $model->id, | ||
83 | + ] | ||
84 | + ); | ||
85 | + } else { | ||
86 | + return $this->render( | ||
87 | + '@artbox/order/views/order-product/create', | ||
88 | + [ | ||
89 | + 'model' => $model, | ||
90 | + ] | ||
91 | + ); | ||
92 | + } | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * Updates an existing OrderProduct model. | ||
97 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
98 | + * | ||
99 | + * @param integer $id | ||
100 | + * | ||
101 | + * @return mixed | ||
102 | + */ | ||
103 | + public function actionUpdate($id) | ||
104 | + { | ||
105 | + $model = $this->findModel($id); | ||
106 | + | ||
107 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
108 | + return $this->redirect( | ||
109 | + [ | ||
110 | + 'view', | ||
111 | + 'id' => $model->id, | ||
112 | + ] | ||
113 | + ); | ||
114 | + } else { | ||
115 | + return $this->render( | ||
116 | + '@artbox/order/views/order-product/update', | ||
117 | + [ | ||
118 | + 'model' => $model, | ||
119 | + ] | ||
120 | + ); | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * Deletes an existing OrderProduct model. | ||
126 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
127 | + * | ||
128 | + * @param integer $id | ||
129 | + * | ||
130 | + * @return mixed | ||
131 | + */ | ||
132 | + public function actionDelete($id) | ||
133 | + { | ||
134 | + $this->findModel($id) | ||
135 | + ->delete(); | ||
136 | + | ||
137 | + return $this->redirect([ 'index' ]); | ||
138 | + } | ||
139 | + | ||
140 | + /** | ||
141 | + * Finds the OrderProduct model based on its primary key value. | ||
142 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
143 | + * | ||
144 | + * @param integer $id | ||
145 | + * | ||
146 | + * @return OrderProduct the loaded model | ||
147 | + * @throws NotFoundHttpException if the model cannot be found | ||
148 | + */ | ||
149 | + protected function findModel($id) | ||
150 | + { | ||
151 | + if (( $model = OrderProduct::findOne($id) ) !== null) { | ||
152 | + return $model; | ||
153 | + } else { | ||
154 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
155 | + } | ||
156 | + } | ||
157 | + } |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\controllers; | ||
4 | + | ||
5 | + use artbox\order\models\PaymentSearch; | ||
6 | + use Yii; | ||
7 | + use artbox\order\models\Payment; | ||
8 | + use yii\web\Controller; | ||
9 | + use yii\web\NotFoundHttpException; | ||
10 | + use yii\filters\VerbFilter; | ||
11 | + | ||
12 | + /** | ||
13 | + * PaymentController implements the CRUD actions for Payment model. | ||
14 | + */ | ||
15 | + class PaymentController extends Controller | ||
16 | + { | ||
17 | + /** | ||
18 | + * @return bool|string | ||
19 | + */ | ||
20 | + public function getViewPath() | ||
21 | + { | ||
22 | + return \Yii::getAlias('@artbox/order/views/payment'); | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public function behaviors() | ||
29 | + { | ||
30 | + return [ | ||
31 | + 'verbs' => [ | ||
32 | + 'class' => VerbFilter::className(), | ||
33 | + 'actions' => [ | ||
34 | + 'delete' => [ 'POST' ], | ||
35 | + ], | ||
36 | + ], | ||
37 | + ]; | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * Lists all Payment models. | ||
42 | + * | ||
43 | + * @return mixed | ||
44 | + */ | ||
45 | + public function actionIndex() | ||
46 | + { | ||
47 | + $searchModel = new PaymentSearch(); | ||
48 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
49 | + | ||
50 | + return $this->render( | ||
51 | + 'index', | ||
52 | + [ | ||
53 | + 'searchModel' => $searchModel, | ||
54 | + 'dataProvider' => $dataProvider, | ||
55 | + ] | ||
56 | + ); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Displays a single Payment model. | ||
61 | + * | ||
62 | + * @param integer $id | ||
63 | + * | ||
64 | + * @return mixed | ||
65 | + */ | ||
66 | + public function actionView($id) | ||
67 | + { | ||
68 | + return $this->render( | ||
69 | + 'view', | ||
70 | + [ | ||
71 | + 'model' => $this->findModel($id), | ||
72 | + ] | ||
73 | + ); | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Creates a new Payment model. | ||
78 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
79 | + * | ||
80 | + * @return mixed | ||
81 | + */ | ||
82 | + public function actionCreate() | ||
83 | + { | ||
84 | + $model = new Payment(); | ||
85 | + $model->generateLangs(); | ||
86 | + if ($model->loadWithLangs(Yii::$app->request) && $model->saveWithLangs()) { | ||
87 | + return $this->redirect( | ||
88 | + [ | ||
89 | + 'view', | ||
90 | + 'id' => $model->id, | ||
91 | + ] | ||
92 | + ); | ||
93 | + } else { | ||
94 | + return $this->render( | ||
95 | + 'create', | ||
96 | + [ | ||
97 | + 'model' => $model, | ||
98 | + 'modelLangs' => $model->modelLangs, | ||
99 | + ] | ||
100 | + ); | ||
101 | + } | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * Updates an existing Payment model. | ||
106 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
107 | + * | ||
108 | + * @param integer $id | ||
109 | + * | ||
110 | + * @return mixed | ||
111 | + */ | ||
112 | + public function actionUpdate($id) | ||
113 | + { | ||
114 | + $model = $this->findModel($id); | ||
115 | + $model->generateLangs(); | ||
116 | + if ($model->loadWithLangs(Yii::$app->request) && $model->saveWithLangs()) { | ||
117 | + return $this->redirect( | ||
118 | + [ | ||
119 | + 'view', | ||
120 | + 'id' => $model->id, | ||
121 | + ] | ||
122 | + ); | ||
123 | + } else { | ||
124 | + return $this->render( | ||
125 | + 'update', | ||
126 | + [ | ||
127 | + 'model' => $model, | ||
128 | + 'modelLangs' => $model->modelLangs, | ||
129 | + ] | ||
130 | + ); | ||
131 | + } | ||
132 | + } | ||
133 | + | ||
134 | + /** | ||
135 | + * Deletes an existing Payment model. | ||
136 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
137 | + * | ||
138 | + * @param integer $id | ||
139 | + * | ||
140 | + * @return mixed | ||
141 | + */ | ||
142 | + public function actionDelete($id) | ||
143 | + { | ||
144 | + $this->findModel($id) | ||
145 | + ->delete(); | ||
146 | + | ||
147 | + return $this->redirect([ 'index' ]); | ||
148 | + } | ||
149 | + | ||
150 | + /** | ||
151 | + * Finds the Payment model based on its primary key value. | ||
152 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
153 | + * | ||
154 | + * @param integer $id | ||
155 | + * | ||
156 | + * @return Payment the loaded model | ||
157 | + * @throws NotFoundHttpException if the model cannot be found | ||
158 | + */ | ||
159 | + protected function findModel($id) | ||
160 | + { | ||
161 | + if (( $model = Payment::findOne($id) ) !== null) { | ||
162 | + return $model; | ||
163 | + } else { | ||
164 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
165 | + } | ||
166 | + } | ||
167 | + } |
migrations/m170503_145306_create_order_product_table.php
@@ -15,10 +15,10 @@ | @@ -15,10 +15,10 @@ | ||
15 | $this->createTable( | 15 | $this->createTable( |
16 | 'order_product', | 16 | 'order_product', |
17 | [ | 17 | [ |
18 | - 'id' => $this->primaryKey(), | ||
19 | 'order_id' => $this->integer() | 18 | 'order_id' => $this->integer() |
20 | ->notNull(), | 19 | ->notNull(), |
21 | - 'variant_id' => $this->integer(), | 20 | + 'variant_id' => $this->integer() |
21 | + ->notNull(), | ||
22 | 'sku' => $this->string() | 22 | 'sku' => $this->string() |
23 | ->notNull(), | 23 | ->notNull(), |
24 | 'price' => $this->decimal(), | 24 | 'price' => $this->decimal(), |
@@ -45,6 +45,15 @@ | @@ -45,6 +45,15 @@ | ||
45 | 'SET NULL', | 45 | 'SET NULL', |
46 | 'CASCADE' | 46 | 'CASCADE' |
47 | ); | 47 | ); |
48 | + | ||
49 | + $this->addPrimaryKey( | ||
50 | + 'order_product_pkey', | ||
51 | + 'order_product', | ||
52 | + [ | ||
53 | + 'order_id', | ||
54 | + 'variant_id', | ||
55 | + ] | ||
56 | + ); | ||
48 | } | 57 | } |
49 | 58 | ||
50 | /** | 59 | /** |
models/Delivery.php
@@ -55,6 +55,18 @@ | @@ -55,6 +55,18 @@ | ||
55 | /** | 55 | /** |
56 | * @inheritdoc | 56 | * @inheritdoc |
57 | */ | 57 | */ |
58 | + public function behaviors() | ||
59 | + { | ||
60 | + return [ | ||
61 | + 'language' => [ | ||
62 | + 'class' => LanguageBehavior::className(), | ||
63 | + ], | ||
64 | + ]; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * @inheritdoc | ||
69 | + */ | ||
58 | public function rules() | 70 | public function rules() |
59 | { | 71 | { |
60 | return [ | 72 | return [ |
@@ -76,18 +88,6 @@ | @@ -76,18 +88,6 @@ | ||
76 | /** | 88 | /** |
77 | * @inheritdoc | 89 | * @inheritdoc |
78 | */ | 90 | */ |
79 | - public function behaviors() | ||
80 | - { | ||
81 | - return [ | ||
82 | - 'language' => [ | ||
83 | - 'class' => LanguageBehavior::className(), | ||
84 | - ], | ||
85 | - ]; | ||
86 | - } | ||
87 | - | ||
88 | - /** | ||
89 | - * @inheritdoc | ||
90 | - */ | ||
91 | public function attributeLabels() | 91 | public function attributeLabels() |
92 | { | 92 | { |
93 | return [ | 93 | return [ |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\models; | ||
4 | + | ||
5 | + use Yii; | ||
6 | + use yii\base\Model; | ||
7 | + use yii\data\ActiveDataProvider; | ||
8 | + use artbox\order\models\Delivery; | ||
9 | + | ||
10 | + /** | ||
11 | + * DeliverySearch represents the model behind the search form about `artbox\order\models\Delivery`. | ||
12 | + */ | ||
13 | + class DeliverySearch extends Delivery | ||
14 | + { | ||
15 | + public $title; | ||
16 | + | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function rules() | ||
21 | + { | ||
22 | + return [ | ||
23 | + [ | ||
24 | + [ 'title' ], | ||
25 | + 'string', | ||
26 | + ], | ||
27 | + [ | ||
28 | + [ | ||
29 | + 'id', | ||
30 | + 'sort', | ||
31 | + ], | ||
32 | + 'integer', | ||
33 | + ], | ||
34 | + [ | ||
35 | + [ 'value' ], | ||
36 | + 'number', | ||
37 | + ], | ||
38 | + [ | ||
39 | + [ 'status' ], | ||
40 | + 'boolean', | ||
41 | + ], | ||
42 | + ]; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * @inheritdoc | ||
47 | + */ | ||
48 | + public function behaviors() | ||
49 | + { | ||
50 | + return []; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * @inheritdoc | ||
55 | + */ | ||
56 | + public function scenarios() | ||
57 | + { | ||
58 | + // bypass scenarios() implementation in the parent class | ||
59 | + return Model::scenarios(); | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Creates data provider instance with search query applied | ||
64 | + * | ||
65 | + * @param array $params | ||
66 | + * | ||
67 | + * @return ActiveDataProvider | ||
68 | + */ | ||
69 | + public function search($params) | ||
70 | + { | ||
71 | + $query = Delivery::find() | ||
72 | + ->joinWith('lang'); | ||
73 | + | ||
74 | + // add conditions that should always apply here | ||
75 | + | ||
76 | + $dataProvider = new ActiveDataProvider( | ||
77 | + [ | ||
78 | + 'query' => $query, | ||
79 | + 'sort' => [ | ||
80 | + 'attributes' => [ | ||
81 | + 'title' => [ | ||
82 | + 'asc' => [ 'delivery_lang.title' => SORT_ASC ], | ||
83 | + 'desc' => [ 'delivery_lang.title' => SORT_DESC ], | ||
84 | + ], | ||
85 | + 'id', | ||
86 | + 'value', | ||
87 | + 'status', | ||
88 | + ], | ||
89 | + ], | ||
90 | + ] | ||
91 | + ); | ||
92 | + | ||
93 | + $this->load($params); | ||
94 | + | ||
95 | + if (!$this->validate()) { | ||
96 | + // uncomment the following line if you do not want to return any records when validation fails | ||
97 | + // $query->where('0=1'); | ||
98 | + return $dataProvider; | ||
99 | + } | ||
100 | + | ||
101 | + // grid filtering conditions | ||
102 | + $query->andFilterWhere( | ||
103 | + [ | ||
104 | + 'id' => $this->id, | ||
105 | + 'sort' => $this->sort, | ||
106 | + 'value' => $this->value, | ||
107 | + 'status' => $this->status, | ||
108 | + ] | ||
109 | + ); | ||
110 | + $query->andFilterWhere( | ||
111 | + [ | ||
112 | + 'like', | ||
113 | + 'delivery_lang.title', | ||
114 | + $this->title, | ||
115 | + ] | ||
116 | + ); | ||
117 | + | ||
118 | + return $dataProvider; | ||
119 | + } | ||
120 | + } |
models/Label.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace artbox\order\models; | 3 | namespace artbox\order\models; |
4 | - | 4 | + |
5 | + use artbox\core\behaviors\LanguageBehavior; | ||
5 | use artbox\core\models\Language; | 6 | use artbox\core\models\Language; |
6 | use Yii; | 7 | use Yii; |
7 | - | 8 | + use yii\db\ActiveQuery; |
9 | + use yii\db\ActiveRecord; | ||
10 | + use yii\web\Request; | ||
11 | + | ||
8 | /** | 12 | /** |
9 | * This is the model class for table "label". | 13 | * This is the model class for table "label". |
10 | * | 14 | * |
@@ -15,8 +19,31 @@ | @@ -15,8 +19,31 @@ | ||
15 | * @property LabelLang[] $labelLangs | 19 | * @property LabelLang[] $labelLangs |
16 | * @property Language[] $languages | 20 | * @property Language[] $languages |
17 | * @property Order[] $orders | 21 | * @property Order[] $orders |
22 | + * * From language behavior * | ||
23 | + * @property LabelLang $lang | ||
24 | + * @property LabelLang[] $langs | ||
25 | + * @property LabelLang $objectLang | ||
26 | + * @property string $ownerKey | ||
27 | + * @property string $langKey | ||
28 | + * @property LabelLang[] $modelLangs | ||
29 | + * @property bool $transactionStatus | ||
30 | + * @method string getOwnerKey() | ||
31 | + * @method void setOwnerKey( string $value ) | ||
32 | + * @method string getLangKey() | ||
33 | + * @method void setLangKey( string $value ) | ||
34 | + * @method ActiveQuery getLangs() | ||
35 | + * @method ActiveQuery getLang( integer $language_id ) | ||
36 | + * @method LabelLang[] generateLangs() | ||
37 | + * @method void loadLangs( Request $request ) | ||
38 | + * @method bool linkLangs() | ||
39 | + * @method bool saveLangs() | ||
40 | + * @method bool getTransactionStatus() | ||
41 | + * @method bool loadWithLangs( Request $request ) | ||
42 | + * @method bool saveWithLangs() | ||
43 | + * * End language behavior * | ||
44 | + * @see LanguageBehavior | ||
18 | */ | 45 | */ |
19 | - class Label extends \yii\db\ActiveRecord | 46 | + class Label extends ActiveRecord |
20 | { | 47 | { |
21 | /** | 48 | /** |
22 | * @inheritdoc | 49 | * @inheritdoc |
@@ -25,7 +52,19 @@ | @@ -25,7 +52,19 @@ | ||
25 | { | 52 | { |
26 | return 'label'; | 53 | return 'label'; |
27 | } | 54 | } |
28 | - | 55 | + |
56 | + /** | ||
57 | + * @inheritdoc | ||
58 | + */ | ||
59 | + public function behaviors() | ||
60 | + { | ||
61 | + return [ | ||
62 | + 'language' => [ | ||
63 | + 'class' => LanguageBehavior::className(), | ||
64 | + ], | ||
65 | + ]; | ||
66 | + } | ||
67 | + | ||
29 | /** | 68 | /** |
30 | * @inheritdoc | 69 | * @inheritdoc |
31 | */ | 70 | */ |
@@ -46,7 +85,7 @@ | @@ -46,7 +85,7 @@ | ||
46 | ], | 85 | ], |
47 | ]; | 86 | ]; |
48 | } | 87 | } |
49 | - | 88 | + |
50 | /** | 89 | /** |
51 | * @inheritdoc | 90 | * @inheritdoc |
52 | */ | 91 | */ |
@@ -59,7 +98,7 @@ | @@ -59,7 +98,7 @@ | ||
59 | 'status' => Yii::t('order', 'Status'), | 98 | 'status' => Yii::t('order', 'Status'), |
60 | ]; | 99 | ]; |
61 | } | 100 | } |
62 | - | 101 | + |
63 | /** | 102 | /** |
64 | * @return \yii\db\ActiveQuery | 103 | * @return \yii\db\ActiveQuery |
65 | */ | 104 | */ |
@@ -67,16 +106,16 @@ | @@ -67,16 +106,16 @@ | ||
67 | { | 106 | { |
68 | return $this->hasMany(LabelLang::className(), [ 'label_id' => 'id' ]); | 107 | return $this->hasMany(LabelLang::className(), [ 'label_id' => 'id' ]); |
69 | } | 108 | } |
70 | - | 109 | + |
71 | /** | 110 | /** |
72 | * @return \yii\db\ActiveQuery | 111 | * @return \yii\db\ActiveQuery |
73 | */ | 112 | */ |
74 | public function getLanguages() | 113 | public function getLanguages() |
75 | { | 114 | { |
76 | return $this->hasMany(Language::className(), [ 'id' => 'language_id' ]) | 115 | return $this->hasMany(Language::className(), [ 'id' => 'language_id' ]) |
77 | - ->viaTable('label_lang', [ 'label_id' => 'id' ]); | 116 | + ->viaTable('label_lang', [ 'label_id' => 'id' ]); |
78 | } | 117 | } |
79 | - | 118 | + |
80 | /** | 119 | /** |
81 | * @return \yii\db\ActiveQuery | 120 | * @return \yii\db\ActiveQuery |
82 | */ | 121 | */ |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\models; | ||
4 | + | ||
5 | + use Yii; | ||
6 | + use yii\base\Model; | ||
7 | + use yii\data\ActiveDataProvider; | ||
8 | + use artbox\order\models\Label; | ||
9 | + | ||
10 | + /** | ||
11 | + * LabelSearch represents the model behind the search form about `artbox\order\models\Label`. | ||
12 | + */ | ||
13 | + class LabelSearch extends Label | ||
14 | + { | ||
15 | + public $title; | ||
16 | + | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function rules() | ||
21 | + { | ||
22 | + return [ | ||
23 | + [ | ||
24 | + [ 'title' ], | ||
25 | + 'string', | ||
26 | + ], | ||
27 | + [ | ||
28 | + [ | ||
29 | + 'id', | ||
30 | + 'sort', | ||
31 | + ], | ||
32 | + 'integer', | ||
33 | + ], | ||
34 | + [ | ||
35 | + [ 'value' ], | ||
36 | + 'number', | ||
37 | + ], | ||
38 | + [ | ||
39 | + [ 'status' ], | ||
40 | + 'boolean', | ||
41 | + ], | ||
42 | + ]; | ||
43 | + } | ||
44 | + | ||
45 | + /** | ||
46 | + * @inheritdoc | ||
47 | + */ | ||
48 | + public function behaviors() | ||
49 | + { | ||
50 | + return []; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * @inheritdoc | ||
55 | + */ | ||
56 | + public function scenarios() | ||
57 | + { | ||
58 | + // bypass scenarios() implementation in the parent class | ||
59 | + return Model::scenarios(); | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Creates data provider instance with search query applied | ||
64 | + * | ||
65 | + * @param array $params | ||
66 | + * | ||
67 | + * @return ActiveDataProvider | ||
68 | + */ | ||
69 | + public function search($params) | ||
70 | + { | ||
71 | + $query = Label::find() | ||
72 | + ->joinWith('lang'); | ||
73 | + | ||
74 | + // add conditions that should always apply here | ||
75 | + | ||
76 | + $dataProvider = new ActiveDataProvider( | ||
77 | + [ | ||
78 | + 'query' => $query, | ||
79 | + 'sort' => [ | ||
80 | + 'attributes' => [ | ||
81 | + 'title' => [ | ||
82 | + 'asc' => [ 'label_lang.title' => SORT_ASC ], | ||
83 | + 'desc' => [ 'label_lang.title' => SORT_DESC ], | ||
84 | + ], | ||
85 | + 'id', | ||
86 | + 'value', | ||
87 | + 'status', | ||
88 | + ], | ||
89 | + ], | ||
90 | + ] | ||
91 | + ); | ||
92 | + | ||
93 | + $this->load($params); | ||
94 | + | ||
95 | + if (!$this->validate()) { | ||
96 | + // uncomment the following line if you do not want to return any records when validation fails | ||
97 | + // $query->where('0=1'); | ||
98 | + return $dataProvider; | ||
99 | + } | ||
100 | + | ||
101 | + // grid filtering conditions | ||
102 | + $query->andFilterWhere( | ||
103 | + [ | ||
104 | + 'id' => $this->id, | ||
105 | + 'sort' => $this->sort, | ||
106 | + 'value' => $this->value, | ||
107 | + 'status' => $this->status, | ||
108 | + ] | ||
109 | + ); | ||
110 | + $query->andFilterWhere( | ||
111 | + [ | ||
112 | + 'like', | ||
113 | + 'label_lang.title', | ||
114 | + $this->title, | ||
115 | + ] | ||
116 | + ); | ||
117 | + | ||
118 | + return $dataProvider; | ||
119 | + } | ||
120 | + } |
models/Order.php
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | namespace artbox\order\models; | 3 | namespace artbox\order\models; |
4 | 4 | ||
5 | use Yii; | 5 | use Yii; |
6 | + use yii\behaviors\TimestampBehavior; | ||
6 | use yii\db\ActiveRecord; | 7 | use yii\db\ActiveRecord; |
7 | 8 | ||
8 | /** | 9 | /** |
@@ -37,6 +38,13 @@ | @@ -37,6 +38,13 @@ | ||
37 | { | 38 | { |
38 | return 'order'; | 39 | return 'order'; |
39 | } | 40 | } |
41 | + | ||
42 | + public function behaviors() | ||
43 | + { | ||
44 | + return [ | ||
45 | + TimestampBehavior::className(), | ||
46 | + ]; | ||
47 | + } | ||
40 | 48 | ||
41 | /** | 49 | /** |
42 | * @inheritdoc | 50 | * @inheritdoc |
models/OrderProduct.php
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\models; | ||
4 | + | ||
5 | + use Yii; | ||
6 | + use yii\base\Model; | ||
7 | + use yii\data\ActiveDataProvider; | ||
8 | + use artbox\order\models\OrderProduct; | ||
9 | + | ||
10 | + /** | ||
11 | + * OrderProductSearch represents the model behind the search form about `artbox\order\models\OrderProduct`. | ||
12 | + */ | ||
13 | + class OrderProductSearch extends OrderProduct | ||
14 | + { | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [ | ||
22 | + [ | ||
23 | + 'id', | ||
24 | + 'order_id', | ||
25 | + 'variant_id', | ||
26 | + 'count', | ||
27 | + ], | ||
28 | + 'integer', | ||
29 | + ], | ||
30 | + [ | ||
31 | + [ 'sku' ], | ||
32 | + 'safe', | ||
33 | + ], | ||
34 | + [ | ||
35 | + [ 'price' ], | ||
36 | + 'number', | ||
37 | + ], | ||
38 | + ]; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * @inheritdoc | ||
43 | + */ | ||
44 | + public function scenarios() | ||
45 | + { | ||
46 | + // bypass scenarios() implementation in the parent class | ||
47 | + return Model::scenarios(); | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Creates data provider instance with search query applied | ||
52 | + * | ||
53 | + * @param array $params | ||
54 | + * | ||
55 | + * @return ActiveDataProvider | ||
56 | + */ | ||
57 | + public function search($params) | ||
58 | + { | ||
59 | + $query = OrderProduct::find(); | ||
60 | + | ||
61 | + // add conditions that should always apply here | ||
62 | + | ||
63 | + $dataProvider = new ActiveDataProvider( | ||
64 | + [ | ||
65 | + 'query' => $query, | ||
66 | + ] | ||
67 | + ); | ||
68 | + | ||
69 | + $this->load($params); | ||
70 | + | ||
71 | + if (!$this->validate()) { | ||
72 | + // uncomment the following line if you do not want to return any records when validation fails | ||
73 | + // $query->where('0=1'); | ||
74 | + return $dataProvider; | ||
75 | + } | ||
76 | + | ||
77 | + // grid filtering conditions | ||
78 | + $query->andFilterWhere( | ||
79 | + [ | ||
80 | + 'id' => $this->id, | ||
81 | + 'order_id' => $this->order_id, | ||
82 | + 'variant_id' => $this->variant_id, | ||
83 | + 'price' => $this->price, | ||
84 | + 'count' => $this->count, | ||
85 | + ] | ||
86 | + ); | ||
87 | + | ||
88 | + $query->andFilterWhere( | ||
89 | + [ | ||
90 | + 'like', | ||
91 | + 'sku', | ||
92 | + $this->sku, | ||
93 | + ] | ||
94 | + ); | ||
95 | + | ||
96 | + return $dataProvider; | ||
97 | + } | ||
98 | + } |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\models; | ||
4 | + | ||
5 | + use Yii; | ||
6 | + use yii\base\Model; | ||
7 | + use yii\data\ActiveDataProvider; | ||
8 | + use artbox\order\models\Order; | ||
9 | + | ||
10 | + /** | ||
11 | + * OrderSearch represents the model behind the search form about `artbox\order\models\Order`. | ||
12 | + */ | ||
13 | + class OrderSearch extends Order | ||
14 | + { | ||
15 | + | ||
16 | + public $count; | ||
17 | + | ||
18 | + /** | ||
19 | + * @inheritdoc | ||
20 | + */ | ||
21 | + public function rules() | ||
22 | + { | ||
23 | + return [ | ||
24 | + [ | ||
25 | + [ | ||
26 | + 'id', | ||
27 | + 'user_id', | ||
28 | + 'label_id', | ||
29 | + ], | ||
30 | + 'integer', | ||
31 | + ], | ||
32 | + [ | ||
33 | + [ | ||
34 | + 'name', | ||
35 | + 'phone', | ||
36 | + 'email', | ||
37 | + ], | ||
38 | + 'safe', | ||
39 | + ], | ||
40 | + ]; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * @inheritdoc | ||
45 | + */ | ||
46 | + public function scenarios() | ||
47 | + { | ||
48 | + // bypass scenarios() implementation in the parent class | ||
49 | + return Model::scenarios(); | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * Creates data provider instance with search query applied | ||
54 | + * | ||
55 | + * @param array $params | ||
56 | + * | ||
57 | + * @return ActiveDataProvider | ||
58 | + */ | ||
59 | + public function search($params) | ||
60 | + { | ||
61 | + $query = Order::find() | ||
62 | + ->joinWith('orderProducts') | ||
63 | + ->with('label.lang') | ||
64 | + ->select( | ||
65 | + [ | ||
66 | + 'order.*', | ||
67 | + 'count(*)', | ||
68 | + ] | ||
69 | + ) | ||
70 | + ->groupBy('order.id'); | ||
71 | + | ||
72 | + // add conditions that should always apply here | ||
73 | + | ||
74 | + $dataProvider = new ActiveDataProvider( | ||
75 | + [ | ||
76 | + 'query' => $query, | ||
77 | + 'sort' => [ | ||
78 | + 'attributes' => [ | ||
79 | + 'count', | ||
80 | + 'id', | ||
81 | + 'user_id', | ||
82 | + 'name', | ||
83 | + 'label_id', | ||
84 | + 'created_at', | ||
85 | + 'phone', | ||
86 | + 'email', | ||
87 | + ], | ||
88 | + ], | ||
89 | + ] | ||
90 | + ); | ||
91 | + | ||
92 | + $this->load($params); | ||
93 | + | ||
94 | + if (!$this->validate()) { | ||
95 | + // uncomment the following line if you do not want to return any records when validation fails | ||
96 | + // $query->where('0=1'); | ||
97 | + return $dataProvider; | ||
98 | + } | ||
99 | + | ||
100 | + // grid filtering conditions | ||
101 | + $query->andFilterWhere( | ||
102 | + [ | ||
103 | + 'id' => $this->id, | ||
104 | + 'user_id' => $this->user_id, | ||
105 | + 'label_id' => $this->label_id, | ||
106 | + 'delivery_id' => $this->delivery_id, | ||
107 | + 'payment_id' => $this->payment_id, | ||
108 | + 'created_at' => $this->created_at, | ||
109 | + 'updated_at' => $this->updated_at, | ||
110 | + 'deleted_at' => $this->deleted_at, | ||
111 | + 'count' => $this->count, | ||
112 | + ] | ||
113 | + ); | ||
114 | + | ||
115 | + $query->andFilterWhere( | ||
116 | + [ | ||
117 | + 'like', | ||
118 | + 'name', | ||
119 | + $this->name, | ||
120 | + ] | ||
121 | + ) | ||
122 | + ->andFilterWhere( | ||
123 | + [ | ||
124 | + 'like', | ||
125 | + 'phone', | ||
126 | + $this->phone, | ||
127 | + ] | ||
128 | + ) | ||
129 | + ->andFilterWhere( | ||
130 | + [ | ||
131 | + 'like', | ||
132 | + 'email', | ||
133 | + $this->email, | ||
134 | + ] | ||
135 | + ) | ||
136 | + ->andFilterWhere( | ||
137 | + [ | ||
138 | + 'like', | ||
139 | + 'city', | ||
140 | + $this->city, | ||
141 | + ] | ||
142 | + ) | ||
143 | + ->andFilterWhere( | ||
144 | + [ | ||
145 | + 'like', | ||
146 | + 'address', | ||
147 | + $this->address, | ||
148 | + ] | ||
149 | + ) | ||
150 | + ->andFilterWhere( | ||
151 | + [ | ||
152 | + 'like', | ||
153 | + 'comment', | ||
154 | + $this->comment, | ||
155 | + ] | ||
156 | + ); | ||
157 | + | ||
158 | + return $dataProvider; | ||
159 | + } | ||
160 | + } |
1 | +<?php | ||
2 | + | ||
3 | + namespace artbox\order\models; | ||
4 | + | ||
5 | + use Yii; | ||
6 | + use yii\base\Model; | ||
7 | + use yii\data\ActiveDataProvider; | ||
8 | + use artbox\order\models\Payment; | ||
9 | + | ||
10 | + /** | ||
11 | + * PaymentSearch represents the model behind the search form about `artbox\order\models\Payment`. | ||
12 | + */ | ||
13 | + class PaymentSearch extends Payment | ||
14 | + { | ||
15 | + public $title; | ||
16 | + | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function rules() | ||
21 | + { | ||
22 | + return [ | ||
23 | + [ | ||
24 | + [ 'title' ], | ||
25 | + 'string', | ||
26 | + ], | ||
27 | + [ | ||
28 | + [ | ||
29 | + 'id', | ||
30 | + 'sort', | ||
31 | + ], | ||
32 | + 'integer', | ||
33 | + ], | ||
34 | + [ | ||
35 | + [ 'status' ], | ||
36 | + 'boolean', | ||
37 | + ], | ||
38 | + ]; | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * @inheritdoc | ||
43 | + */ | ||
44 | + public function behaviors() | ||
45 | + { | ||
46 | + return []; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * @inheritdoc | ||
51 | + */ | ||
52 | + public function scenarios() | ||
53 | + { | ||
54 | + // bypass scenarios() implementation in the parent class | ||
55 | + return Model::scenarios(); | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Creates data provider instance with search query applied | ||
60 | + * | ||
61 | + * @param array $params | ||
62 | + * | ||
63 | + * @return ActiveDataProvider | ||
64 | + */ | ||
65 | + public function search($params) | ||
66 | + { | ||
67 | + $query = Payment::find() | ||
68 | + ->joinWith('lang'); | ||
69 | + | ||
70 | + // add conditions that should always apply here | ||
71 | + | ||
72 | + $dataProvider = new ActiveDataProvider( | ||
73 | + [ | ||
74 | + 'query' => $query, | ||
75 | + 'sort' => [ | ||
76 | + 'attributes' => [ | ||
77 | + 'title' => [ | ||
78 | + 'asc' => [ 'payment_lang.title' => SORT_ASC ], | ||
79 | + 'desc' => [ 'payment_lang.title' => SORT_DESC ], | ||
80 | + ], | ||
81 | + 'id', | ||
82 | + 'status', | ||
83 | + ], | ||
84 | + ], | ||
85 | + ] | ||
86 | + ); | ||
87 | + | ||
88 | + $this->load($params); | ||
89 | + | ||
90 | + if (!$this->validate()) { | ||
91 | + // uncomment the following line if you do not want to return any records when validation fails | ||
92 | + // $query->where('0=1'); | ||
93 | + return $dataProvider; | ||
94 | + } | ||
95 | + | ||
96 | + // grid filtering conditions | ||
97 | + $query->andFilterWhere( | ||
98 | + [ | ||
99 | + 'id' => $this->id, | ||
100 | + 'sort' => $this->sort, | ||
101 | + 'status' => $this->status, | ||
102 | + ] | ||
103 | + ); | ||
104 | + $query->andFilterWhere( | ||
105 | + [ | ||
106 | + 'like', | ||
107 | + 'payment_lang.title', | ||
108 | + $this->title, | ||
109 | + ] | ||
110 | + ); | ||
111 | + | ||
112 | + return $dataProvider; | ||
113 | + } | ||
114 | + } |
1 | +<?php | ||
2 | + | ||
3 | + use artbox\core\widgets\LanguageForm; | ||
4 | + use yii\helpers\Html; | ||
5 | + use yii\widgets\ActiveForm; | ||
6 | + | ||
7 | + /** | ||
8 | + * @var \yii\web\View $this | ||
9 | + * @var \artbox\order\models\Delivery $model | ||
10 | + * @var \artbox\order\models\DeliveryLang[] $modelLangs | ||
11 | + */ | ||
12 | +?> | ||
13 | + | ||
14 | +<div class="delivery-form"> | ||
15 | + | ||
16 | + <?php $form = ActiveForm::begin(); ?> | ||
17 | + | ||
18 | + <?= LanguageForm::widget( | ||
19 | + [ | ||
20 | + 'modelLangs' => $modelLangs, | ||
21 | + 'formView' => '@artbox/order/views/delivery/_form_language', | ||
22 | + 'form' => $form, | ||
23 | + ] | ||
24 | + ) ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'sort') | ||
27 | + ->textInput() ?> | ||
28 | + | ||
29 | + <?= $form->field($model, 'value') | ||
30 | + ->textInput() ?> | ||
31 | + | ||
32 | + <?= $form->field($model, 'status') | ||
33 | + ->checkbox( | ||
34 | + [ | ||
35 | + 'class' => 'flat', | ||
36 | + ] | ||
37 | + ) ?> | ||
38 | + | ||
39 | + <div class="form-group"> | ||
40 | + <?= Html::submitButton( | ||
41 | + $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | ||
42 | + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] | ||
43 | + ) ?> | ||
44 | + </div> | ||
45 | + | ||
46 | + <?php ActiveForm::end(); ?> | ||
47 | + | ||
48 | +</div> |
1 | +<?php | ||
2 | + use artbox\core\helpers\SlugifyDecorator; | ||
3 | + use artbox\core\models\Language; | ||
4 | + use dosamigos\tinymce\TinyMce; | ||
5 | + use yii\web\View; | ||
6 | + use yii\widgets\ActiveForm; | ||
7 | + | ||
8 | + /** | ||
9 | + * @var \artbox\order\models\DeliveryLang $model_lang | ||
10 | + * @var Language $language | ||
11 | + * @var ActiveForm $form | ||
12 | + * @var View $this | ||
13 | + */ | ||
14 | + | ||
15 | + echo $form->field($model_lang, '[' . $language->id . ']title') | ||
16 | + ->textInput([ 'maxlength' => true ]); | ||
17 | + | ||
18 | + echo $form->field($model_lang, '[' . $language->id . ']description') | ||
19 | + ->textarea(); | ||
20 | + | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $model common\models\DeliverySearch */ | ||
8 | + /* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="delivery-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin( | ||
14 | + [ | ||
15 | + 'action' => [ 'index' ], | ||
16 | + 'method' => 'get', | ||
17 | + ] | ||
18 | + ); ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'sort') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'value') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'status') | ||
27 | + ->checkbox() ?> | ||
28 | + | ||
29 | + <div class="form-group"> | ||
30 | + <?= Html::submitButton(Yii::t('order', 'Search'), [ 'class' => 'btn btn-primary' ]) ?> | ||
31 | + <?= Html::resetButton(Yii::t('order', 'Reset'), [ 'class' => 'btn btn-default' ]) ?> | ||
32 | + </div> | ||
33 | + | ||
34 | + <?php ActiveForm::end(); ?> | ||
35 | + | ||
36 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yiister\gentelella\widgets\Panel; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var yii\web\View $this | ||
8 | + * @var artbox\order\models\Delivery $model | ||
9 | + * @var \artbox\order\models\DeliveryLang[] $modelLangs | ||
10 | + */ | ||
11 | + | ||
12 | + $this->title = Yii::t('order', 'Create Delivery'); | ||
13 | + $this->params[ 'breadcrumbs' ][] = [ | ||
14 | + 'label' => Yii::t('order', 'Deliveries'), | ||
15 | + 'url' => [ 'index' ], | ||
16 | + ]; | ||
17 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
18 | +?> | ||
19 | +<div class="delivery-create"> | ||
20 | + <?php | ||
21 | + $xPanel = Panel::begin( | ||
22 | + [ | ||
23 | + 'header' => $this->title, | ||
24 | + ] | ||
25 | + ); | ||
26 | + ?> | ||
27 | + <?= $this->render( | ||
28 | + '_form', | ||
29 | + [ | ||
30 | + 'model' => $model, | ||
31 | + 'modelLangs' => $modelLangs, | ||
32 | + ] | ||
33 | + ) ?> | ||
34 | + <?php | ||
35 | + $xPanel::end(); | ||
36 | + ?> | ||
37 | + | ||
38 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\grid\GridView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /* @var $this yii\web\View */ | ||
8 | + /* @var $searchModel artbox\order\models\DeliverySearch */ | ||
9 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | ||
10 | + | ||
11 | + $this->title = Yii::t('order', 'Deliveries'); | ||
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
13 | +?> | ||
14 | +<div class="delivery-index"> | ||
15 | + <?php | ||
16 | + $xPanel = Panel::begin( | ||
17 | + [ | ||
18 | + 'header' => $this->title, | ||
19 | + ] | ||
20 | + ); | ||
21 | + ?> | ||
22 | + <p> | ||
23 | + <?= Html::a(Yii::t('order', 'Create Delivery'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | ||
24 | + </p> | ||
25 | + <?= GridView::widget( | ||
26 | + [ | ||
27 | + 'dataProvider' => $dataProvider, | ||
28 | + 'filterModel' => $searchModel, | ||
29 | + 'columns' => [ | ||
30 | + [ 'class' => 'yii\grid\SerialColumn' ], | ||
31 | + | ||
32 | + 'id', | ||
33 | + [ | ||
34 | + 'attribute' => 'title', | ||
35 | + 'value' => 'lang.title', | ||
36 | + ], | ||
37 | + 'sort', | ||
38 | + 'value', | ||
39 | + [ | ||
40 | + 'attribute' => 'status', | ||
41 | + 'filter' => [ | ||
42 | + 0 => \Yii::$app->formatter->asBoolean(false), | ||
43 | + 1 => \Yii::$app->formatter->asBoolean(true), | ||
44 | + ], | ||
45 | + ], | ||
46 | + | ||
47 | + [ 'class' => 'yii\grid\ActionColumn' ], | ||
48 | + ], | ||
49 | + ] | ||
50 | + ); ?> | ||
51 | + <?php | ||
52 | + $xPanel::end(); | ||
53 | + ?> | ||
54 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yiister\gentelella\widgets\Panel; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var yii\web\View $this | ||
8 | + * @var artbox\order\models\Delivery $model | ||
9 | + * @var \artbox\order\models\DeliveryLang[] $modelLangs | ||
10 | + */ | ||
11 | + $this->title = Yii::t( | ||
12 | + 'order', | ||
13 | + 'Update {modelClass}: ', | ||
14 | + [ | ||
15 | + 'modelClass' => 'Delivery', | ||
16 | + ] | ||
17 | + ) . $model->id; | ||
18 | + $this->params[ 'breadcrumbs' ][] = [ | ||
19 | + 'label' => Yii::t('order', 'Deliveries'), | ||
20 | + 'url' => [ 'index' ], | ||
21 | + ]; | ||
22 | + $this->params[ 'breadcrumbs' ][] = [ | ||
23 | + 'label' => $model->id, | ||
24 | + 'url' => [ | ||
25 | + 'view', | ||
26 | + 'id' => $model->id, | ||
27 | + ], | ||
28 | + ]; | ||
29 | + $this->params[ 'breadcrumbs' ][] = Yii::t('order', 'Update'); | ||
30 | +?> | ||
31 | +<div class="delivery-update"> | ||
32 | + <?php | ||
33 | + $xPanel = Panel::begin( | ||
34 | + [ | ||
35 | + 'header' => $this->title, | ||
36 | + ] | ||
37 | + ); | ||
38 | + ?> | ||
39 | + <?= $this->render( | ||
40 | + '_form', | ||
41 | + [ | ||
42 | + 'model' => $model, | ||
43 | + 'modelLangs' => $modelLangs, | ||
44 | + ] | ||
45 | + ) ?> | ||
46 | + <?php | ||
47 | + $xPanel::end(); | ||
48 | + ?> | ||
49 | + | ||
50 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\DetailView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /* @var $this yii\web\View */ | ||
8 | + /* @var $model artbox\order\models\Delivery */ | ||
9 | + | ||
10 | + $this->title = $model->id; | ||
11 | + $this->params[ 'breadcrumbs' ][] = [ | ||
12 | + 'label' => Yii::t('order', 'Deliveries'), | ||
13 | + 'url' => [ 'index' ], | ||
14 | + ]; | ||
15 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
16 | +?> | ||
17 | +<div class="delivery-view"> | ||
18 | + <?php | ||
19 | + $xPanel = Panel::begin( | ||
20 | + [ | ||
21 | + 'header' => $this->title, | ||
22 | + ] | ||
23 | + ); | ||
24 | + ?> | ||
25 | + <p> | ||
26 | + <?= Html::a( | ||
27 | + Yii::t('order', 'Update'), | ||
28 | + [ | ||
29 | + 'update', | ||
30 | + 'id' => $model->id, | ||
31 | + ], | ||
32 | + [ 'class' => 'btn btn-primary' ] | ||
33 | + ) ?> | ||
34 | + <?= Html::a( | ||
35 | + Yii::t('order', 'Delete'), | ||
36 | + [ | ||
37 | + 'delete', | ||
38 | + 'id' => $model->id, | ||
39 | + ], | ||
40 | + [ | ||
41 | + 'class' => 'btn btn-danger', | ||
42 | + 'data' => [ | ||
43 | + 'confirm' => Yii::t('order', 'Are you sure you want to delete this item?'), | ||
44 | + 'method' => 'post', | ||
45 | + ], | ||
46 | + ] | ||
47 | + ) ?> | ||
48 | + </p> | ||
49 | + | ||
50 | + <?= DetailView::widget( | ||
51 | + [ | ||
52 | + 'model' => $model, | ||
53 | + 'attributes' => [ | ||
54 | + 'id', | ||
55 | + 'lang.title', | ||
56 | + 'lang.description', | ||
57 | + 'sort', | ||
58 | + 'value', | ||
59 | + 'status:boolean', | ||
60 | + ], | ||
61 | + ] | ||
62 | + ) ?> | ||
63 | + <?php | ||
64 | + $xPanel::end(); | ||
65 | + ?> | ||
66 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use artbox\core\widgets\LanguageForm; | ||
4 | + use yii\helpers\Html; | ||
5 | + use yii\widgets\ActiveForm; | ||
6 | + | ||
7 | + /** | ||
8 | + * @var \yii\web\View $this | ||
9 | + * @var \artbox\order\models\Label $model | ||
10 | + * @var \artbox\order\models\LabelLang[] $modelLangs | ||
11 | + * @var ActiveForm $form | ||
12 | + */ | ||
13 | +?> | ||
14 | + | ||
15 | +<div class="label-form"> | ||
16 | + | ||
17 | + <?php $form = ActiveForm::begin(); ?> | ||
18 | + | ||
19 | + <?= LanguageForm::widget( | ||
20 | + [ | ||
21 | + 'modelLangs' => $modelLangs, | ||
22 | + 'formView' => '@artbox/order/views/label/_form_language', | ||
23 | + 'form' => $form, | ||
24 | + ] | ||
25 | + ) ?> | ||
26 | + | ||
27 | + <?= $form->field($model, 'sort') | ||
28 | + ->textInput() ?> | ||
29 | + | ||
30 | + <?= $form->field($model, 'value') | ||
31 | + ->textInput() ?> | ||
32 | + | ||
33 | + <?= $form->field($model, 'status') | ||
34 | + ->checkbox( | ||
35 | + [ | ||
36 | + 'class' => 'flat', | ||
37 | + ] | ||
38 | + ) ?> | ||
39 | + | ||
40 | + <div class="form-group"> | ||
41 | + <?= Html::submitButton( | ||
42 | + $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | ||
43 | + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] | ||
44 | + ) ?> | ||
45 | + </div> | ||
46 | + | ||
47 | + <?php ActiveForm::end(); ?> | ||
48 | + | ||
49 | +</div> |
1 | +<?php | ||
2 | + use artbox\core\helpers\SlugifyDecorator; | ||
3 | + use artbox\core\models\Language; | ||
4 | + use dosamigos\tinymce\TinyMce; | ||
5 | + use yii\web\View; | ||
6 | + use yii\widgets\ActiveForm; | ||
7 | + | ||
8 | + /** | ||
9 | + * @var \artbox\order\models\LabelLang $model_lang | ||
10 | + * @var Language $language | ||
11 | + * @var ActiveForm $form | ||
12 | + * @var View $this | ||
13 | + */ | ||
14 | + | ||
15 | + echo $form->field($model_lang, '[' . $language->id . ']title') | ||
16 | + ->textInput([ 'maxlength' => true ]); | ||
17 | + | ||
18 | + echo $form->field($model_lang, '[' . $language->id . ']description') | ||
19 | + ->textarea(); | ||
20 | + | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $model common\models\LabelSearch */ | ||
8 | + /* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="label-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin( | ||
14 | + [ | ||
15 | + 'action' => [ 'index' ], | ||
16 | + 'method' => 'get', | ||
17 | + ] | ||
18 | + ); ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'sort') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'value') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'status') | ||
27 | + ->checkbox() ?> | ||
28 | + | ||
29 | + <div class="form-group"> | ||
30 | + <?= Html::submitButton(Yii::t('order', 'Search'), [ 'class' => 'btn btn-primary' ]) ?> | ||
31 | + <?= Html::resetButton(Yii::t('order', 'Reset'), [ 'class' => 'btn btn-default' ]) ?> | ||
32 | + </div> | ||
33 | + | ||
34 | + <?php ActiveForm::end(); ?> | ||
35 | + | ||
36 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yiister\gentelella\widgets\Panel; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var \yii\web\View $this | ||
8 | + * @var \artbox\order\models\Label $model | ||
9 | + * @var \artbox\order\models\LabelLang[] $modelLangs | ||
10 | + */ | ||
11 | + $this->title = Yii::t('order', 'Create Label'); | ||
12 | + $this->params[ 'breadcrumbs' ][] = [ | ||
13 | + 'label' => Yii::t('order', 'Labels'), | ||
14 | + 'url' => [ 'index' ], | ||
15 | + ]; | ||
16 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
17 | +?> | ||
18 | +<div class="label-create"> | ||
19 | + <?php | ||
20 | + $xPanel = Panel::begin( | ||
21 | + [ | ||
22 | + 'header' => $this->title, | ||
23 | + ] | ||
24 | + ); | ||
25 | + echo $this->render( | ||
26 | + '_form', | ||
27 | + [ | ||
28 | + 'model' => $model, | ||
29 | + 'modelLangs' => $modelLangs, | ||
30 | + ] | ||
31 | + ); | ||
32 | + $xPanel::end(); | ||
33 | + ?> | ||
34 | + | ||
35 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\grid\GridView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /* @var $this yii\web\View */ | ||
8 | + /* @var $searchModel artbox\order\models\LabelSearch */ | ||
9 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | ||
10 | + | ||
11 | + $this->title = Yii::t('order', 'Labels'); | ||
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
13 | +?> | ||
14 | +<div class="label-index"> | ||
15 | + <?php | ||
16 | + $xPanel = Panel::begin( | ||
17 | + [ | ||
18 | + 'header' => $this->title, | ||
19 | + ] | ||
20 | + ); | ||
21 | + ?> | ||
22 | + <p> | ||
23 | + <?= Html::a(Yii::t('order', 'Create Label'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | ||
24 | + </p> | ||
25 | + <?= GridView::widget( | ||
26 | + [ | ||
27 | + 'dataProvider' => $dataProvider, | ||
28 | + 'filterModel' => $searchModel, | ||
29 | + 'columns' => [ | ||
30 | + [ 'class' => 'yii\grid\SerialColumn' ], | ||
31 | + | ||
32 | + 'id', | ||
33 | + [ | ||
34 | + 'attribute' => 'title', | ||
35 | + 'value' => 'lang.title', | ||
36 | + ], | ||
37 | + 'value', | ||
38 | + [ | ||
39 | + 'attribute' => 'status', | ||
40 | + 'filter' => [ | ||
41 | + 0 => \Yii::$app->formatter->asBoolean(false), | ||
42 | + 1 => \Yii::$app->formatter->asBoolean(true), | ||
43 | + ], | ||
44 | + ], | ||
45 | + | ||
46 | + [ 'class' => 'yii\grid\ActionColumn' ], | ||
47 | + ], | ||
48 | + ] | ||
49 | + ); ?> | ||
50 | + <?php | ||
51 | + $xPanel::end(); | ||
52 | + ?> | ||
53 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yiister\gentelella\widgets\Panel; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var \yii\web\View $this | ||
8 | + * @var \artbox\order\models\Label $model | ||
9 | + * @var \artbox\order\models\LabelLang[] $modelLangs | ||
10 | + */ | ||
11 | + $this->title = Yii::t( | ||
12 | + 'order', | ||
13 | + 'Update {modelClass}: ', | ||
14 | + [ | ||
15 | + 'modelClass' => 'Label', | ||
16 | + ] | ||
17 | + ) . $model->id; | ||
18 | + $this->params[ 'breadcrumbs' ][] = [ | ||
19 | + 'label' => Yii::t('order', 'Labels'), | ||
20 | + 'url' => [ 'index' ], | ||
21 | + ]; | ||
22 | + $this->params[ 'breadcrumbs' ][] = [ | ||
23 | + 'label' => $model->id, | ||
24 | + 'url' => [ | ||
25 | + 'view', | ||
26 | + 'id' => $model->id, | ||
27 | + ], | ||
28 | + ]; | ||
29 | + $this->params[ 'breadcrumbs' ][] = Yii::t('order', 'Update'); | ||
30 | +?> | ||
31 | +<div class="label-update"> | ||
32 | + <?php | ||
33 | + $xPanel = Panel::begin( | ||
34 | + [ | ||
35 | + 'header' => $this->title, | ||
36 | + ] | ||
37 | + ); | ||
38 | + ?> | ||
39 | + <?= $this->render( | ||
40 | + '_form', | ||
41 | + [ | ||
42 | + 'model' => $model, | ||
43 | + 'modelLangs' => $modelLangs, | ||
44 | + ] | ||
45 | + ) ?> | ||
46 | + | ||
47 | + <?php | ||
48 | + $xPanel::end(); | ||
49 | + ?> | ||
50 | + | ||
51 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\DetailView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /* @var $this yii\web\View */ | ||
8 | + /* @var $model artbox\order\models\Label */ | ||
9 | + | ||
10 | + $this->title = $model->lang->title; | ||
11 | + $this->params[ 'breadcrumbs' ][] = [ | ||
12 | + 'label' => Yii::t('order', 'Labels'), | ||
13 | + 'url' => [ 'index' ], | ||
14 | + ]; | ||
15 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
16 | +?> | ||
17 | +<div class="label-view"> | ||
18 | + <?php | ||
19 | + $xPanel = Panel::begin( | ||
20 | + [ | ||
21 | + 'header' => $this->title, | ||
22 | + ] | ||
23 | + ); | ||
24 | + ?> | ||
25 | + <p> | ||
26 | + <?= Html::a( | ||
27 | + Yii::t('order', 'Update'), | ||
28 | + [ | ||
29 | + 'update', | ||
30 | + 'id' => $model->id, | ||
31 | + ], | ||
32 | + [ 'class' => 'btn btn-primary' ] | ||
33 | + ) ?> | ||
34 | + <?= Html::a( | ||
35 | + Yii::t('order', 'Delete'), | ||
36 | + [ | ||
37 | + 'delete', | ||
38 | + 'id' => $model->id, | ||
39 | + ], | ||
40 | + [ | ||
41 | + 'class' => 'btn btn-danger', | ||
42 | + 'data' => [ | ||
43 | + 'confirm' => Yii::t('order', 'Are you sure you want to delete this item?'), | ||
44 | + 'method' => 'post', | ||
45 | + ], | ||
46 | + ] | ||
47 | + ) ?> | ||
48 | + </p> | ||
49 | + | ||
50 | + <?= DetailView::widget( | ||
51 | + [ | ||
52 | + 'model' => $model, | ||
53 | + 'attributes' => [ | ||
54 | + 'id', | ||
55 | + 'lang.title', | ||
56 | + 'lang.description', | ||
57 | + 'sort', | ||
58 | + 'value', | ||
59 | + 'status:boolean', | ||
60 | + ], | ||
61 | + ] | ||
62 | + ) ?> | ||
63 | + | ||
64 | + <?php | ||
65 | + $xPanel::end(); | ||
66 | + ?> | ||
67 | + | ||
68 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $model artbox\order\models\OrderProduct */ | ||
8 | + /* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="order-product-form"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin(); ?> | ||
14 | + | ||
15 | + <?= $form->field($model, 'order_id') | ||
16 | + ->textInput() ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'variant_id') | ||
19 | + ->textInput() ?> | ||
20 | + | ||
21 | + <?= $form->field($model, 'sku') | ||
22 | + ->textInput([ 'maxlength' => true ]) ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'price') | ||
25 | + ->textInput() ?> | ||
26 | + | ||
27 | + <?= $form->field($model, 'count') | ||
28 | + ->textInput() ?> | ||
29 | + | ||
30 | + <div class="form-group"> | ||
31 | + <?= Html::submitButton( | ||
32 | + $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | ||
33 | + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] | ||
34 | + ) ?> | ||
35 | + </div> | ||
36 | + | ||
37 | + <?php ActiveForm::end(); ?> | ||
38 | + | ||
39 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $model common\models\OrderProductSearch */ | ||
8 | + /* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="order-product-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin( | ||
14 | + [ | ||
15 | + 'action' => [ 'index' ], | ||
16 | + 'method' => 'get', | ||
17 | + ] | ||
18 | + ); ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'order_id') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'variant_id') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'sku') ?> | ||
27 | + | ||
28 | + <?= $form->field($model, 'price') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'count') ?> | ||
31 | + | ||
32 | + <div class="form-group"> | ||
33 | + <?= Html::submitButton(Yii::t('order', 'Search'), [ 'class' => 'btn btn-primary' ]) ?> | ||
34 | + <?= Html::resetButton(Yii::t('order', 'Reset'), [ 'class' => 'btn btn-default' ]) ?> | ||
35 | + </div> | ||
36 | + | ||
37 | + <?php ActiveForm::end(); ?> | ||
38 | + | ||
39 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + | ||
5 | + /* @var $this yii\web\View */ | ||
6 | + /* @var $model artbox\order\models\OrderProduct */ | ||
7 | + | ||
8 | + $this->title = Yii::t('order', 'Create Order Product'); | ||
9 | + $this->params[ 'breadcrumbs' ][] = [ | ||
10 | + 'label' => Yii::t('order', 'Order Products'), | ||
11 | + 'url' => [ 'index' ], | ||
12 | + ]; | ||
13 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
14 | +?> | ||
15 | +<div class="order-product-create"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render( | ||
20 | + '_form', | ||
21 | + [ | ||
22 | + 'model' => $model, | ||
23 | + ] | ||
24 | + ) ?> | ||
25 | + | ||
26 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\grid\GridView; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $searchModel common\models\OrderProductSearch */ | ||
8 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | + $this->title = Yii::t('order', 'Order Products'); | ||
11 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="order-product-index"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
17 | + | ||
18 | + <p> | ||
19 | + <?= Html::a(Yii::t('order', 'Create Order Product'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | ||
20 | + </p> | ||
21 | + <?= GridView::widget( | ||
22 | + [ | ||
23 | + 'dataProvider' => $dataProvider, | ||
24 | + 'filterModel' => $searchModel, | ||
25 | + 'columns' => [ | ||
26 | + [ 'class' => 'yii\grid\SerialColumn' ], | ||
27 | + | ||
28 | + 'id', | ||
29 | + 'order_id', | ||
30 | + 'variant_id', | ||
31 | + 'sku', | ||
32 | + 'price', | ||
33 | + // 'count', | ||
34 | + | ||
35 | + [ 'class' => 'yii\grid\ActionColumn' ], | ||
36 | + ], | ||
37 | + ] | ||
38 | + ); ?> | ||
39 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + | ||
5 | + /* @var $this yii\web\View */ | ||
6 | + /* @var $model artbox\order\models\OrderProduct */ | ||
7 | + | ||
8 | + $this->title = Yii::t( | ||
9 | + 'order', | ||
10 | + 'Update {modelClass}: ', | ||
11 | + [ | ||
12 | + 'modelClass' => 'Order Product', | ||
13 | + ] | ||
14 | + ) . $model->id; | ||
15 | + $this->params[ 'breadcrumbs' ][] = [ | ||
16 | + 'label' => Yii::t('order', 'Order Products'), | ||
17 | + 'url' => [ 'index' ], | ||
18 | + ]; | ||
19 | + $this->params[ 'breadcrumbs' ][] = [ | ||
20 | + 'label' => $model->id, | ||
21 | + 'url' => [ | ||
22 | + 'view', | ||
23 | + 'id' => $model->id, | ||
24 | + ], | ||
25 | + ]; | ||
26 | + $this->params[ 'breadcrumbs' ][] = Yii::t('order', 'Update'); | ||
27 | +?> | ||
28 | +<div class="order-product-update"> | ||
29 | + | ||
30 | + <h1><?= Html::encode($this->title) ?></h1> | ||
31 | + | ||
32 | + <?= $this->render( | ||
33 | + '_form', | ||
34 | + [ | ||
35 | + 'model' => $model, | ||
36 | + ] | ||
37 | + ) ?> | ||
38 | + | ||
39 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\DetailView; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $model artbox\order\models\OrderProduct */ | ||
8 | + | ||
9 | + $this->title = $model->id; | ||
10 | + $this->params[ 'breadcrumbs' ][] = [ | ||
11 | + 'label' => Yii::t('order', 'Order Products'), | ||
12 | + 'url' => [ 'index' ], | ||
13 | + ]; | ||
14 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
15 | +?> | ||
16 | +<div class="order-product-view"> | ||
17 | + | ||
18 | + <h1><?= Html::encode($this->title) ?></h1> | ||
19 | + | ||
20 | + <p> | ||
21 | + <?= Html::a( | ||
22 | + Yii::t('order', 'Update'), | ||
23 | + [ | ||
24 | + 'update', | ||
25 | + 'id' => $model->id, | ||
26 | + ], | ||
27 | + [ 'class' => 'btn btn-primary' ] | ||
28 | + ) ?> | ||
29 | + <?= Html::a( | ||
30 | + Yii::t('order', 'Delete'), | ||
31 | + [ | ||
32 | + 'delete', | ||
33 | + 'id' => $model->id, | ||
34 | + ], | ||
35 | + [ | ||
36 | + 'class' => 'btn btn-danger', | ||
37 | + 'data' => [ | ||
38 | + 'confirm' => Yii::t('order', 'Are you sure you want to delete this item?'), | ||
39 | + 'method' => 'post', | ||
40 | + ], | ||
41 | + ] | ||
42 | + ) ?> | ||
43 | + </p> | ||
44 | + | ||
45 | + <?= DetailView::widget( | ||
46 | + [ | ||
47 | + 'model' => $model, | ||
48 | + 'attributes' => [ | ||
49 | + 'id', | ||
50 | + 'order_id', | ||
51 | + 'variant_id', | ||
52 | + 'sku', | ||
53 | + 'price', | ||
54 | + 'count', | ||
55 | + ], | ||
56 | + ] | ||
57 | + ) ?> | ||
58 | + | ||
59 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\bootstrap\Html; | ||
4 | + use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var \yii\web\View $this | ||
8 | + * @var \artbox\order\models\Order $model | ||
9 | + * @var array $labels | ||
10 | + * @var array $deliveries | ||
11 | + * @var array $payments | ||
12 | + * @var ActiveForm $form | ||
13 | + */ | ||
14 | +?> | ||
15 | + | ||
16 | +<div class="order-form"> | ||
17 | + | ||
18 | + <?php $form = ActiveForm::begin(); ?> | ||
19 | + | ||
20 | + <?php | ||
21 | + if ($model->isNewRecord) { | ||
22 | + echo $form->field($model, 'user_id') | ||
23 | + ->textInput(); | ||
24 | + } | ||
25 | + ?> | ||
26 | + | ||
27 | + <?= $form->field($model, 'name') | ||
28 | + ->textInput([ 'maxlength' => true ]) ?> | ||
29 | + | ||
30 | + <?= $form->field($model, 'phone') | ||
31 | + ->textInput([ 'maxlength' => true ]) ?> | ||
32 | + | ||
33 | + <?= $form->field($model, 'email') | ||
34 | + ->textInput([ 'maxlength' => true ]) ?> | ||
35 | + | ||
36 | + <?= $form->field($model, 'city') | ||
37 | + ->textInput([ 'maxlength' => true ]) ?> | ||
38 | + | ||
39 | + <?= $form->field($model, 'address') | ||
40 | + ->textInput([ 'maxlength' => true ]) ?> | ||
41 | + | ||
42 | + <?= $form->field($model, 'comment') | ||
43 | + ->textInput([ 'maxlength' => true ]) ?> | ||
44 | + | ||
45 | + <?= $form->field($model, 'label_id') | ||
46 | + ->dropDownList($labels) ?> | ||
47 | + | ||
48 | + <?= $form->field($model, 'delivery_id') | ||
49 | + ->dropDownList($deliveries) ?> | ||
50 | + | ||
51 | + <?= $form->field($model, 'payment_id') | ||
52 | + ->dropDownList($payments) ?> | ||
53 | + <?php | ||
54 | + if (!$model->isNewRecord) { | ||
55 | + ?> | ||
56 | + <div class="order-product-container"> | ||
57 | + <div class="row strong"> | ||
58 | + <div class="col-md-4"> | ||
59 | + <?php | ||
60 | + echo Html::tag('strong', \Yii::t('order', 'Product')); | ||
61 | + ?> | ||
62 | + </div> | ||
63 | + <div class="col-md-4"> | ||
64 | + <?php | ||
65 | + echo Html::tag('strong', \Yii::t('order', 'Price')); | ||
66 | + ?> | ||
67 | + </div> | ||
68 | + <div class="col-md-4"> | ||
69 | + <?php | ||
70 | + echo Html::tag('strong', \Yii::t('order', 'Count')); | ||
71 | + ?> | ||
72 | + </div> | ||
73 | + </div> | ||
74 | + | ||
75 | + <?php | ||
76 | + foreach ($model->orderProducts as $index => $orderProduct) { | ||
77 | + ?> | ||
78 | + <div class="row row-order-product"> | ||
79 | + <div class="col-md-4"> | ||
80 | + <?php | ||
81 | + echo $form->field($orderProduct, "[$index]variant_id") | ||
82 | + ->hiddenInput() | ||
83 | + ->label(false); | ||
84 | + echo $orderProduct->variant->product->lang->title . '(' . $orderProduct->variant->sku . ')'; | ||
85 | + ?> | ||
86 | + </div> | ||
87 | + <div class="col-md-4"> | ||
88 | + <?php echo $orderProduct->price; ?> | ||
89 | + </div> | ||
90 | + <div class="col-md-3"> | ||
91 | + <?php | ||
92 | + echo $form->field($orderProduct, "[$index]count") | ||
93 | + ->textInput() | ||
94 | + ->label(false); | ||
95 | + ?> | ||
96 | + </div> | ||
97 | + <div class="col-md-1"> | ||
98 | + <?php | ||
99 | + echo Html::a( | ||
100 | + Html::icon( | ||
101 | + 'trash-o', | ||
102 | + [ | ||
103 | + 'prefix' => 'fa fa-', | ||
104 | + ] | ||
105 | + ), | ||
106 | + '#', | ||
107 | + [ | ||
108 | + 'class' => 'remove-order-product', | ||
109 | + ] | ||
110 | + ) | ||
111 | + ?> | ||
112 | + </div> | ||
113 | + </div> | ||
114 | + <?php | ||
115 | + } | ||
116 | + ?> | ||
117 | + <div class="row"> | ||
118 | + <div class="col-md-8"> | ||
119 | + </div> | ||
120 | + <div class="col-md-4"> | ||
121 | + </div> | ||
122 | + </div> | ||
123 | + </div> | ||
124 | + <?php | ||
125 | + } | ||
126 | + ?> | ||
127 | + | ||
128 | + <div class="form-group"> | ||
129 | + <?= Html::submitButton( | ||
130 | + $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | ||
131 | + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] | ||
132 | + ) ?> | ||
133 | + </div> | ||
134 | + | ||
135 | + <?php ActiveForm::end(); ?> | ||
136 | + | ||
137 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $model common\models\OrderSearch */ | ||
8 | + /* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="order-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin( | ||
14 | + [ | ||
15 | + 'action' => [ 'index' ], | ||
16 | + 'method' => 'get', | ||
17 | + ] | ||
18 | + ); ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'user_id') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'name') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'phone') ?> | ||
27 | + | ||
28 | + <?= $form->field($model, 'email') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'city') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'address') ?> | ||
33 | + | ||
34 | + <?php // echo $form->field($model, 'comment') ?> | ||
35 | + | ||
36 | + <?php // echo $form->field($model, 'label_id') ?> | ||
37 | + | ||
38 | + <?php // echo $form->field($model, 'delivery_id') ?> | ||
39 | + | ||
40 | + <?php // echo $form->field($model, 'payment_id') ?> | ||
41 | + | ||
42 | + <?php // echo $form->field($model, 'created_at') ?> | ||
43 | + | ||
44 | + <?php // echo $form->field($model, 'updated_at') ?> | ||
45 | + | ||
46 | + <?php // echo $form->field($model, 'deleted_at') ?> | ||
47 | + | ||
48 | + <div class="form-group"> | ||
49 | + <?= Html::submitButton(Yii::t('order', 'Search'), [ 'class' => 'btn btn-primary' ]) ?> | ||
50 | + <?= Html::resetButton(Yii::t('order', 'Reset'), [ 'class' => 'btn btn-default' ]) ?> | ||
51 | + </div> | ||
52 | + | ||
53 | + <?php ActiveForm::end(); ?> | ||
54 | + | ||
55 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yiister\gentelella\widgets\Panel; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var \yii\web\View $this | ||
8 | + * @var \artbox\order\models\Order $model | ||
9 | + * @var array $labels | ||
10 | + * @var array $deliveries | ||
11 | + * @var array $payments | ||
12 | + */ | ||
13 | + | ||
14 | + $this->title = Yii::t('order', 'Create Order'); | ||
15 | + $this->params[ 'breadcrumbs' ][] = [ | ||
16 | + 'label' => Yii::t('order', 'Orders'), | ||
17 | + 'url' => [ 'index' ], | ||
18 | + ]; | ||
19 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
20 | +?> | ||
21 | +<div class="order-create"> | ||
22 | + <?php | ||
23 | + $xPanel = Panel::begin( | ||
24 | + [ | ||
25 | + 'header' => $this->title, | ||
26 | + ] | ||
27 | + ); | ||
28 | + ?> | ||
29 | + <h1><?= Html::encode($this->title) ?></h1> | ||
30 | + | ||
31 | + <?= $this->render( | ||
32 | + '_form', | ||
33 | + [ | ||
34 | + 'model' => $model, | ||
35 | + ] | ||
36 | + ) ?> | ||
37 | + | ||
38 | + <?php | ||
39 | + $xPanel::end(); | ||
40 | + ?> | ||
41 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\grid\GridView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /** | ||
8 | + * @var \yii\web\View $this | ||
9 | + * @var \artbox\order\models\OrderSearch $searchModel | ||
10 | + * @var \yii\data\ActiveDataProvider $dataProvider | ||
11 | + * @var array $labels | ||
12 | + */ | ||
13 | + | ||
14 | + $this->title = Yii::t('order', 'Orders'); | ||
15 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
16 | +?> | ||
17 | +<div class="order-index"> | ||
18 | + | ||
19 | + <?php | ||
20 | + $xPanel = Panel::begin( | ||
21 | + [ | ||
22 | + 'header' => $this->title, | ||
23 | + ] | ||
24 | + ); | ||
25 | + ?> | ||
26 | + <p> | ||
27 | + <?= Html::a(Yii::t('order', 'Create Order'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | ||
28 | + </p> | ||
29 | + <?= GridView::widget( | ||
30 | + [ | ||
31 | + 'dataProvider' => $dataProvider, | ||
32 | + 'filterModel' => $searchModel, | ||
33 | + 'columns' => [ | ||
34 | + [ 'class' => 'yii\grid\SerialColumn' ], | ||
35 | + | ||
36 | + 'id', | ||
37 | + 'user_id', | ||
38 | + 'name', | ||
39 | + 'phone', | ||
40 | + 'email:email', | ||
41 | + [ | ||
42 | + 'attribute' => 'label_id', | ||
43 | + 'value' => 'label.lang.title', | ||
44 | + 'filter' => $labels, | ||
45 | + ], | ||
46 | + 'created_at:datetime', | ||
47 | + [ | ||
48 | + 'attribute' => 'count', | ||
49 | + 'value' => function ($model) { | ||
50 | + /** | ||
51 | + * @var \artbox\order\models\Order $model | ||
52 | + */ | ||
53 | + return count($model->orderProducts); | ||
54 | + }, | ||
55 | + ], | ||
56 | + | ||
57 | + [ 'class' => 'yii\grid\ActionColumn' ], | ||
58 | + ], | ||
59 | + ] | ||
60 | + ); ?> | ||
61 | + <?php | ||
62 | + $xPanel::end(); | ||
63 | + ?> | ||
64 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yiister\gentelella\widgets\Panel; | ||
4 | + | ||
5 | + /** | ||
6 | + * @var \yii\web\View $this | ||
7 | + * @var \artbox\order\models\Order $model | ||
8 | + * @var array $labels | ||
9 | + * @var array $deliveries | ||
10 | + * @var array $payments | ||
11 | + * @var \artbox\order\models\OrderProduct[] $orderProducts | ||
12 | + */ | ||
13 | + | ||
14 | + $this->title = Yii::t( | ||
15 | + 'order', | ||
16 | + 'Update {modelClass}: ', | ||
17 | + [ | ||
18 | + 'modelClass' => 'Order', | ||
19 | + ] | ||
20 | + ) . $model->name; | ||
21 | + $this->params[ 'breadcrumbs' ][] = [ | ||
22 | + 'label' => Yii::t('order', 'Orders'), | ||
23 | + 'url' => [ 'index' ], | ||
24 | + ]; | ||
25 | + $this->params[ 'breadcrumbs' ][] = [ | ||
26 | + 'label' => $model->name, | ||
27 | + 'url' => [ | ||
28 | + 'view', | ||
29 | + 'id' => $model->id, | ||
30 | + ], | ||
31 | + ]; | ||
32 | + $this->params[ 'breadcrumbs' ][] = Yii::t('order', 'Update'); | ||
33 | +?> | ||
34 | +<div class="order-update"> | ||
35 | + <?php | ||
36 | + $xPanel = Panel::begin( | ||
37 | + [ | ||
38 | + 'header' => $this->title, | ||
39 | + ] | ||
40 | + ); | ||
41 | + ?> | ||
42 | + | ||
43 | + <?= $this->render( | ||
44 | + '_form', | ||
45 | + [ | ||
46 | + 'model' => $model, | ||
47 | + 'labels' => $labels, | ||
48 | + 'payments' => $payments, | ||
49 | + 'deliveries' => $deliveries, | ||
50 | + ] | ||
51 | + ) ?> | ||
52 | + | ||
53 | + <?php | ||
54 | + $xPanel::end(); | ||
55 | + ?> | ||
56 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\bootstrap\Html; | ||
4 | + use yii\widgets\DetailView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /* @var $this yii\web\View */ | ||
8 | + /* @var $model artbox\order\models\Order */ | ||
9 | + | ||
10 | + $this->title = $model->name; | ||
11 | + $this->params[ 'breadcrumbs' ][] = [ | ||
12 | + 'label' => Yii::t('order', 'Orders'), | ||
13 | + 'url' => [ 'index' ], | ||
14 | + ]; | ||
15 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
16 | +?> | ||
17 | +<div class="order-view"> | ||
18 | + <?php | ||
19 | + $xPanel = Panel::begin( | ||
20 | + [ | ||
21 | + 'header' => $this->title, | ||
22 | + ] | ||
23 | + ); | ||
24 | + ?> | ||
25 | + <p> | ||
26 | + <?= Html::a( | ||
27 | + Yii::t('order', 'Update'), | ||
28 | + [ | ||
29 | + 'update', | ||
30 | + 'id' => $model->id, | ||
31 | + ], | ||
32 | + [ 'class' => 'btn btn-primary' ] | ||
33 | + ) ?> | ||
34 | + <?= Html::a( | ||
35 | + Yii::t('order', 'Delete'), | ||
36 | + [ | ||
37 | + 'delete', | ||
38 | + 'id' => $model->id, | ||
39 | + ], | ||
40 | + [ | ||
41 | + 'class' => 'btn btn-danger', | ||
42 | + 'data' => [ | ||
43 | + 'confirm' => Yii::t('order', 'Are you sure you want to delete this item?'), | ||
44 | + 'method' => 'post', | ||
45 | + ], | ||
46 | + ] | ||
47 | + ) ?> | ||
48 | + </p> | ||
49 | + | ||
50 | + <?= DetailView::widget( | ||
51 | + [ | ||
52 | + 'model' => $model, | ||
53 | + 'attributes' => [ | ||
54 | + 'id', | ||
55 | + 'user_id', | ||
56 | + 'name', | ||
57 | + 'phone', | ||
58 | + 'email:email', | ||
59 | + 'city', | ||
60 | + 'address', | ||
61 | + 'comment', | ||
62 | + 'created_at', | ||
63 | + 'updated_at', | ||
64 | + 'deleted_at', | ||
65 | + [ | ||
66 | + 'label' => \Yii::t('order', 'Label'), | ||
67 | + 'attribute' => 'label.lang.title', | ||
68 | + ], | ||
69 | + [ | ||
70 | + 'label' => \Yii::t('order', 'Delivery'), | ||
71 | + 'attribute' => 'delivery.lang.title', | ||
72 | + ], | ||
73 | + [ | ||
74 | + 'label' => \Yii::t('order', 'Payment'), | ||
75 | + 'attribute' => 'payment.lang.title', | ||
76 | + ], | ||
77 | + [ | ||
78 | + 'label' => \Yii::t('order', 'Products'), | ||
79 | + 'value' => function () use ($model) { | ||
80 | + $items = ''; | ||
81 | + foreach ($model->orderProducts as $orderProduct) { | ||
82 | + $sum = $orderProduct->price * $orderProduct->count; | ||
83 | + $items .= Html::tag( | ||
84 | + 'li', | ||
85 | + Html::a( | ||
86 | + $orderProduct->variant->product->lang->title . ' (' . $orderProduct->sku . ')', | ||
87 | + [ | ||
88 | + 'product/view', | ||
89 | + 'id' => $orderProduct->variant->product->id, | ||
90 | + ], | ||
91 | + [ | ||
92 | + 'class' => 'test', | ||
93 | + 'target' => '_blank', | ||
94 | + ] | ||
95 | + ) . ' - ' . $orderProduct->price . 'грн.' . ' * ' . $orderProduct->count . 'x = ' . $sum . 'грн.' | ||
96 | + ); | ||
97 | + } | ||
98 | + return Html::tag('ul', $items); | ||
99 | + }, | ||
100 | + 'format' => 'html', | ||
101 | + ], | ||
102 | + ], | ||
103 | + ] | ||
104 | + ) ?> | ||
105 | + | ||
106 | + <?php | ||
107 | + $xPanel::end(); | ||
108 | + ?> | ||
109 | + | ||
110 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use artbox\core\widgets\LanguageForm; | ||
4 | + use yii\helpers\Html; | ||
5 | + use yii\widgets\ActiveForm; | ||
6 | + | ||
7 | + /** | ||
8 | + * @var \yii\web\View $this | ||
9 | + * @var \artbox\order\models\Payment $model | ||
10 | + * @var \artbox\order\models\PaymentLang[] $modelLangs | ||
11 | + * @var ActiveForm $form | ||
12 | + */ | ||
13 | +?> | ||
14 | + | ||
15 | +<div class="payment-form"> | ||
16 | + | ||
17 | + <?php $form = ActiveForm::begin(); ?> | ||
18 | + | ||
19 | + <?= LanguageForm::widget( | ||
20 | + [ | ||
21 | + 'modelLangs' => $modelLangs, | ||
22 | + 'formView' => '@artbox/order/views/payment/_form_language', | ||
23 | + 'form' => $form, | ||
24 | + ] | ||
25 | + ) ?> | ||
26 | + | ||
27 | + <?= $form->field($model, 'sort') | ||
28 | + ->textInput() ?> | ||
29 | + | ||
30 | + <?= $form->field($model, 'status') | ||
31 | + ->checkbox( | ||
32 | + [ | ||
33 | + 'class' => 'flat', | ||
34 | + ] | ||
35 | + ) ?> | ||
36 | + | ||
37 | + <div class="form-group"> | ||
38 | + <?= Html::submitButton( | ||
39 | + $model->isNewRecord ? Yii::t('order', 'Create') : Yii::t('order', 'Update'), | ||
40 | + [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ] | ||
41 | + ) ?> | ||
42 | + </div> | ||
43 | + | ||
44 | + <?php ActiveForm::end(); ?> | ||
45 | + | ||
46 | +</div> |
1 | +<?php | ||
2 | + use artbox\core\helpers\SlugifyDecorator; | ||
3 | + use artbox\core\models\Language; | ||
4 | + use dosamigos\tinymce\TinyMce; | ||
5 | + use yii\web\View; | ||
6 | + use yii\widgets\ActiveForm; | ||
7 | + | ||
8 | + /** | ||
9 | + * @var \artbox\order\models\PaymentLang $model_lang | ||
10 | + * @var Language $language | ||
11 | + * @var ActiveForm $form | ||
12 | + * @var View $this | ||
13 | + */ | ||
14 | + | ||
15 | + echo $form->field($model_lang, '[' . $language->id . ']title') | ||
16 | + ->textInput([ 'maxlength' => true ]); | ||
17 | + | ||
18 | + echo $form->field($model_lang, '[' . $language->id . ']description') | ||
19 | + ->textarea(); | ||
20 | + | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | + /* @var $this yii\web\View */ | ||
7 | + /* @var $model common\models\PaymentSearch */ | ||
8 | + /* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="payment-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin( | ||
14 | + [ | ||
15 | + 'action' => [ 'index' ], | ||
16 | + 'method' => 'get', | ||
17 | + ] | ||
18 | + ); ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'id') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'sort') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'status') | ||
25 | + ->checkbox() ?> | ||
26 | + | ||
27 | + <div class="form-group"> | ||
28 | + <?= Html::submitButton(Yii::t('order', 'Search'), [ 'class' => 'btn btn-primary' ]) ?> | ||
29 | + <?= Html::resetButton(Yii::t('order', 'Reset'), [ 'class' => 'btn btn-default' ]) ?> | ||
30 | + </div> | ||
31 | + | ||
32 | + <?php ActiveForm::end(); ?> | ||
33 | + | ||
34 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yiister\gentelella\widgets\Panel; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var \yii\web\View $this | ||
8 | + * @var \artbox\order\models\Payment $model | ||
9 | + * @var \artbox\order\models\PaymentLang[] $modelLangs | ||
10 | + */ | ||
11 | + | ||
12 | + $this->title = Yii::t('order', 'Create Payment'); | ||
13 | + $this->params[ 'breadcrumbs' ][] = [ | ||
14 | + 'label' => Yii::t('order', 'Payments'), | ||
15 | + 'url' => [ 'index' ], | ||
16 | + ]; | ||
17 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
18 | +?> | ||
19 | +<div class="payment-create"> | ||
20 | + <?php | ||
21 | + $xPanel = Panel::begin( | ||
22 | + [ | ||
23 | + 'header' => $this->title, | ||
24 | + ] | ||
25 | + ); | ||
26 | + ?> | ||
27 | + <?= $this->render( | ||
28 | + '_form', | ||
29 | + [ | ||
30 | + 'model' => $model, | ||
31 | + 'modelLangs' => $modelLangs, | ||
32 | + ] | ||
33 | + ) ?> | ||
34 | + <?php | ||
35 | + $xPanel::end(); | ||
36 | + ?> | ||
37 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\grid\GridView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /* @var $this yii\web\View */ | ||
8 | + /* @var $searchModel artbox\order\models\PaymentSearch */ | ||
9 | + /* @var $dataProvider yii\data\ActiveDataProvider */ | ||
10 | + | ||
11 | + $this->title = Yii::t('order', 'Payments'); | ||
12 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
13 | +?> | ||
14 | +<div class="payment-index"> | ||
15 | + <?php | ||
16 | + $xPanel = Panel::begin( | ||
17 | + [ | ||
18 | + 'header' => $this->title, | ||
19 | + ] | ||
20 | + ); | ||
21 | + ?> | ||
22 | + <p> | ||
23 | + <?= Html::a(Yii::t('order', 'Create Payment'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?> | ||
24 | + </p> | ||
25 | + <?= GridView::widget( | ||
26 | + [ | ||
27 | + 'dataProvider' => $dataProvider, | ||
28 | + 'filterModel' => $searchModel, | ||
29 | + 'columns' => [ | ||
30 | + [ 'class' => 'yii\grid\SerialColumn' ], | ||
31 | + | ||
32 | + 'id', | ||
33 | + [ | ||
34 | + 'attribute' => 'title', | ||
35 | + 'value' => 'lang.title', | ||
36 | + ], | ||
37 | + 'sort', | ||
38 | + [ | ||
39 | + 'attribute' => 'status', | ||
40 | + 'filter' => [ | ||
41 | + 0 => \Yii::$app->formatter->asBoolean(false), | ||
42 | + 1 => \Yii::$app->formatter->asBoolean(true), | ||
43 | + ], | ||
44 | + ], | ||
45 | + | ||
46 | + [ 'class' => 'yii\grid\ActionColumn' ], | ||
47 | + ], | ||
48 | + ] | ||
49 | + ); ?> | ||
50 | + <?php | ||
51 | + $xPanel::end(); | ||
52 | + ?> | ||
53 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yiister\gentelella\widgets\Panel; | ||
5 | + | ||
6 | + /** | ||
7 | + * @var \yii\web\View $this | ||
8 | + * @var \artbox\order\models\Payment $model | ||
9 | + * @var \artbox\order\models\PaymentLang[] $modelLangs | ||
10 | + */ | ||
11 | + | ||
12 | + $this->title = Yii::t( | ||
13 | + 'order', | ||
14 | + 'Update {modelClass}: ', | ||
15 | + [ | ||
16 | + 'modelClass' => 'Payment', | ||
17 | + ] | ||
18 | + ) . $model->id; | ||
19 | + $this->params[ 'breadcrumbs' ][] = [ | ||
20 | + 'label' => Yii::t('order', 'Payments'), | ||
21 | + 'url' => [ 'index' ], | ||
22 | + ]; | ||
23 | + $this->params[ 'breadcrumbs' ][] = [ | ||
24 | + 'label' => $model->id, | ||
25 | + 'url' => [ | ||
26 | + 'view', | ||
27 | + 'id' => $model->id, | ||
28 | + ], | ||
29 | + ]; | ||
30 | + $this->params[ 'breadcrumbs' ][] = Yii::t('order', 'Update'); | ||
31 | +?> | ||
32 | +<div class="payment-update"> | ||
33 | + <?php | ||
34 | + $xPanel = Panel::begin( | ||
35 | + [ | ||
36 | + 'header' => $this->title, | ||
37 | + ] | ||
38 | + ); | ||
39 | + ?> | ||
40 | + <?= $this->render( | ||
41 | + '_form', | ||
42 | + [ | ||
43 | + 'model' => $model, | ||
44 | + 'modelLangs' => $modelLangs, | ||
45 | + ] | ||
46 | + ) ?> | ||
47 | + <?php | ||
48 | + $xPanel::end(); | ||
49 | + ?> | ||
50 | + | ||
51 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | + use yii\helpers\Html; | ||
4 | + use yii\widgets\DetailView; | ||
5 | + use yiister\gentelella\widgets\Panel; | ||
6 | + | ||
7 | + /* @var $this yii\web\View */ | ||
8 | + /* @var $model artbox\order\models\Payment */ | ||
9 | + | ||
10 | + $this->title = $model->id; | ||
11 | + $this->params[ 'breadcrumbs' ][] = [ | ||
12 | + 'label' => Yii::t('order', 'Payments'), | ||
13 | + 'url' => [ 'index' ], | ||
14 | + ]; | ||
15 | + $this->params[ 'breadcrumbs' ][] = $this->title; | ||
16 | +?> | ||
17 | +<div class="payment-view"> | ||
18 | + <?php | ||
19 | + $xPanel = Panel::begin( | ||
20 | + [ | ||
21 | + 'header' => $this->title, | ||
22 | + ] | ||
23 | + ); | ||
24 | + ?> | ||
25 | + <p> | ||
26 | + <?= Html::a( | ||
27 | + Yii::t('order', 'Update'), | ||
28 | + [ | ||
29 | + 'update', | ||
30 | + 'id' => $model->id, | ||
31 | + ], | ||
32 | + [ 'class' => 'btn btn-primary' ] | ||
33 | + ) ?> | ||
34 | + <?= Html::a( | ||
35 | + Yii::t('order', 'Delete'), | ||
36 | + [ | ||
37 | + 'delete', | ||
38 | + 'id' => $model->id, | ||
39 | + ], | ||
40 | + [ | ||
41 | + 'class' => 'btn btn-danger', | ||
42 | + 'data' => [ | ||
43 | + 'confirm' => Yii::t('order', 'Are you sure you want to delete this item?'), | ||
44 | + 'method' => 'post', | ||
45 | + ], | ||
46 | + ] | ||
47 | + ) ?> | ||
48 | + </p> | ||
49 | + | ||
50 | + <?= DetailView::widget( | ||
51 | + [ | ||
52 | + 'model' => $model, | ||
53 | + 'attributes' => [ | ||
54 | + 'id', | ||
55 | + 'lang.title', | ||
56 | + 'lang.description', | ||
57 | + 'sort', | ||
58 | + 'status:boolean', | ||
59 | + ], | ||
60 | + ] | ||
61 | + ) ?> | ||
62 | + <?php | ||
63 | + $xPanel::end(); | ||
64 | + ?> | ||
65 | +</div> |