add ticket basics

This commit is contained in:
rocho 2015-10-06 17:20:15 +02:00
parent 48e392b4fd
commit 2e906de8c2
18 changed files with 998 additions and 0 deletions

View File

@ -0,0 +1,121 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\Ticket;
use backend\models\TicketSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* TicketController implements the CRUD actions for Ticket model.
*/
class TicketController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Ticket models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new TicketSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Ticket model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Ticket model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Ticket();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ticket]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Ticket model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ticket]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Ticket model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Ticket model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Ticket the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Ticket::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Ticket;
/**
* TicketSearch represents the model behind the search form about `common\models\Ticket`.
*/
class TicketSearch extends Ticket
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_ticket', 'id_user', 'id_ticket_type', 'id_account', 'id_discount', 'max_usage_count', 'usage_count', 'status', 'price_brutto'], 'integer'],
[['start', 'end', 'comment', 'created_at', 'updated_at'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Ticket::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere([
'id_ticket' => $this->id_ticket,
'id_user' => $this->id_user,
'id_ticket_type' => $this->id_ticket_type,
'id_account' => $this->id_account,
'id_discount' => $this->id_discount,
'start' => $this->start,
'end' => $this->end,
'max_usage_count' => $this->max_usage_count,
'usage_count' => $this->usage_count,
'status' => $this->status,
'price_brutto' => $this->price_brutto,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'comment', $this->comment]);
return $dataProvider;
}
}

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ticket-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'id_ticket_type')->textInput() ?>
<?= $form->field($model, 'id_account')->textInput() ?>
<?= $form->field($model, 'id_discount')->textInput() ?>
<?= $form->field($model, 'start')->textInput() ?>
<?= $form->field($model, 'end')->textInput() ?>
<?= $form->field($model, 'max_usage_count')->textInput() ?>
<?= $form->field($model, 'usage_count')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'price_brutto')->textInput() ?>
<?= $form->field($model, 'comment')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket', 'Create') : Yii::t('common/ticket', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,53 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\models\TicketSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ticket-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'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="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(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
$this->title = Yii::t('common/ticket', 'Create Ticket');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\TicketSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$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]); ?>
<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',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
$this->title = Yii::t('common/ticket', 'Update {modelClass}: ', [
'modelClass' => 'Ticket',
]) . ' ' . $model->id_ticket;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_ticket, 'url' => ['view', 'id' => $model->id_ticket]];
$this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update');
?>
<div class="ticket-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,48 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
$this->title = $model->id_ticket;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-view">
<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,
'attributes' => [
'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',
],
]) ?>
</div>

70
common/models/Ticket.php Normal file
View File

@ -0,0 +1,70 @@
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "ticket".
*
* @property integer $id_ticket
* @property integer $id_user
* @property integer $id_ticket_type
* @property integer $id_account
* @property integer $id_discount
* @property string $start
* @property string $end
* @property integer $max_usage_count
* @property integer $usage_count
* @property integer $status
* @property integer $price_brutto
* @property string $comment
* @property string $created_at
* @property string $updated_at
*/
class Ticket extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'ticket';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_user', 'id_ticket_type', 'id_account', 'id_discount', 'max_usage_count', 'usage_count', 'status', 'price_brutto'], 'integer'],
[['start', 'end', 'created_at', 'updated_at'], 'safe'],
[['comment'], 'required'],
[['comment'], 'string', 'max' => 255]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id_ticket' => Yii::t('common/ticket', 'Id Ticket'),
'id_user' => Yii::t('common/ticket', 'Id User'),
'id_ticket_type' => Yii::t('common/ticket', 'Id Ticket Type'),
'id_account' => Yii::t('common/ticket', 'Id Account'),
'id_discount' => Yii::t('common/ticket', 'Id Discount'),
'start' => Yii::t('common/ticket', 'Start'),
'end' => Yii::t('common/ticket', 'End'),
'max_usage_count' => Yii::t('common/ticket', 'Max Usage Count'),
'usage_count' => Yii::t('common/ticket', 'Usage Count'),
'status' => Yii::t('common/ticket', 'Status'),
'price_brutto' => Yii::t('common/ticket', 'Price Brutto'),
'comment' => Yii::t('common/ticket', 'Comment'),
'created_at' => Yii::t('common/ticket', 'Created At'),
'updated_at' => Yii::t('common/ticket', 'Updated At'),
];
}
}

