add reception changes

This commit is contained in:
rocho 2015-09-29 17:27:31 +02:00
parent 8e235a8d3c
commit 2b57f95b1e
4 changed files with 71 additions and 29 deletions

30
composer.lock generated
View File

@ -318,16 +318,16 @@
},
{
"name": "kartik-v/bootstrap-fileinput",
"version": "v4.2.6",
"version": "v4.2.7",
"source": {
"type": "git",
"url": "https://github.com/kartik-v/bootstrap-fileinput.git",
"reference": "e4906dd5ee852a5333d3ce4d19f69ee855efe844"
"reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/e4906dd5ee852a5333d3ce4d19f69ee855efe844",
"reference": "e4906dd5ee852a5333d3ce4d19f69ee855efe844",
"url": "https://api.github.com/repos/kartik-v/bootstrap-fileinput/zipball/0468bbba9c28c1250aca83eba9b33e32ec135f78",
"reference": "0468bbba9c28c1250aca83eba9b33e32ec135f78",
"shasum": ""
},
"type": "library",
@ -362,20 +362,20 @@
"progress",
"upload"
],
"time": "2015-08-26 18:42:44"
"time": "2015-09-13 17:39:44"
},
{
"name": "kartik-v/bootstrap-star-rating",
"version": "v3.5.3",
"version": "v3.5.4",
"source": {
"type": "git",
"url": "https://github.com/kartik-v/bootstrap-star-rating.git",
"reference": "bd9c52db6ac71cb270620c1aee601d142ab2cc00"
"reference": "987777ee21a599bebbc545c743063fcee9833842"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kartik-v/bootstrap-star-rating/zipball/bd9c52db6ac71cb270620c1aee601d142ab2cc00",
"reference": "bd9c52db6ac71cb270620c1aee601d142ab2cc00",
"url": "https://api.github.com/repos/kartik-v/bootstrap-star-rating/zipball/987777ee21a599bebbc545c743063fcee9833842",
"reference": "987777ee21a599bebbc545c743063fcee9833842",
"shasum": ""
},
"type": "library",
@ -403,7 +403,7 @@
"jquery",
"star"
],
"time": "2015-06-18 14:42:46"
"time": "2015-09-21 09:06:33"
},
{
"name": "kartik-v/dependent-dropdown",
@ -1036,16 +1036,16 @@
},
{
"name": "kartik-v/yii2-widget-select2",
"version": "v2.0.2",
"version": "v2.0.3",
"source": {
"type": "git",
"url": "https://github.com/kartik-v/yii2-widget-select2.git",
"reference": "585e8797d7982e0c9d09370b98b451a028a59439"
"reference": "e72880e7e8dfc845c112ed7df275bf1c929be6db"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/585e8797d7982e0c9d09370b98b451a028a59439",
"reference": "585e8797d7982e0c9d09370b98b451a028a59439",
"url": "https://api.github.com/repos/kartik-v/yii2-widget-select2/zipball/e72880e7e8dfc845c112ed7df275bf1c929be6db",
"reference": "e72880e7e8dfc845c112ed7df275bf1c929be6db",
"shasum": ""
},
"require": {
@ -1080,7 +1080,7 @@
"widget",
"yii2"
],
"time": "2015-07-01 15:20:59"
"time": "2015-09-12 19:56:48"
},
{
"name": "kartik-v/yii2-widget-sidenav",

View File

@ -10,6 +10,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\base\Object;
use common\models\Card;
/**
* CustomerController implements the CRUD actions for Customer model.
@ -32,12 +33,10 @@ class CustomerController extends Controller
}
public function actionReception(){
$model = new ReceptionForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
// return $this->redirect(['view', 'id' => $model->id_customer]);
if ($model->load(Yii::$app->request->get()) && $model->validate()) {
$model->readCard();
}

View File

@ -4,6 +4,8 @@ namespace frontend\models;
use Yii;
use yii\base\Model;
use common\models\Card;
use common\models\Customer;
/**
* ContactForm is the model behind the contact form.
@ -11,8 +13,10 @@ use yii\base\Model;
class ReceptionForm extends Model
{
public $number;
public $card;
public $customer;
/**
* @inheritdoc
*/
@ -23,6 +27,7 @@ class ReceptionForm extends Model
];
}
/**
* @inheritdoc
*/
@ -32,5 +37,12 @@ class ReceptionForm extends Model
'verifyCode' => 'Verification Code',
];
}
public function readCard(){
$this->card = Card::findOne(['number' => $this->number]);
if ( $this->card != null ){
$this->customer = $this->card->customer;
}
}
}

View File

@ -17,46 +17,77 @@ use yii\widgets\ActiveForm;
</style>
<?php
$card = $model->card;
$customer = $model->customer;
$customername = "";
if ( $customer != null ){
$customername = $customer->name;
}
function mkCustomerBtn($card, $label,$url = null ){
$classes = 'btn btn-primary btn-reception';
if ( $card == null ){
$classes .= ' disabled';
}
return Html::a( $label , null, ['class' => $classes ] );
}
?>
<div class="reception-form">
<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin([
'enableAjaxValidation' => false,
'method' => 'get'
]); ?>
<div class="row">
<div class='col-md-3'>
<div class='row'>
<div class='col-md-8'>
<?php echo Html::a(Yii::t( 'frontend/customer', 'Adatlap') , null, ['class' => 'btn btn-primary btn-reception'] )?>
<?php echo mkCustomerBtn( $card, Yii::t( 'frontend/customer' , 'Adatlap') ); ?>
</div>
<div class='col-md-4'>
<?php echo Html::a(Html::tag("i","", [ 'class' => 'glyphicon glyphicon-plus' ] ) , null, ['class' => 'btn btn-primary btn-reception'] )?>
<?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 Html::a(Yii::t( 'frontend/customer', 'Befizetések') ,null,['class' => 'btn btn-primary btn-reception'] )?>
<?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'] )?>
<?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'] )?>
<?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 Html::a(Yii::t( 'frontend/customer', 'Egyenleg') , null,['class' => 'btn btn-primary btn-reception'] )?>
<?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'] )?>
<?php echo Html::a(Yii::t( 'frontend/customer', 'Termékeladás') , null,['class' => 'btn btn-primary btn-reception'] )?>
</div>
</div>
</div>
<div class='col-md-2'>
<?php echo $form->field($model, 'number')->textInput()?>
<div class="row" >
<div class='col-md-12'>
<?php echo $form->field($model, 'number')->textInput()?>
</div>
<div class='col-md-12'>
<?php echo $customername; ?>
</div>
</div>
</div>
</div>