add customer ticket statistics
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\CustomerSearch */
|
||||
@@ -24,30 +25,31 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'customerCardNumber' ,
|
||||
// 'value' => 'customerCardNumber'
|
||||
],
|
||||
// 'id_user',
|
||||
// 'id_partner_card',
|
||||
// 'id_proposer',
|
||||
'name',
|
||||
'email:email',
|
||||
// 'password',
|
||||
'phone',
|
||||
// 'sex',
|
||||
// 'date_stundent_card_expire',
|
||||
// 'birthdate',
|
||||
// 'image',
|
||||
// 'description',
|
||||
// 'tax_number',
|
||||
// 'country',
|
||||
// 'zip',
|
||||
// 'city',
|
||||
// 'address',
|
||||
'created_at:datetime',
|
||||
// 'updated_at',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' =>'{view}{update}'
|
||||
'template' =>'{view} {update} {ticket/index-customer}',
|
||||
'buttons' => [
|
||||
'ticket/index-customer' => function ($url) { return Html::a( '<span class="glyphicon glyphicon-list-alt"> </span>', $url, [ 'title' => 'Bérletek' ] ); }
|
||||
],
|
||||
'urlCreator' =>function ($action, $model, $key, $index){
|
||||
$params = is_array($key) ? $key : ['id' => (string) $key];
|
||||
if ( $action == 'ticket/index-customer' ){
|
||||
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
|
||||
$tomorrow = \Yii::$app->formatter->asDate( strtotime( 'tomorrow UTC' ));
|
||||
|
||||
$params['TicketSearch[start]'] = $today;
|
||||
$params['TicketSearch[end]'] = $tomorrow;
|
||||
|
||||
}
|
||||
$params[0] = $action;
|
||||
|
||||
return Url::toRoute($params);
|
||||
}
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
76
backend/views/ticket/_search_customer.php
Normal file
76
backend/views/ticket/_search_customer.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use kartik\widgets\DatePicker;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\models\TicketSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<?php
|
||||
$ticketTypeOptions = ['' => 'Mind'] + ArrayHelper::map($model->ticketTypes, 'id_ticket_type', 'name');
|
||||
$accountOptions = ['' => 'Mind'] + ArrayHelper::map($model->accounts, 'id_account', 'name');
|
||||
$userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'username');
|
||||
|
||||
?>
|
||||
|
||||
<div class="ticket-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'id_user')->dropDownList($userOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'id_ticket_type')->dropDownList($ticketTypeOptions) ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
|
||||
'pluginOptions' => [
|
||||
'autoclose'=>true,
|
||||
'format' => 'yyyy.mm.dd'
|
||||
]
|
||||
]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-4'>
|
||||
<?php echo $form->field($model, 'valid_in_interval')->checkbox( ) ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo $form->field($model, 'created_in_interval')->checkbox( ) ?>
|
||||
</div>
|
||||
<div class='col-md-4'>
|
||||
<?php echo $form->field($model, 'expire_in_interval')->checkbox( ) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('common/ticket', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
116
backend/views/ticket/index_customer.php
Normal file
116
backend/views/ticket/index_customer.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\ArrayHelper;
|
||||
use yii\data\ArrayDataProvider;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\models\TicketSearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$customer = $customer->name;
|
||||
if ( isset($card)){
|
||||
$customer .= " (" .$card->number . ")";
|
||||
}
|
||||
|
||||
$this->title = Yii::t('common/ticket', '{customer} Tickets', ['customer'=>$customer]);
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class="ticket-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php echo $this->render('_search_customer', ['model' => $searchModel]); ?>
|
||||
|
||||
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Bérlet statisztika</div>
|
||||
<div class="panel-body">
|
||||
<p>Bérlet statisztika a kiválasztott időszakra</p>
|
||||
<?php
|
||||
|
||||
echo GridView::widget([
|
||||
'dataProvider' => new ArrayDataProvider([
|
||||
'allModels' => $searchModel->statistics,
|
||||
'sort' => false,
|
||||
'pagination' => false,
|
||||
]),
|
||||
'showFooter'=>TRUE,
|
||||
'footerRowOptions'=>['style'=>'font-weight:bold; '],
|
||||
'columns' =>[
|
||||
[
|
||||
'attribute' => 'name',
|
||||
'label' => 'Bérlet',
|
||||
'footer' => 'Összesen'
|
||||
],
|
||||
[
|
||||
'attribute' => 'created',
|
||||
'label' => 'Kiadva (Db)',
|
||||
'footer' => $searchModel->statisticsTotal['created']
|
||||
],
|
||||
[
|
||||
'attribute' => 'created_money',
|
||||
'label' => 'Kiadott érték (Ft)',
|
||||
'footer' => $searchModel->statisticsTotal['created_money']
|
||||
],
|
||||
[
|
||||
'attribute' => 'valid',
|
||||
'label' => 'Érvényes (Db)',
|
||||
'footer' => $searchModel->statisticsTotal['valid']
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'expired',
|
||||
'label' => 'Lejár az adott időszakban (Db)',
|
||||
'footer' => $searchModel->statisticsTotal['expired']
|
||||
]
|
||||
|
||||
]
|
||||
]);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'id_customer',
|
||||
'value' => 'customerName'
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_card',
|
||||
'value' => 'cardNumber'
|
||||
],
|
||||
'start:date',
|
||||
'end:date',
|
||||
[
|
||||
'attribute' => 'id_user',
|
||||
'value' => 'userName'
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_ticket_type',
|
||||
'value' => 'ticketTypeName'
|
||||
],
|
||||
[
|
||||
'attribute' => 'id_account',
|
||||
'value' => 'accountName'
|
||||
],
|
||||
// 'max_usage_count',
|
||||
// 'usage_count',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{view}'
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user