add backand ticket/index changes, add backand\ticket\index export pdf, xls

This commit is contained in:
2016-06-29 20:18:47 +02:00
parent 06eca0fe03
commit 5438c9a038
20 changed files with 870 additions and 284 deletions

View File

@@ -0,0 +1,128 @@
<?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 */
?>
<div class="ticket-index">
<h1>Bérletek</h1>
<table class="filter-table">
<tbody>
<tr>
<th>Exportálta</th>
<td><?php echo $filters['admin'] ?></td>
<th>Exportálás ideje</th>
<td><?php echo $filters['exported_at'] ?></td>
</tr>
<tr>
<th>Felhasználó</th>
<td><?php echo $filters['username'] ?></td>
<th>Bérlet típus</th>
<td><?php echo $filters['ticketTypeName'] ?></td>
</tr>
<tr>
<th>Kassza</th>
<td><?php echo $filters['accountName'] ?></td>
<th>Státusz</th>
<td><?php echo $filters['ticketStatus'] ?></td>
</tr>
<tr>
<th>Vendég azon</th>
<td><?php echo $filters['customerIdCustomer'] ?></td>
<th>Vendég neve</th>
<td><?php echo $filters['customerName'] ?></td>
</tr>
<tr>
<th>Időszak -tól</th>
<td><?php echo $filters['start'] ?></td>
<th>Időszak -ig</th>
<td><?php echo $filters['end'] ?></td>
</tr>
<tr>
<th>Bérlet azon</th>
<td><?php echo $filters['ticketIdTicket'] ?></td>
<th>Kártya</th>
<td><?php echo $filters['cardNumber'] ?></td>
</tr>
<tr>
<th>Érvényes az időszakban</th>
<td><?php echo $filters['ticketIntervalIsValid'] ?></td>
<th>Kiadva az időszakban</th>
<td><?php echo $filters['ticketIntervalIsCreated'] ?></td>
</tr>
<tr>
<th>Lejár az időszakban</th>
<td><?php echo $filters['ticketIntervalIsExpire'] ?></td>
<th>Fizetve az időszakban</th>
<td><?php echo $filters['ticketIntervalIsPaid'] ?></td>
</tr>
</tbody>
</table>
<br>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'tableOptions' => ['class' => 'table table-bordered tbl-pdf'],
'columns' => [
[
'attribute' => 'ticket_id_ticket',
'label' => 'B. Azon.',
'enableSorting' => false
],
[
'attribute' => 'customer_name',
'label' => 'Vendég',
'enableSorting' => false
],
[
'attribute' => 'card_number',
'label' => 'Kártya',
'enableSorting' => false
],
[
'attribute' => 'ticket_start',
'label' => 'Érvényes -tól',
'format' => 'date',
'enableSorting' => false
],
[
'attribute' => 'ticket_end',
'label' => 'Érvényes -ig',
'format' => 'date',
'enableSorting' => false
],
[
'attribute' => 'ticket_created_at',
'label' => 'Létrehozva',
'format' => 'datetime',
'enableSorting' => false
],
[
'attribute' => 'ticket_type_name',
'label' => 'Bérlet típus',
'enableSorting' => false
],[
'attribute' => 'user_username',
'label' => 'Felhasználó',
'enableSorting' => false
],
[
'attribute' => 'account_name',
'label' => 'Kassza',
'enableSorting' => false
],
[
'attribute' => 'ticket_status',
'label' => 'Státusz',
'enableSorting' => false,
'value' => function ($model, $key, $index, $column){
return \common\models\Ticket::toStatusName($model['ticket_status']);
}
],
]
]); ?>
</div>

View File

