add reception changes

This commit is contained in:
2015-09-30 15:24:16 +02:00
parent 640d04cb76
commit 7128cd438d
11 changed files with 311 additions and 161 deletions

View File

@@ -0,0 +1,128 @@
<?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;
/* @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(),[]) ?>
</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'>
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
'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,97 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Customer */
/* @var $form yii\widgets\ActiveForm */
?>
<style >
.reception-form .btn.btn-reception{
width:100%;
margin-top: 6px;
margin-bottom: 6px;
}
</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([
'enableAjaxValidation' => false,
'method' => 'get'
]); ?>
<div class="row">
<div class='col-md-3'>
<div class='row'>
<div class='col-md-8'>
<?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'] )?>
</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>
</div>
<div class='col-md-2'>
<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>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -44,31 +44,19 @@ use yii\base\Widget;
</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),
<?php echo $form->field($model, 'birthdate',[ ] )->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) */?>
]) ?>
<?php
echo DatePicker::widget(
/*echo DatePicker::widget(
[
'name' => 'CustomerUpdate[birthdate]',
'value' => Yii::$app->formatter->asDate($model->birthdate),
@@ -77,7 +65,8 @@ use yii\base\Widget;
'format' => 'yyyy.mm.dd'
]
]
)
);
*/
?>
</div>
</div>

View File

@@ -1,20 +1,38 @@
<?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', 'Create Customer');
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/customer', 'Customers'), 'url' => ['index']];
$this->title = Yii::t('common/customer', 'Create Customer');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$customer = $model;
$card = $customer->card;
?>
<div class="customer-create">
<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>
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
<?= $this->render('_form_create', [
'model' => $model,
]) ?>

View File

@@ -7,9 +7,7 @@ use frontend\components\ReceptionCardNumberWidget;
/* @var $this yii\web\View */
/* @var $model common\models\Customer */
$this->title = Yii::t('common/customer', 'Update {modelClass}: ', [
'modelClass' => 'Customer',
]) . ' ' . $model->name;
$this->title = Yii::t('common/customer', 'Update customer:' ) . ' ' . $model->name;
$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('common/customer', 'Update');
@@ -20,7 +18,6 @@ $card = $customer->card;
?>
<div class="customer-update">
<h1><?= Html::encode($this->title) ?></h1>
<div class='row'>
<div class='col-md-3'>
@@ -33,6 +30,7 @@ $card = $customer->card;
</div>
</div>
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form_update', [
'model' => $model,
]) ?>