add reception customer update changes

This commit is contained in:
rocho 2015-09-30 11:25:32 +02:00
parent 2b57f95b1e
commit 640d04cb76
20 changed files with 1185 additions and 15 deletions

View File

@ -40,7 +40,7 @@ class CityZipTypeahead extends Typeahead{
'limit' => 10,
'display' => $this->display,
'templates' => [
'notFound' => '<div class="text-danger" style="padding:0 8px">Unable to find repositories for selected query.</div>',
'notFound' => '<div class="text-danger" style="padding:0 8px">Nincs találat</div>',
'suggestion' => new JsExpression("Handlebars.compile('{$this->item_template}')")
]
]

View File

@ -0,0 +1,22 @@
<?php
namespace frontend\components;
use yii\base\Widget;
class ReceptionCardNumberWidget extends Widget{
public $number;
public $route;
public $customer;
public $card;
public $viewFile = '//common/_form_card_number';
public function run(){
echo $this->render($this->viewFile,['card' => $this->card, 'customer' =>$this->customer , 'route' => $this->route ]);
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace frontend\components;
use yii\base\Widget;
class ReceptionMenuWidget extends Widget{
public $number;
public $route;
public $customer;
public $card;
public $viewFile = '//common/_menu_reception';
public function run(){
echo $this->render($this->viewFile,['card' => $this->card, 'customer' =>$this->customer ]);
}
}

View File

@ -0,0 +1,172 @@
<?php
namespace frontend\controllers;
use Yii;
use common\models\City;
use backend\models\CitySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use yii\db\Query;
use yii\helpers\Json;
/**
* CityController implements the CRUD actions for City model.
*/
class CityController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'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 );
}
}

View File

@ -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->number = $number;
$model->readCard();
}
return $this->render('reception',['model' => $model]);
@ -90,18 +91,30 @@ 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,
@ -109,6 +122,7 @@ class CustomerController extends Controller
}
}
/**
* Deletes an existing Customer model.
* If deletion is successful, the browser will be redirected to the 'index' page.

View File

@ -0,0 +1,121 @@
<?php
namespace frontend\controllers;
use Yii;
use common\models\Product;
use frontend\models\ProductSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* ProductController implements the CRUD actions for Product model.
*/
class ProductController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'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.');
}
}
}

View File