@@ -1,9 +1,9 @@
<?php
use kartik\widgets\DateTimePicker;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\widgets\DatePicker;
use common\models\Ticket;
/* @var $this yii\web\View */
@@ -42,42 +42,58 @@ $userOptions = ['' => 'Mind'] + ArrayHelper::map($model->users, 'id', 'userna
<?= $form->field($model, 'status')->dropDownList( ["" =>"Mind"]+ Ticket::statuses()) ?>
</div>
<div class='col-md-4'>
<?= $form->field($model, 'id_customer')->textInput()->label("Vendég azonosító") ?>
</div>
<div class='col-md-4'>
<?= $form->field($model, 'customer_name')->textInput()->label("Vendég neve") ?>
</div>
</div>
<div class='row'>
<div class='col-md-4'>
<?= $form->field($model, 'id_ticket')->textInput() ?>
</div>
<div class='col-md-4'>
<?= $form->field($model, 'card_number')->textInput()->label("Kártyaszám") ?>
</div>
<div class='col-md-4'>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
<?= $form->field($model, 'start')->widget(DateTimePicker::className(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'end') ->widget(DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
<?= $form->field($model, 'end') ->widget(DateTimePicker::className() , [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
<div class='col-md-4'>
<?= $form->field($model, 'id_ticket')->textInput() ?>
</div>
</div>
<div class='row'>
<div class='col-md-4'>
<div class='col-md-3'>
<?php echo $form->field($model, 'valid_in_interval')->checkbox( ) ?>
</div>
<div class='col-md-4'>
<div class='col-md-3'>
<?php echo $form->field($model, 'created_in_interval')->checkbox( ) ?>
</div>
<div class='col-md-4'>
<div class='col-md-3'>
<?php echo $form->field($model, 'expire_in_interval')->checkbox( ) ?>
</div>
<div class='col-md-3'>
<?php echo $form->field($model, 'paid_in_interval')->checkbox( ) ?>
</div>
</div>
<div class="form-group">

View File

@@ -12,23 +12,36 @@ use yii\data\ArrayDataProvider;
$this->title = Yii::t('common/ticket', 'Tickets');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<div class="row">
<div class="col-md-3">
<div class="clearfix" style="margin-bottom: 6px;">
<span class="pull-left">
Exportálás:
</span>
<?php
echo Html::a(
"PDF",\yii\helpers\Url::current( [ Html::getInputName($searchModel,'output') => 'pdf' ]),
['class' => 'btn btn-primary pull-left','style'=> 'margin-left: 12px;']
);
?>
<?php
echo Html::a(
"XLS",\yii\helpers\Url::current( [ Html::getInputName($searchModel,'output') => 'xls' ]),
['class' => 'btn btn-primary pull-left','style'=> 'margin-left: 12px;']
);
?>
</div>
</div>
</div>
<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,
@@ -71,51 +84,71 @@ $this->params['breadcrumbs'][] = $this->title;
?>
</div>
</div>
<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'ticket_id_ticket',
'label' => 'B. Azonosító'
],
[
'attribute' => 'customer_name',
'label' => 'Vendég'
],
[
'attribute' => 'card_number',
'label' => 'Kártya'
],
[
'attribute' => 'ticket_start',
'label' => 'Érvényes -tól',
'format' => 'date'
],
[
'attribute' => 'ticket_end',
'label' => 'Érvényes -ig',
'format' => 'date'
],
[
'attribute' => 'ticket_type_name',
'label' => 'Bérlet típus',
],
[
'attribute' => 'ticket_created_at',
'label' => 'Létrehozva',
'format' => 'datetime'
],
[
'attribute' => 'user_username',
'label' => 'Felhasználó',
],
[
'attribute' => 'account_name',
'label' => 'Kassza',
],
[
'attribute' => 'ticket_status',
'label' => 'Státusz',
'value' => function ($model, $key, $index, $column){
return \common\models\Ticket::toStatusName($model['ticket_status']);
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view}',
'urlCreator' => function($action, $model, $key, $index){
$result = "";
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_ticket',
'value' => 'id_ticket',
'label' => 'B. Azonosító'
],
[
'attribute' => 'id_customer',
'value' => 'customerName'
],
[
'attribute' => 'id_card',
'value' => 'cardNumber'
],
'start:date',
'end:date',
'created_at:date',
[
'attribute' => 'id_user',
'value' => 'userName'
if ( $action == 'view'){
$result = \yii\helpers\Url::toRoute(['ticket/view','id' => $model['ticket_id_ticket']]);
}
return $result;
}
],
[
'attribute' => 'id_ticket_type',
'value' => 'ticketTypeName'
],
[
'attribute' => 'id_account',
'value' => 'accountName'
],
[
'attribute' => 'status',
'value' => 'statusName'
],
// 'max_usage_count',
// 'usage_count',
]
['class' => 'yii\grid\ActionColumn',
'template' => '{view}'
],
],
]); ?>
</div>
]);
?>
</div>

View File

@@ -11,47 +11,43 @@ $this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'),
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-view">
<h1><?= Html::encode($this->title) ?></h1>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_ticket',
[
'attribute' => 'id_user',
'value' => $model->user->username,
],
[
'attribute' => 'id_ticket_type',
'value' => $model->ticketTypeName,
],
[
'attribute' => 'id_account',
'value' => $model->accountName,
],
[
'attribute' => 'id_discount',
'value' => $model->discountName,
],
'start:datetime',
'end:datetime',
[
'attribute' => 'id_user',
'value' => $model->user->username,
],
[
'attribute' => 'id_ticket_type',
'value' => $model->ticketTypeName,
],
[
'attribute' => 'id_account',
'value' => $model->accountName,
],
[
'attribute' => 'id_discount',
'value' => $model->discountName,
],
'start:date',
'end:date',
'max_usage_count',
'usage_count',
[
'attribute' => 'status',
'value' => $model->statusName
],
[
'attribute' => 'status',
'value' => $model->statusName
],
'price_brutto',
'comment:raw',
'created_at',
'updated_at',
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>