From 640d04cb76cc182be158f1ab1d29914e1f169b09 Mon Sep 17 00:00:00 2001 From: rocho Date: Wed, 30 Sep 2015 11:25:32 +0200 Subject: [PATCH] add reception customer update changes --- common/components/CityZipTypeahead.php | 2 +- .../components/ReceptionCardNumberWidget.php | 22 +++ frontend/components/ReceptionMenuWidget.php | 22 +++ frontend/controllers/CityController.php | 172 ++++++++++++++++++ frontend/controllers/CustomerController.php | 30 ++- frontend/controllers/ProductController.php | 121 ++++++++++++ frontend/models/CustomerCreate.php | 117 ++++++++++++ frontend/models/CustomerUpdate.php | 97 ++++++++++ frontend/models/ProductSearch.php | 78 ++++++++ frontend/views/common/_form_card_number.php | 42 +++++ frontend/views/common/_menu_reception.php | 76 ++++++++ frontend/views/customer/_form_update.php | 146 +++++++++++++++ frontend/views/customer/reception.php | 17 +- frontend/views/customer/update.php | 25 ++- frontend/views/product/_form.php | 41 +++++ frontend/views/product/_search.php | 53 ++++++ frontend/views/product/create.php | 21 +++ frontend/views/product/index.php | 47 +++++ frontend/views/product/update.php | 23 +++ frontend/views/product/view.php | 48 +++++ 20 files changed, 1185 insertions(+), 15 deletions(-) create mode 100644 frontend/components/ReceptionCardNumberWidget.php create mode 100644 frontend/components/ReceptionMenuWidget.php create mode 100644 frontend/controllers/CityController.php create mode 100644 frontend/controllers/ProductController.php create mode 100644 frontend/models/CustomerCreate.php create mode 100644 frontend/models/CustomerUpdate.php create mode 100644 frontend/models/ProductSearch.php create mode 100644 frontend/views/common/_form_card_number.php create mode 100644 frontend/views/common/_menu_reception.php create mode 100644 frontend/views/customer/_form_update.php create mode 100644 frontend/views/product/_form.php create mode 100644 frontend/views/product/_search.php create mode 100644 frontend/views/product/create.php create mode 100644 frontend/views/product/index.php create mode 100644 frontend/views/product/update.php create mode 100644 frontend/views/product/view.php diff --git a/common/components/CityZipTypeahead.php b/common/components/CityZipTypeahead.php index 24397d7..54c5ac8 100644 --- a/common/components/CityZipTypeahead.php +++ b/common/components/CityZipTypeahead.php @@ -40,7 +40,7 @@ class CityZipTypeahead extends Typeahead{ 'limit' => 10, 'display' => $this->display, 'templates' => [ - 'notFound' => '
Unable to find repositories for selected query.
', + 'notFound' => '
Nincs találat
', 'suggestion' => new JsExpression("Handlebars.compile('{$this->item_template}')") ] ] diff --git a/frontend/components/ReceptionCardNumberWidget.php b/frontend/components/ReceptionCardNumberWidget.php new file mode 100644 index 0000000..983b6c1 --- /dev/null +++ b/frontend/components/ReceptionCardNumberWidget.php @@ -0,0 +1,22 @@ +render($this->viewFile,['card' => $this->card, 'customer' =>$this->customer , 'route' => $this->route ]); + } + + +} \ No newline at end of file diff --git a/frontend/components/ReceptionMenuWidget.php b/frontend/components/ReceptionMenuWidget.php new file mode 100644 index 0000000..a1cd23d --- /dev/null +++ b/frontend/components/ReceptionMenuWidget.php @@ -0,0 +1,22 @@ +render($this->viewFile,['card' => $this->card, 'customer' =>$this->customer ]); + } + + +} \ No newline at end of file diff --git a/frontend/controllers/CityController.php b/frontend/controllers/CityController.php new file mode 100644 index 0000000..fa258a7 --- /dev/null +++ b/frontend/controllers/CityController.php @@ -0,0 +1,172 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all City models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CitySearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single City model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new City model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + public function actionCreate() + { + $model = new City(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_city]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + */ + + /** + * Updates an existing City model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_city]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + */ + + /** + * Deletes an existing City model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + */ + + /** + * Finds the City model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return City the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = City::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + + + /** + * Your controller action to fetch the list + */ + public function actionNameList($search = null) { + $query = new Query(); + + $query->select ( [ + 'name', + 'min(zip) as zip', + 'concat( zip, \' \', name) as fullname' + ] )->from (City::tableName() )->where ( ' lower(name) LIKE "%' . strtolower ( $search ) . '%"' )->orderBy ( 'name' )->groupBy('name')->limit(20); + $command = $query->createCommand (); + $data = $command->queryAll (); + $out = [ ]; + foreach ( $data as $d ) { + $out [] = [ + 'name' => $d ['name'], + 'zip' => $d ['zip'], + 'fullname' => $d ['fullname'], + ]; + } + echo Json::encode ( $out ); + } + /** + * Your controller action to fetch the list + */ + public function actionZipList($search = null) { + $query = new Query(); + + $query->select ( [ + 'name', + 'min(zip) as zip', + 'concat( zip, \' \', name) as fullname' + ] )->from (City::tableName() )->where ( ' lower(zip) LIKE "' . strtolower ( $search ) . '%"' )->orderBy ( 'name' )->groupBy('name')->limit(20); + $command = $query->createCommand (); + $data = $command->queryAll (); + $out = [ ]; + foreach ( $data as $d ) { + $out [] = [ + 'name' => $d ['name'], + 'zip' => $d ['zip'], + 'fullname' => $d ['fullname'], + ]; + } + echo Json::encode ( $out ); + } +} diff --git a/frontend/controllers/CustomerController.php b/frontend/controllers/CustomerController.php index 232314a..98e4d19 100644 --- a/frontend/controllers/CustomerController.php +++ b/frontend/controllers/CustomerController.php @@ -11,6 +11,7 @@ use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use yii\base\Object; use common\models\Card; +use frontend\models\CustomerUpdate; /** * CustomerController implements the CRUD actions for Customer model. @@ -32,12 +33,12 @@ class CustomerController extends Controller ]; } - public function actionReception(){ + public function actionReception($number = ""){ $model = new ReceptionForm(); - if ($model->load(Yii::$app->request->get()) && $model->validate()) { - $model->readCard(); - } + $model->number = $number; + + $model->readCard(); return $this->render('reception',['model' => $model]); @@ -90,24 +91,37 @@ class CustomerController extends Controller } } - /** +/** * Updates an existing Customer model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ - public function actionUpdate($id) + public function actionUpdate($number = null) { - $model = $this->findModel($id); + $card = null; + $model = null; + if ( $number != null ){ + $card = Card::readCard($number); + if ( $card != null ){ + $model = CustomerUpdate::find()->innerJoin(Card::tableName(), "customer.id_customer_card = card.id_card")->one(); + } + } + + if ( $model == null) { + throw new NotFoundHttpException('The requested page does not exist.'); + } + if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->id_customer]); + return $this->redirect(['update', 'number' => $card->number]); } else { return $this->render('update', [ 'model' => $model, ]); } } + /** * Deletes an existing Customer model. diff --git a/frontend/controllers/ProductController.php b/frontend/controllers/ProductController.php new file mode 100644 index 0000000..8fd758c --- /dev/null +++ b/frontend/controllers/ProductController.php @@ -0,0 +1,121 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all Product models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new ProductSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Product model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Product model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Product(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_product]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Product model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id_product]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Product model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the Product model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Product the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Product::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/models/CustomerCreate.php b/frontend/models/CustomerCreate.php new file mode 100644 index 0000000..41f47eb --- /dev/null +++ b/frontend/models/CustomerCreate.php @@ -0,0 +1,117 @@ + 10], + [['cardNumber'], 'validateCustomerCard' ], + + [['partnerCardNumber'], 'string', 'max' => 10], + [['partnerCardNumber'], 'validatePartnerCard' ], + + [['name'], 'required' ], + [['name'], 'string', 'max' => 128], + + [['email'], 'string', 'max' => 255], + [['email'], 'email' ], + [['email'], 'unique' ], + + [['password_plain','password_repeat'], 'string', 'max' => 32], + + [['sex'], 'integer'], + + [[ 'birthdate', ], 'date' ], + [[ 'date_stundent_card_expire', ], 'date' ], + + [[ 'description', 'address'], 'string', 'max' => 255], + + [['phone', 'tax_number', 'country'], 'string', 'max' => 20], + + [['zip'], 'string', 'max' => 8], + + [['city'], 'string', 'max' => 30] + ]; + } + + + public function validateCustomerCard($a,$p){ + $card = null; + + if ( !empty($this->cardNumber)){ + $card = Card::readCard($this->cardNumber,true); + } + + if ( $card == null ){ + $this->addError($a,Yii::t('common/customer', "Bérlet kártya nem üres vagy hibás kártyaszám")); + }else{ + $this->id_customer_card = $card->id_card; + } + +// $this->addError($a,Yii::t('common/customer', "Bérlet kártya nem üres vagy hibás kártyaszám")); + } + + public function validatePartnerCard($a,$p){ + if ( !empty($this->partnerCardNumber) ){ + $card = Card::readCard($this->partnerCardNumber,true); + if ( $card == null ){ + $this->addError($a,Yii::t('common/customer', "Bérlet kártya nem üres vagy hibás kártyaszám")); + }else{ + $this->id_partner_card = $card->id_card; + } + } + } + +} diff --git a/frontend/models/CustomerUpdate.php b/frontend/models/CustomerUpdate.php new file mode 100644 index 0000000..96e1ffc --- /dev/null +++ b/frontend/models/CustomerUpdate.php @@ -0,0 +1,97 @@ + 10], +// [['cardNumber'], 'validateCustomerCard' ], + + [['partnerCardNumber'], 'string', 'max' => 10], + [['partnerCardNumber'], 'validatePartnerCard' ], + + [['name'], 'required' ], + [['name'], 'string', 'max' => 128], + + [['email'], 'string', 'max' => 255], + [['email'], 'email' ], + [['email'], 'unique' ], + + [['password_plain','password_repeat'], 'string', 'max' => 32], + + [['sex'], 'integer'], + + [[ 'birthdate', ], 'date' ], + [[ 'date_stundent_card_expire', ], 'date' ], + + [[ 'description', 'address'], 'string', 'max' => 255], + + [['phone', 'tax_number', 'country'], 'string', 'max' => 20], + + [['zip'], 'string', 'max' => 8], + + [['city'], 'string', 'max' => 30] + ]; + } + + + public function validateCustomerCard($a,$p){ +// Customer::find()->andWhere( [$this->cardNumber ) + } + public function validatePartnerCard($a,$p){ +// Customer::find()->andWhere( [$this->cardNumber ) + } + + +} diff --git a/frontend/models/ProductSearch.php b/frontend/models/ProductSearch.php new file mode 100644 index 0000000..33468a8 --- /dev/null +++ b/frontend/models/ProductSearch.php @@ -0,0 +1,78 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + $query->andFilterWhere([ + 'id_product' => $this->id_product, + 'id_product_category' => $this->id_product_category, + 'id_account' => $this->id_account, + 'purchase_price' => $this->purchase_price, + 'sale_price' => $this->sale_price, + 'profit_margins' => $this->profit_margins, + 'status' => $this->status, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + 'stock' => $this->stock, + ]); + + $query->andFilterWhere(['like', 'product_number', $this->product_number]) + ->andFilterWhere(['like', 'barcode', $this->barcode]) + ->andFilterWhere(['like', 'description', $this->description]) + ->andFilterWhere(['like', 'name', $this->name]); + + return $dataProvider; + } +} diff --git a/frontend/views/common/_form_card_number.php b/frontend/views/common/_form_card_number.php new file mode 100644 index 0000000..02e05e8 --- /dev/null +++ b/frontend/views/common/_form_card_number.php @@ -0,0 +1,42 @@ + + +number; +} +if ( isset($customer) ){ + $customername = $customer->name; +} + +?> + + false, + 'method' => 'get', + 'action' => $route + ]); ?> +
+
+ +
+
+ +
+
+ 'btn btn-primary']); ?> +
+
+ + + + diff --git a/frontend/views/common/_menu_reception.php b/frontend/views/common/_menu_reception.php new file mode 100644 index 0000000..5c7e3f0 --- /dev/null +++ b/frontend/views/common/_menu_reception.php @@ -0,0 +1,76 @@ + + + + +name; +} + + +function mkCustomerBtn($card, $label,$route = null ){ + + $url = null; + $classes = 'btn btn-primary btn-reception'; + if ( $card == null ){ + $classes .= ' disabled'; + } + if ( isset($route)){ + $url = [$route, 'number' => $card->number]; + } + return Html::a( $label , $url, ['class' => $classes ] ); +} + +?> + +
+
+ +
+
+ 'glyphicon glyphicon-plus' ] ) , null, ['class' => 'btn btn-primary btn-reception'] )?> +
+
+
+
+ +
+
+ 'glyphicon glyphicon-plus' ] ) , null, ['class' => 'btn btn-primary btn-reception'] )?> +
+
+
+
+ 'btn btn-primary btn-reception'] )?> +
+
+
+
+ +
+
+
+
+ 'btn btn-primary btn-reception'] )?> +
+
+ + + diff --git a/frontend/views/customer/_form_update.php b/frontend/views/customer/_form_update.php new file mode 100644 index 0000000..b42be88 --- /dev/null +++ b/frontend/views/customer/_form_update.php @@ -0,0 +1,146 @@ + + +
+ + + + +
+
+ field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?> + +
+ customerCardNumber ?> +
+
+
+ field($model, 'partnerCardNumber')->textInput() ?> +
+
+ + +
+
+ field($model, 'name')->textInput(['maxlength' => true]) ?> +
+
+
+
+ field($model, 'email')->textInput(['maxlength' => true]) ?> +
+
+ + + +
+
+ field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?> +
+
+ field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?> +
+
+ +
+
+ field($model, 'sex')->dropDownList(Customer::sexes()) ?> +
+
+ field($model, 'birthdate',[ ] )->widget(DatePicker::classname(), [ + 'value' => Yii::$app->formatter->asDate($model->birthdate), + 'pluginOptions' => [ + 'autoclose'=>true, + 'format' => 'yyyy.mm.dd' + ] + ]) */?> + 'CustomerUpdate[birthdate]', + 'value' => Yii::$app->formatter->asDate($model->birthdate), + 'pluginOptions' => [ + 'autoclose'=>true, + 'format' => 'yyyy.mm.dd' + ] + ] + ) + ?> +
+
+ +
+
+ field($model, 'phone')->textInput(['maxlength' => true]) ?> +
+
+ field($model, 'date_stundent_card_expire')->widget(DatePicker::classname(), [ + 'pluginOptions' => [ + 'autoclose'=>true, + 'format' => 'yyyy.mm.dd' + ] + ]) ?> +
+
+ +
+
+ field($model, 'description')->textarea(['maxlength' => true]) ?> +
+
+ +
+
+ field($model, 'tax_number')->textInput(['maxlength' => true]) ?> +
+
+
+
+ field($model, 'country')->textInput(['maxlength' => true]) ?> +
+
+
+
+ field($model, 'zip')->widget(CityZipTypeahead::className(),[ + 'pluginEvents' =>[ + "typeahead:select" => "function(a,b) { + $('#customercreate-city').typeahead( 'val', b.name ); + }",] + ])?> +
+
+ field($model, 'city')->widget(CityNameTypeahead::className(),[ + 'pluginEvents' =>[ + "typeahead:select" => "function(a,b) { + $('#customercreate-zip').typeahead( 'val', b.zip ); + }",] + + ])?> +
+
+ + + + + field($model, 'address')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? Yii::t('common/customer', 'Create') : Yii::t('common/customer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/customer/reception.php b/frontend/views/customer/reception.php index 972305a..fefac02 100644 --- a/frontend/views/customer/reception.php +++ b/frontend/views/customer/reception.php @@ -1,5 +1,8 @@ - @@ -8,4 +11,14 @@ -render('_form_reception', [ 'model' => $model ]); ?> \ No newline at end of file +render('_form_reception', [ 'model' => $model ]); ?> +
+
+ $model->customer, 'card' =>$model->card ] ) ?> +
+
+ $model->customer, 'card' =>$model->card, 'route' => ['customer/reception'] ] )?> +
+
+
+
\ No newline at end of file diff --git a/frontend/views/customer/update.php b/frontend/views/customer/update.php index 6e88c4c..05727b3 100644 --- a/frontend/views/customer/update.php +++ b/frontend/views/customer/update.php @@ -1,22 +1,39 @@ title = Yii::t('frontend/customer', 'Update {modelClass}: ', [ +$this->title = Yii::t('common/customer', 'Update {modelClass}: ', [ 'modelClass' => 'Customer', ]) . ' ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/customer', 'Customers'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_customer]]; -$this->params['breadcrumbs'][] = Yii::t('frontend/customer', 'Update'); +$this->params['breadcrumbs'][] = Yii::t('common/customer', 'Update'); + +$customer = $model; +$card = $customer->card; + ?>