@ -0,0 +1,117 @@
<?php
namespace frontend\models;
use Yii;
use common\models\Customer;
use common\models\Card;
/**
* This is the model class for table "customer".
*
* @property integer $id_customer
* @property integer $id_customer_card
* @property integer $id_user
* @property integer $id_partner_card
* @property integer $id_proposer
* @property string $name
* @property string $email
* @property string $password
* @property string $phone
* @property integer $sex
* @property string $date_stundent_card_expire
* @property string $birthdate
* @property string $image
* @property string $description
* @property string $tax_number
* @property string $country
* @property string $zip
* @property string $city
* @property string $address
* @property string $created_at
* @property string $updated_at
* @property string $cardNumber
*/
class CustomerCreate extends \common\models\Customer
{
public $cardNumber;
public $partnerCardNumber;
public $password_plain;
public $password_repeat;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'customer';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['cardNumber'], 'required' ],
[['cardNumber'], 'string', 'max' => 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;
}
}
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace frontend\models;
use Yii;
use common\models\Customer;
/**
* This is the model class for table "customer".
*
* @property integer $id_customer
* @property integer $id_customer_card
* @property integer $id_user
* @property integer $id_partner_card
* @property integer $id_proposer
* @property string $name
* @property string $email
* @property string $password
* @property string $phone
* @property integer $sex
* @property string $date_stundent_card_expire
* @property string $birthdate
* @property string $image
* @property string $description
* @property string $tax_number
* @property string $country
* @property string $zip
* @property string $city
* @property string $address
* @property string $created_at
* @property string $updated_at
* @property string $cardNumber
*/
class CustomerUpdate extends \common\models\Customer
{
public $cardNumber;
public $partnerCardNumber;
public $password_plain;
public $password_repeat;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'customer';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
// [['cardNumber'], 'required' ],
// [['cardNumber'], 'string', 'max' => 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 )
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace frontend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Product;
/**
* ProductSearch represents the model behind the search form about `common\models\Product`.
*/
class ProductSearch extends Product
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_product', 'id_product_category', 'id_account', 'purchase_price', 'sale_price', 'profit_margins', 'status', 'stock'], 'integer'],
[['product_number', 'barcode', 'description', 'created_at', 'updated_at', 'name'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Product::find();
$dataProvider = new ActiveDataProvider([
'query' => $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;
}
}

View File

@ -0,0 +1,42 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Customer */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$customername = "";
$number = "";
if ( isset($card)){
$number = $card->number;
}
if ( isset($customer) ){
$customername = $customer->name;
}
?>
<?php $form = ActiveForm::begin([
'enableAjaxValidation' => false,
'method' => 'get',
'action' => $route
]); ?>
<div class="row" >
<div class='col-md-12'>
<?php echo Html::textInput("number", $number )?>
</div>
<div class='col-md-12'>
<?php echo $customername; ?>
</div>
<div class='col-md-12'>
<?php echo Html::submitButton("search",[ 'class' => 'btn btn-primary']); ?>
</div>
</div>
<?php ActiveForm::end(); ?>

View File

@ -0,0 +1,76 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $card common\models\Card */
/* @var $customer common\models\Customer */
/* @var $form yii\widgets\ActiveForm */
?>
<style >
.btn.btn-reception{
width:100%;
margin-top: 6px;
margin-bottom: 6px;
}
</style>
<?php
$customername = "";
if ( isset($customer ) ){
$customername = $customer->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 ] );
}
?>
<div class='row'>
<div class='col-md-8'>
<?php echo mkCustomerBtn( $card, Yii::t( 'frontend/customer' , 'Adatlap') , 'customer/update' ); ?>
</div>
<div class='col-md-4'>
<?php echo Html::a(Html::tag("i","", [ 'class' => 'glyphicon glyphicon-plus' ] ) , null, ['class' => 'btn btn-primary btn-reception'] )?>
</div>
</div>
<div class='row'>
<div class='col-md-8'>
<?php echo mkCustomerBtn( $card, Yii::t( 'frontend/customer' , 'Befizetések') ); ?>
</div>
<div class='col-md-4'>
<?php echo Html::a(Html::tag("i","", [ 'class' => 'glyphicon glyphicon-plus' ] ) , null, ['class' => 'btn btn-primary btn-reception'] )?>
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<?php echo Html::a(Yii::t( 'frontend/customer', 'Jelentkezések') , null,['class' => 'btn btn-primary btn-reception'] )?>
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<?php echo mkCustomerBtn( $card, Yii::t( 'frontend/customer' , 'Egyenleg') ); ?>
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<?php echo Html::a(Yii::t( 'frontend/customer', 'Termékeladás') , null,['class' => 'btn btn-primary btn-reception'] )?>
</div>
</div>

View File

@ -0,0 +1,146 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Customer;
use common\components\CityNameTypeahead;
use common\components\CityZipTypeahead;
use common\components\CardNumberTypeahead;
use kartik\widgets\DatePicker;
use yii\base\Widget;
/* @var $this yii\web\View */
/* @var $model common\models\Customer */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="customer-form">
<?php $form = ActiveForm::begin(); ?>
<div class='row'>
<div class='col-md-3'>
<?php //echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
<label><?php echo $model->getAttributeLabel('id_customer_card')?></label>
<div>
<?php echo $model->customerCardNumber ?>
</div>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'partnerCardNumber')->textInput() ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-3'>
<?= $form->field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-3'>
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
</div>
<div class='col-md-3'>
<?php /* echo $form->field($model, 'birthdate',[ ] )->widget(DatePicker::classname(), [
'value' => Yii::$app->formatter->asDate($model->birthdate),
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) */?>
<?php
echo DatePicker::widget(
[
'name' => 'CustomerUpdate[birthdate]',
'value' => Yii::$app->formatter->asDate($model->birthdate),
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]
)
?>
</div>
</div>
<div class='row'>
<div class='col-md-3'>
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'date_stundent_card_expire')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-6'>
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
</div>
</div>
<div class='row'>
<div class='col-md-2'>
<?= $form->field($model, 'zip')->widget(CityZipTypeahead::className(),[
'pluginEvents' =>[
"typeahead:select" => "function(a,b) {
$('#customercreate-city').typeahead( 'val', b.name );
}",]
])?>
</div>
<div class='col-md-4'>
<?php echo $form->field($model, 'city')->widget(CityNameTypeahead::className(),[
'pluginEvents' =>[
"typeahead:select" => "function(a,b) {
$('#customercreate-zip').typeahead( 'val', b.zip );
}",]
])?>
</div>
</div>
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/customer', 'Create') : Yii::t('common/customer', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -1,5 +1,8 @@
<?php
use frontend\components\ReceptionMenuWidget;
use frontend\components\ReceptionCardNumberWidget;
use yii\base\Widget;
?>
@ -8,4 +11,14 @@
<?php
?>
<?php echo $this->render('_form_reception', [ 'model' => $model ]); ?>
<?php // echo $this->render('_form_reception', [ 'model' => $model ]); ?>
<div class='row'>
<div class='col-md-3'>
<?php echo ReceptionMenuWidget::widget( [ 'customer' => $model->customer, 'card' =>$model->card ] ) ?>
</div>
<div class='col-md-4'>
<?php echo ReceptionCardNumberWidget::widget([ 'customer' => $model->customer, 'card' =>$model->card, 'route' => ['customer/reception'] ] )?>
</div>
<div class='col-md-4'>
</div>
</div>

