add feature clear card

This commit is contained in:
2016-04-03 10:44:12 +02:00
parent ee4ae54e6f
commit 5ff974c717
12 changed files with 108 additions and 56 deletions

View File

@@ -23,7 +23,7 @@ use common\models\Card;
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/card', 'Create') : Yii::t('common/card', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<?= Html::submitButton( Yii::t('common/card', 'Create/Next') ,['class' => 'btn btn-primary','name'=>'create_next']) ?>
<?php //echo Html::submitButton( Yii::t('common/card', 'Create/Next') ,['class' => 'btn btn-primary','name'=>'create_next']) ?>
</div>
<?php ActiveForm::end(); ?>

View File

@@ -1,23 +1,56 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use yii\base\Widget;
use common\components\Helper;
use common\components\RoleDefinition;
/* @var $this yii\web\View */
/* @var $model common\models\Card */
$this->title = Yii::t('common/card', 'Update {modelClass}: ', [
'modelClass' => 'Card',
]) . ' ' . $model->id_card;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/card', 'Cards'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->number, 'url' => ['view', 'id' => $model->id_card]];
$this->params['breadcrumbs'][] = Yii::t('common/card', 'Update');
$this->title = Yii::t ( 'common/card', 'Bérletkártya módosítása' );
$this->params ['breadcrumbs'] [] = [
'label' => Yii::t ( 'common/card', 'Cards' ),
'url' => [
'index'
]
];
$this->params ['breadcrumbs'] [] = [
'label' => $model->number,
'url' => [
'view',
'id' => $model->id_card
]
];
$this->params ['breadcrumbs'] [] = Yii::t ( 'common/card', 'Update' );
?>
<div class="card-update">
<h1><?= Html::encode($this->title) ?></h1>
<h1><?= Html::encode($this->title) ?></h1>
<?php
$customer = $model->customer;
if (isset ( $customer )) {
echo DetailView::widget ( [
'model' => $model,
'attributes' => [
[
'label' => 'Vendég',
'value' => $model->customer->name
]
]
] );
if ( RoleDefinition::isAdmin() ){
echo Html::a ( "Vendég törlése a kártyáról!", ['card/clear','id' =>$model->id_card], [
'class' => 'btn btn-danger' ,
'data-confirm' => "Figyelem, a kártyához tartozó összes bérlet el fog veszni!",
'data-method' => 'post',
] );
}
}
?>
<?= $this->render('_form', [
'model' => $model,
]) ?>
<?=$this->render ( '_form', [ 'model' => $model ] )?>
</div>

View File

@@ -48,6 +48,6 @@ $items = [
<?php if ( !empty($title)) {?>
<h1><?php echo $title?></h1>
<p>Vendég: <?php echo $card->customer->name ?></p>
<p>Kártyaszám: <?php echo $card->number ?></p>
<p>Vendég: <?php echo $customer->name ?></p>
<p>Kártyaszám: <?php echo isset($card) ? $card->number : "Törölt kártya!" ?></p>
<?php }?>

View File

@@ -6,6 +6,7 @@ use yii\helpers\ArrayHelper;
use yii\data\ArrayDataProvider;
use backend\components\AdminCustomerTabWidget;
use common\models\Ticket;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TicketSearch */
@@ -29,7 +30,7 @@ $this->params['breadcrumbs'][] = "Befizetések";
<?php echo $this->render('_search_customer', ['model' => $searchModel]); ?>
<?php /*?>
<div class="panel panel-default">
<div class="panel-heading">Bérlet statisztika</div>
<div class="panel-body">
@@ -80,7 +81,7 @@ $this->params['breadcrumbs'][] = "Befizetések";
</div>
<?php */?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
@@ -133,7 +134,13 @@ $this->params['breadcrumbs'][] = "Befizetések";
// 'usage_count',
['class' => 'yii\grid\ActionColumn',
'template' => '{view}'
'template' => '{view}' ,
'urlCreator' => function($action, $model, $key, $index){
if ( $action == 'view' ){
return Url::toRoute( [ 'ticket/view' , 'id' => $model['ticket_id_ticket' ] ] );
}
return null;
},
],
],
]); ?>