title) ?>

- render('_form', [ +
+
+ $customer, 'card' => $card] ) ?> +
+
+ $customer, 'card' =>$card, 'route' => ['customer/reception'] ] )?> +
+
+
+
+ + render('_form_update', [ 'model' => $model, ]) ?> diff --git a/frontend/views/product/_form.php b/frontend/views/product/_form.php new file mode 100644 index 0000000..c31f0d4 --- /dev/null +++ b/frontend/views/product/_form.php @@ -0,0 +1,41 @@ + + +
+ + + + field($model, 'id_product_category')->textInput() ?> + + field($model, 'id_account')->textInput() ?> + + field($model, 'product_number')->textInput(['maxlength' => true]) ?> + + field($model, 'barcode')->textInput(['maxlength' => true]) ?> + + field($model, 'purchase_price')->textInput() ?> + + field($model, 'sale_price')->textInput() ?> + + field($model, 'profit_margins')->textInput() ?> + + field($model, 'status')->textInput() ?> + + field($model, 'description')->textInput(['maxlength' => true]) ?> + + field($model, 'name')->textInput(['maxlength' => true]) ?> + +
+ isNewRecord ? Yii::t('frontend/product', 'Create') : Yii::t('frontend/product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/product/_search.php b/frontend/views/product/_search.php new file mode 100644 index 0000000..ccf43ab --- /dev/null +++ b/frontend/views/product/_search.php @@ -0,0 +1,53 @@ + + + diff --git a/frontend/views/product/create.php b/frontend/views/product/create.php new file mode 100644 index 0000000..d24804f --- /dev/null +++ b/frontend/views/product/create.php @@ -0,0 +1,21 @@ +title = Yii::t('frontend/product', 'Create Product'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/product', 'Products'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/product/index.php b/frontend/views/product/index.php new file mode 100644 index 0000000..7b36ca2 --- /dev/null +++ b/frontend/views/product/index.php @@ -0,0 +1,47 @@ +title = Yii::t('frontend/product', 'Products'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id_product', + 'id_product_category', + 'id_account', + 'product_number', + 'barcode', + // 'purchase_price', + // 'sale_price', + // 'profit_margins', + // 'status', + // 'description', + // 'created_at', + // 'updated_at', + // 'stock', + // 'name', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/frontend/views/product/update.php b/frontend/views/product/update.php new file mode 100644 index 0000000..e8180f7 --- /dev/null +++ b/frontend/views/product/update.php @@ -0,0 +1,23 @@ +title = Yii::t('frontend/product', 'Update {modelClass}: ', [ + 'modelClass' => 'Product', +]) . ' ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/product', 'Products'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id_product]]; +$this->params['breadcrumbs'][] = Yii::t('frontend/product', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/product/view.php b/frontend/views/product/view.php new file mode 100644 index 0000000..67e6889 --- /dev/null +++ b/frontend/views/product/view.php @@ -0,0 +1,48 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/product', 'Products'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->id_product], ['class' => 'btn btn-primary']) ?> + $model->id_product], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('frontend/product', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id_product', + 'id_product_category', + 'id_account', + 'product_number', + 'barcode', + 'purchase_price', + 'sale_price', + 'profit_margins', + 'status', + 'description', + 'created_at', + 'updated_at', + 'stock', + 'name', + ], + ]) ?> + +