View File

@ -0,0 +1,52 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m151006_100909_create__table__ticket extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%ticket}}', [
'id_ticket' => $this->primaryKey(),
'id_user' => $this->integer(),
'id_ticket_type' => $this->integer(),
'id_account' => $this->integer(),
'id_discount' => $this->integer(),
'start' => $this->timestamp(),
'end' => $this->timestamp(),
'max_usage_count' => $this->integer(),
'usage_count' => $this->integer(),
'status' => $this->integer(),
'price_brutto' => $this->integer(),
'comment' => $this->string(255)->notNull(),
'created_at' => $this->timestamp()->notNull(),
'updated_at' => $this->timestamp()->notNull(),
], $tableOptions);
}
public function down()
{
echo "m151006_100909_create__table__ticket cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,121 @@
<?php
namespace frontend\controllers;
use Yii;
use common\models\Ticket;
use frontend\models\TicketSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* TicketController implements the CRUD actions for Ticket model.
*/
class TicketController extends Controller
{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['post'],
],
],
];
}
/**
* Lists all Ticket models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new TicketSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
/**
* Displays a single Ticket model.
* @param integer $id
* @return mixed
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Ticket model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Ticket();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ticket]);
} else {
return $this->render('create', [
'model' => $model,
]);
}
}
/**
* Updates an existing Ticket model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ticket]);
} else {
return $this->render('update', [
'model' => $model,
]);
}
}
/**
* Deletes an existing Ticket model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Ticket model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Ticket the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Ticket::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
}
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace frontend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Ticket;
/**
* TicketSearch represents the model behind the search form about `common\models\Ticket`.
*/
class TicketSearch extends Ticket
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[['id_ticket', 'id_user', 'id_ticket_type', 'id_account', 'id_discount', 'max_usage_count', 'usage_count', 'status', 'price_brutto'], 'integer'],
[['start', 'end', 'comment', 'created_at', 'updated_at'], 'safe'],
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Ticket::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere([
'id_ticket' => $this->id_ticket,
'id_user' => $this->id_user,
'id_ticket_type' => $this->id_ticket_type,
'id_account' => $this->id_account,
'id_discount' => $this->id_discount,
'start' => $this->start,
'end' => $this->end,
'max_usage_count' => $this->max_usage_count,
'usage_count' => $this->usage_count,
'status' => $this->status,
'price_brutto' => $this->price_brutto,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'comment', $this->comment]);
return $dataProvider;
}
}

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ticket-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'id_ticket_type')->textInput() ?>
<?= $form->field($model, 'id_account')->textInput() ?>
<?= $form->field($model, 'id_discount')->textInput() ?>
<?= $form->field($model, 'start')->textInput() ?>
<?= $form->field($model, 'end')->textInput() ?>
<?= $form->field($model, 'max_usage_count')->textInput() ?>
<?= $form->field($model, 'usage_count')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'price_brutto')->textInput() ?>
<?= $form->field($model, 'comment')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket', 'Create') : Yii::t('common/ticket', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,53 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model frontend\models\TicketSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="ticket-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'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="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(); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
$this->title = Yii::t('common/ticket', 'Create Ticket');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\TicketSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$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]); ?>
<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',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
$this->title = Yii::t('common/ticket', 'Update {modelClass}: ', [
'modelClass' => 'Ticket',
]) . ' ' . $model->id_ticket;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_ticket, 'url' => ['view', 'id' => $model->id_ticket]];
$this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update');
?>
<div class="ticket-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,48 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
$this->title = $model->id_ticket;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-view">
<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,
'attributes' => [
'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',
],
]) ?>
</div>