View File

@ -1,22 +1,39 @@
<?php
use yii\helpers\Html;
use frontend\components\ReceptionMenuWidget;
use frontend\components\ReceptionCardNumberWidget;
/* @var $this yii\web\View */
/* @var $model common\models\Customer */
$this->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;
?>
<div class="customer-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
<div class='row'>
<div class='col-md-3'>
<?php echo ReceptionMenuWidget::widget( [ 'customer' => $customer, 'card' => $card] ) ?>
</div>
<div class='col-md-4'>
<?php echo ReceptionCardNumberWidget::widget( [ 'customer' => $customer, 'card' =>$card, 'route' => ['customer/reception'] ] )?>
</div>
<div class='col-md-4'>
</div>
</div>
<?= $this->render('_form_update', [
'model' => $model,
]) ?>

View File

@ -0,0 +1,41 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="product-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_product_category')->textInput() ?>
<?= $form->field($model, 'id_account')->textInput() ?>
<?= $form->field($model, 'product_number')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'barcode')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'purchase_price')->textInput() ?>
<?= $form->field($model, 'sale_price')->textInput() ?>
<?= $form->field($model, 'profit_margins')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('frontend/product', 'Create') : Yii::t('frontend/product', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,53 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model frontend\models\ProductSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="product-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_product') ?>
<?= $form->field($model, 'id_product_category') ?>
<?= $form->field($model, 'id_account') ?>
<?= $form->field($model, 'product_number') ?>
<?= $form->field($model, 'barcode') ?>
<?php // echo $form->field($model, 'purchase_price') ?>
<?php // echo $form->field($model, 'sale_price') ?>
<?php // echo $form->field($model, 'profit_margins') ?>
<?php // echo $form->field($model, 'status') ?>
<?php // echo $form->field($model, 'description') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<?php // echo $form->field($model, 'stock') ?>
<?php // echo $form->field($model, 'name') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('frontend/product', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('frontend/product', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
$this->title = Yii::t('frontend/product', 'Create Product');
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/product', 'Products'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\ProductSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('frontend/product', 'Products');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('frontend/product', 'Create Product'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $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'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
$this->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');
?>
<div class="product-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,48 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Product */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/product', 'Products'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="product-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('frontend/product', 'Update'), ['update', 'id' => $model->id_product], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('frontend/product', 'Delete'), ['delete', 'id' => $model->id_product], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('frontend/product', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $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',
],
]) ?>
</div>