add backend ticket stat basics

This commit is contained in:
2015-11-06 08:57:39 +01:00
parent e752352e8a
commit de8991b88f
8 changed files with 206 additions and 73 deletions

View File

@@ -2,12 +2,21 @@
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([
@@ -15,37 +24,51 @@ use yii\widgets\ActiveForm;
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_ticket') ?>
<?= $form->field($model, 'id_user') ?>
<?= $form->field($model, 'id_ticket_type') ?>
<?= $form->field($model, 'id_account') ?>
<?= $form->field($model, 'id_discount') ?>
<?php // echo $form->field($model, 'start') ?>
<?php // echo $form->field($model, 'end') ?>
<?php // echo $form->field($model, 'max_usage_count') ?>
<?php // echo $form->field($model, 'usage_count') ?>
<?php // echo $form->field($model, 'status') ?>
<?php // echo $form->field($model, 'price_brutto') ?>
<?php // echo $form->field($model, 'comment') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<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']) ?>
<?= Html::resetButton(Yii::t('common/ticket', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>

View File

@@ -2,6 +2,7 @@
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TicketSearch */
@@ -9,38 +10,41 @@ use yii\grid\GridView;
$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]); ?>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a(Yii::t('common/ticket', 'Create Ticket'), ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id_ticket',
'id_user',
'id_ticket_type',
'id_account',
'id_discount',
// 'start',
// 'end',
// 'max_usage_count',
// 'usage_count',
// 'status',
// 'price_brutto',
// 'comment',
// 'created_at',
// 'updated_at',
[
'attribute' => 'id_user',
'value' => 'userName'
],
[
'attribute' => 'id_ticket_type',
'value' => 'ticketTypeName'
],
[
'attribute' => 'id_account',
'value' => 'accountName'
],
'start:date',
'end:date',
'max_usage_count',
'usage_count',
['class' => 'yii\grid\ActionColumn'],
['class' => 'yii\grid\ActionColumn',
'template' => '{view}'
],
],
]); ?>

View File

@@ -14,16 +14,6 @@ $this->params['breadcrumbs'][] = $this->title;
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a(Yii::t('common/ticket', 'Update'), ['update', 'id' => $model->id_ticket], ['class' => 'btn btn-primary']) ?>
<?= Html::a(Yii::t('common/ticket', 'Delete'), ['delete', 'id' => $model->id_ticket], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('common/ticket', 'Are you sure you want to delete this item?'),
'method' => 'post',
],
]) ?>
</p>
<?= DetailView::widget([
'model' => $model,