add frontend ticket changes
This commit is contained in:
parent
c3ae414bba
commit
11e7c85cf3
@ -70,4 +70,58 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
|
|||||||
'updated_at' => Yii::t('common/ticket', 'Updated At'),
|
'updated_at' => Yii::t('common/ticket', 'Updated At'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getCard(){
|
||||||
|
return $this->hasOne( Card::className(), ["id_card" =>"id_card" ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUser(){
|
||||||
|
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTicketType(){
|
||||||
|
return $this->hasOne( TicketType::className(), ["id_ticket_type" =>"id_ticket_type" ] );
|
||||||
|
}
|
||||||
|
public function getDiscount(){
|
||||||
|
return $this->hasOne( Discount::className(), ["id_discount" =>"id_discount" ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAccount() {
|
||||||
|
return $this->hasOne ( Account::className (), [
|
||||||
|
'id_account' => 'id_account'
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
public function getAccountName() {
|
||||||
|
$result = "";
|
||||||
|
$account = $this->account;
|
||||||
|
if ( isset($account) ){
|
||||||
|
$result = $this->account->name;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
public function getDiscountName() {
|
||||||
|
$result = "";
|
||||||
|
$discount = $this->discount;
|
||||||
|
if ( isset($discount) ){
|
||||||
|
$result = $this->discount->name;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
public function getTicketTypeName() {
|
||||||
|
$result = "";
|
||||||
|
$ticketType = $this->ticketType;
|
||||||
|
if ( isset($ticketType) ){
|
||||||
|
$result = $ticketType->name;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
public function getUserName() {
|
||||||
|
$result = "";
|
||||||
|
$user = $this->user;
|
||||||
|
if ( isset($user) ){
|
||||||
|
$result = $user->username;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,6 +148,42 @@ class Transfer extends \yii\db\ActiveRecord
|
|||||||
return $transfer;
|
return $transfer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $account common\models\Account
|
||||||
|
* @param $discount common\models\Discount
|
||||||
|
* @param $currency common\models\Currency
|
||||||
|
* @param $ticket common\models\Ticket
|
||||||
|
* */
|
||||||
|
public static function createTicketTransfer($account, $discount, $currency, $count,$ticket ){
|
||||||
|
$transfer = new Transfer();
|
||||||
|
|
||||||
|
$transfer->type = Transfer::TYPE_TICKET;
|
||||||
|
|
||||||
|
$transfer->id_object = $ticket->id_ticket;
|
||||||
|
|
||||||
|
$transfer->item_price = $ticket->price_brutto;
|
||||||
|
$totalPrice = $transfer->item_price;
|
||||||
|
|
||||||
|
$transfer->count = $count;
|
||||||
|
$totalPrice = $totalPrice * $count;
|
||||||
|
|
||||||
|
if ( isset( $discount ) ){
|
||||||
|
$transfer->id_discount = $discount->id_discount;
|
||||||
|
$totalPrice = Discount::applyDiscount( $totalPrice, $discount);
|
||||||
|
}
|
||||||
|
|
||||||
|
$transfer->money = $totalPrice;
|
||||||
|
|
||||||
|
if ( isset( $currency ) ){
|
||||||
|
$transfer->rate = $currency->rate;
|
||||||
|
$transfer->money_currency = Currency::applyCurrency($totalPrice, $currency);
|
||||||
|
}
|
||||||
|
|
||||||
|
$transfer->id_account = $account->id_account;
|
||||||
|
|
||||||
|
return $transfer;
|
||||||
|
}
|
||||||
|
|
||||||
public static function modelsToArray($transfers,$default = []){
|
public static function modelsToArray($transfers,$default = []){
|
||||||
|
|
||||||
if ( $transfers == null ){
|
if ( $transfers == null ){
|
||||||
@ -168,7 +204,13 @@ class Transfer extends \yii\db\ActiveRecord
|
|||||||
return $transfer->account->name;
|
return $transfer->account->name;
|
||||||
},
|
},
|
||||||
'product_name' => function ($transfer) {
|
'product_name' => function ($transfer) {
|
||||||
return $transfer->product->name;
|
$result = "";
|
||||||
|
if ( $transfer->type == Transfer::TYPE_TICKET ){
|
||||||
|
$result = $transfer->ticket->type->name;
|
||||||
|
}else{
|
||||||
|
$result = $transfer->product->name;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
},
|
},
|
||||||
'category' => function ($transfer) {
|
'category' => function ($transfer) {
|
||||||
return $transfer->product->productCategoryName;
|
return $transfer->product->productCategoryName;
|
||||||
@ -183,8 +225,8 @@ class Transfer extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
$query = Transfer::find();
|
$query = Transfer::find();
|
||||||
|
|
||||||
$query->innerJoinWith('userSoldItem');
|
// $query->innerJoinWith('userSoldItem');
|
||||||
$query->andWhere(['user_sold_item.id_user' => $user->id ]);
|
$query->andWhere(['transfer.id_user' => $user->id ]);
|
||||||
$transfers = $query->all();
|
$transfers = $query->all();
|
||||||
|
|
||||||
return $transfers;
|
return $transfers;
|
||||||
|
|||||||
@ -7,7 +7,11 @@ class m151008_065256_alter__table__ticket__add_columns extends Migration
|
|||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
$this->addColumn('ticket', 'id_card', 'int(11)');
|
||||||
|
$this->alterColumn('ticket', 'start', 'dateTime' );
|
||||||
|
$this->alterColumn('ticket', 'end', 'dateTime' );
|
||||||
|
$this->alterColumn('ticket', 'created_at', 'dateTime' );
|
||||||
|
$this->alterColumn('ticket', 'updated_at', 'dateTime' );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m151008_101155_alter_table_ticket__alter__column_comment extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->alterColumn('ticket', 'comment', 'varchar(255) null' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m151008_101155_alter_table_ticket__alter__column_comment cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m151008_101334_alter_table_ticket__alter__columns__not_null extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->alterColumn('ticket', 'id_user', 'int(11) not null' );
|
||||||
|
$this->alterColumn('ticket', 'id_ticket_type', 'int(11) not null' );
|
||||||
|
$this->alterColumn('ticket', 'id_account', 'int(11) not null' );
|
||||||
|
$this->alterColumn('ticket', 'id_user', 'int(11) not null' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m151008_101334_alter_table_ticket__alter__columns__not_null cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -9,9 +9,9 @@ use yii\helpers\ArrayHelper;
|
|||||||
class HtmlHelper{
|
class HtmlHelper{
|
||||||
|
|
||||||
|
|
||||||
private static function mkOptions( $models, $key, $value = 'name', $options = [] ){
|
public static function mkOptions( $models, $key, $value = 'name' ){
|
||||||
$result = [];
|
$result = [];
|
||||||
$result = ArrayHelper::map($models, $key, $value);
|
$result = ArrayHelper::map( $models, $key, $value );
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -20,23 +20,26 @@ class HtmlHelper{
|
|||||||
* @var $models common\models\Account[]
|
* @var $models common\models\Account[]
|
||||||
* @return
|
* @return
|
||||||
* */
|
* */
|
||||||
public static function mkAccountOptions( $models, $options = [] ){
|
public static function mkAccountOptions( $models ){
|
||||||
return $result = self::mkOptions($models, 'id_account');
|
$result = HtmlHelper::mkOptions( $models, 'id_account' );
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @var $models common\models\Discount[]
|
* @var $models common\models\Discount[]
|
||||||
* @return
|
* @return
|
||||||
* */
|
* */
|
||||||
public static function mkDiscountOptions( $models, $options = [] ){
|
public static function mkDiscountOptions( $models ){
|
||||||
return $result = self::mkOptions($models, 'id_discount');
|
$result = HtmlHelper::mkOptions( $models, 'id_discount' );
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $models common\models\TicketType[]
|
* @var $models common\models\TicketType[]
|
||||||
* @return
|
* @return
|
||||||
* */
|
* */
|
||||||
public static function mkTicketTypeOptions( $models, $options = [] ){
|
public static function mkTicketTypeOptions( $models ){
|
||||||
return $result = self::mkOptions($models, 'id_ticket_type');
|
$result = HtmlHelper::mkOptions( $models, 'id_ticket_type');
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -38,14 +38,24 @@ class TicketController extends Controller
|
|||||||
* Lists all Ticket models.
|
* Lists all Ticket models.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function actionIndex()
|
public function actionIndex($number = null)
|
||||||
{
|
{
|
||||||
|
$receptionForm = new ReceptionForm();
|
||||||
|
$receptionForm->number = $number;
|
||||||
|
$receptionForm->readCard();
|
||||||
|
|
||||||
|
|
||||||
|
if ( !isset($receptionForm->card ) ){
|
||||||
|
throw new NotFoundHttpException( Yii::t('frontend/ticket', 'The requested card does not exist.'));
|
||||||
|
}
|
||||||
|
|
||||||
$searchModel = new TicketSearch();
|
$searchModel = new TicketSearch();
|
||||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
$dataProvider = $searchModel->search( $receptionForm->card, Yii::$app->request->queryParams);
|
||||||
|
|
||||||
return $this->render('index', [
|
return $this->render('index', [
|
||||||
'searchModel' => $searchModel,
|
'searchModel' => $searchModel,
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
|
'receptionForm' => $receptionForm,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,6 +85,10 @@ class TicketController extends Controller
|
|||||||
|
|
||||||
$receptionForm->readCard();
|
$receptionForm->readCard();
|
||||||
|
|
||||||
|
if ( !isset($receptionForm->card ) ){
|
||||||
|
throw new NotFoundHttpException( Yii::t('frontend/ticket', 'The requested card does not exist.'));
|
||||||
|
}
|
||||||
|
|
||||||
$model = new TicketCreate();
|
$model = new TicketCreate();
|
||||||
|
|
||||||
$discounts = Discount::read();
|
$discounts = Discount::read();
|
||||||
@ -89,9 +103,11 @@ class TicketController extends Controller
|
|||||||
$model->id_user = \Yii::$app->user->id;
|
$model->id_user = \Yii::$app->user->id;
|
||||||
$model->status = Ticket::STATUS_ACTIVE;
|
$model->status = Ticket::STATUS_ACTIVE;
|
||||||
$model->usage_count = 0;
|
$model->usage_count = 0;
|
||||||
|
$model->id_card = $receptionForm->card->id_card;
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
return $this->redirect(['view', 'id' => $model->id_ticket]);
|
Yii::$app->session->setFlash('success', Yii::t('frontend/ticket', 'Ticket added to customer') );
|
||||||
|
return $this->redirect(['index', 'number' => $receptionForm->card->number]);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$userTransfers = Transfer::modelsToArray( Transfer::readUserSoldTransfers($user) );
|
$userTransfers = Transfer::modelsToArray( Transfer::readUserSoldTransfers($user) );
|
||||||
|
|||||||
@ -5,10 +5,14 @@ use common\models\Ticket;
|
|||||||
use common\models\TicketType;
|
use common\models\TicketType;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use common\models\Discount;
|
use common\models\Discount;
|
||||||
|
use common\models\Transfer;
|
||||||
|
|
||||||
class TicketCreate extends Ticket{
|
class TicketCreate extends Ticket{
|
||||||
|
|
||||||
|
public $_currency;
|
||||||
|
public $_account;
|
||||||
|
public $_discount;
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -47,7 +51,6 @@ class TicketCreate extends Ticket{
|
|||||||
/////////////////////
|
/////////////////////
|
||||||
//comment
|
//comment
|
||||||
/////////////////////
|
/////////////////////
|
||||||
[['comment'], 'required'],
|
|
||||||
[['comment'], 'string', 'max' => 255]
|
[['comment'], 'string', 'max' => 255]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -59,18 +62,26 @@ class TicketCreate extends Ticket{
|
|||||||
$this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid ticket type' ));
|
$this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid ticket type' ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateAccount($attribute,$params){
|
public function validateAccount($attribute,$params){
|
||||||
$acc = Account::findOne($this->id_account);
|
$this->_account = Account::findOne($this->id_account);
|
||||||
if ( !isset($acc)) {
|
if ( !isset($this->_account )) {
|
||||||
$this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid transfer' ));
|
$this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid transfer' ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateDiscount($attribute,$params){
|
public function validateDiscount($attribute,$params){
|
||||||
$discount = Discount::findOne($this->id_discount);
|
$this->_discount = Discount::findOne($this->id_discount);
|
||||||
if ( !isset($discount)) {
|
if ( !isset($this->_discount)) {
|
||||||
$this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid discount' ));
|
$this->addError($attribute,Yii::t('frontend/ticket' , 'Invalid discount' ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function afterSave($insert, $changedAttributes){
|
||||||
|
|
||||||
|
$transfer = Transfer::createTicketTransfer($this->_account, $this->_discount, null, 1, $this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -39,14 +39,19 @@ class TicketSearch extends Ticket
|
|||||||
*
|
*
|
||||||
* @return ActiveDataProvider
|
* @return ActiveDataProvider
|
||||||
*/
|
*/
|
||||||
public function search($params)
|
public function search($card, $params)
|
||||||
{
|
{
|
||||||
$query = Ticket::find();
|
$query = Ticket::find();
|
||||||
|
|
||||||
$dataProvider = new ActiveDataProvider([
|
$dataProvider = new ActiveDataProvider([
|
||||||
'query' => $query,
|
'query' => $query,
|
||||||
|
'sort'=> ['defaultOrder' => ['end'=>SORT_DESC]]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
$query->innerJoinWith( 'card' );
|
||||||
|
$query->andWhere( ['card.id_card' => $card->id_card ] );
|
||||||
|
|
||||||
$this->load($params);
|
$this->load($params);
|
||||||
|
|
||||||
if (!$this->validate()) {
|
if (!$this->validate()) {
|
||||||
@ -56,7 +61,6 @@ class TicketSearch extends Ticket
|
|||||||
}
|
}
|
||||||
|
|
||||||
$query->andFilterWhere([
|
$query->andFilterWhere([
|
||||||
'id_ticket' => $this->id_ticket,
|
|
||||||
'id_user' => $this->id_user,
|
'id_user' => $this->id_user,
|
||||||
'id_ticket_type' => $this->id_ticket_type,
|
'id_ticket_type' => $this->id_ticket_type,
|
||||||
'id_account' => $this->id_account,
|
'id_account' => $this->id_account,
|
||||||
|
|||||||
@ -66,12 +66,11 @@ function mkBtn($card, $label,$route = null ){
|
|||||||
<?php echo mkCustomerBtn( $card, Yii::t( 'frontend/customer' , 'Befizetések') , 'ticket/index'); ?>
|
<?php echo mkCustomerBtn( $card, Yii::t( 'frontend/customer' , 'Befizetések') , 'ticket/index'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-4'>
|
<div class='col-md-4'>
|
||||||
<?php echo Html::a(Html::tag("i","", [ 'class' => 'glyphicon glyphicon-plus' ] ) , Url::toRoute('ticket/create') , ['class' => 'btn btn-primary btn-reception'] ) ?>
|
<?php echo mkCustomerBtn( $card, Html::tag("i","", [ 'class' => 'glyphicon glyphicon-plus' ] ) , 'ticket/create' ); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-12'>
|
<div class='col-md-12'>
|
||||||
<?php //echo Html::a(Yii::t( 'frontend/customer', 'Termékeladás') , 'product/index' , ['class' => 'btn btn-primary btn-reception'] )?>
|
|
||||||
<?php echo mkBtn($card, Yii::t( 'frontend/transfer', 'Termékeladás'), 'product/sale')?>
|
<?php echo mkBtn($card, Yii::t( 'frontend/transfer', 'Termékeladás'), 'product/sale')?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,13 +15,14 @@ use kartik\widgets\DatePicker;
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$accountOptions = [];
|
||||||
|
$discountOptions= [];
|
||||||
|
$ticketTypeOptions= [];
|
||||||
|
|
||||||
$accountOptions = HtmlHelper::mkAccountOptions($accounts);
|
$accountOptions = HtmlHelper::mkAccountOptions($accounts);
|
||||||
$discountOptions = HtmlHelper::mkDiscountOptions($discounts);
|
$discountOptions = ['' => ''] + HtmlHelper::mkDiscountOptions($discounts, [ 'emptyOption' => true] );
|
||||||
$ticketTypeOptions = HtmlHelper::mkTicketTypeOptions($ticketTypes);
|
$ticketTypeOptions = HtmlHelper::mkTicketTypeOptions($ticketTypes);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="row" >
|
<div class="row" >
|
||||||
@ -36,8 +37,7 @@ use kartik\widgets\DatePicker;
|
|||||||
|
|
||||||
<?= $form->field($model, 'id_discount')->dropDownList($discountOptions) ?>
|
<?= $form->field($model, 'id_discount')->dropDownList($discountOptions) ?>
|
||||||
|
|
||||||
|
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
||||||
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
|
||||||
'pluginOptions' => [
|
'pluginOptions' => [
|
||||||
'autoclose'=>true,
|
'autoclose'=>true,
|
||||||
'format' => 'yyyy.mm.dd'
|
'format' => 'yyyy.mm.dd'
|
||||||
|
|||||||
@ -2,45 +2,71 @@
|
|||||||
|
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\grid\GridView;
|
use yii\grid\GridView;
|
||||||
|
use frontend\components\ReceptionMenuWidget;
|
||||||
|
use frontend\components\ReceptionCardNumberWidget;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $searchModel frontend\models\TicketSearch */
|
/* @var $searchModel frontend\models\TicketSearch */
|
||||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||||
|
/* @var $receptionForm frotned\models\ReceptionForm */
|
||||||
|
|
||||||
|
$card = $receptionForm->card;
|
||||||
|
$customer = $receptionForm->customer;
|
||||||
|
|
||||||
$this->title = Yii::t('common/ticket', 'Tickets');
|
$this->title = Yii::t('common/ticket', 'Tickets');
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
?>
|
?>
|
||||||
<div class="ticket-index">
|
<div class="ticket-index">
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?php echo ReceptionMenuWidget::widget( [ 'customer' => $customer, 'card' => $card] ) ?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
<?php echo ReceptionCardNumberWidget::widget( [ 'customer' => $customer, 'card' =>$card, 'route' => ['customer/reception'] ] )?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-4'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?= Html::a(Yii::t('common/ticket', 'Create Ticket'), ['create'], ['class' => 'btn btn-success']) ?>
|
<?= Html::a(Yii::t('common/ticket', 'Create Ticket'), ['create' ,'number' => $card->number ], ['class' => 'btn btn-success']) ?>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?= GridView::widget([
|
<?= GridView::widget([
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
'filterModel' => $searchModel,
|
|
||||||
'columns' => [
|
'columns' => [
|
||||||
['class' => 'yii\grid\SerialColumn'],
|
|
||||||
|
|
||||||
'id_ticket',
|
[
|
||||||
'id_user',
|
'attribute' => 'id_account',
|
||||||
'id_ticket_type',
|
'value' => 'accountName'
|
||||||
'id_account',
|
],
|
||||||
'id_discount',
|
[
|
||||||
// 'start',
|
'attribute' => 'id_ticket_type',
|
||||||
// 'end',
|
'value' => 'ticketTypeName'
|
||||||
// 'max_usage_count',
|
],
|
||||||
// 'usage_count',
|
'start:date',
|
||||||
// 'status',
|
'end:date',
|
||||||
// 'price_brutto',
|
'max_usage_count',
|
||||||
// 'comment',
|
'usage_count',
|
||||||
// 'created_at',
|
[
|
||||||
// 'updated_at',
|
'attribute' => 'id_user',
|
||||||
|
'value' => 'userName'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'id_discount',
|
||||||
|
'value' => 'discountName'
|
||||||
|
],
|
||||||
|
'price_brutto',
|
||||||
|
'created_at:datetime',
|
||||||
|
|
||||||
['class' => 'yii\grid\ActionColumn'],
|
['class' => 'yii\grid\ActionColumn',
|
||||||
|
'template' =>'{view} {update}',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
]); ?>
|
]); ?>
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ use yii\widgets\DetailView;
|
|||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Ticket */
|
/* @var $model common\models\Ticket */
|
||||||
|
|
||||||
$this->title = $model->id_ticket;
|
$this->title = Yii::t('frontend/ticket', "Update ticket");
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
?>
|
?>
|
||||||
@ -16,32 +16,34 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?= Html::a(Yii::t('common/ticket', 'Update'), ['update', 'id' => $model->id_ticket], ['class' => 'btn btn-primary']) ?>
|
<?= 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>
|
</p>
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<?= DetailView::widget([
|
||||||
'model' => $model,
|
'model' => $model,
|
||||||
'attributes' => [
|
'attributes' => [
|
||||||
'id_ticket',
|
[
|
||||||
'id_user',
|
'attribute' => 'id_ticket_type',
|
||||||
'id_ticket_type',
|
'value' => $model->ticketTypeName,
|
||||||
'id_account',
|
],
|
||||||
'id_discount',
|
[
|
||||||
'start',
|
'attribute' => 'id_account',
|
||||||
'end',
|
'value' => $model->accountName,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'id_discount',
|
||||||
|
'value' => $model->discountName,
|
||||||
|
],
|
||||||
|
'start:date',
|
||||||
|
'end:date',
|
||||||
'max_usage_count',
|
'max_usage_count',
|
||||||
'usage_count',
|
'usage_count',
|
||||||
'status',
|
'status',
|
||||||
'price_brutto',
|
'price_brutto',
|
||||||
'comment',
|
[
|
||||||
'created_at',
|
'attribute' => 'comment',
|
||||||
'updated_at',
|
'type' => 'raw',
|
||||||
|
],
|
||||||
|
'created_at:datetime',
|
||||||
],
|
],
|
||||||
]) ?>
|
]) ?>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user