add reception customer search, fix reception ticket types, fix card number routing, timezone changes

This commit is contained in:
2016-01-06 21:20:21 +01:00
parent 39ae361505
commit 6d2e15cac7
15 changed files with 251 additions and 11 deletions

View File

@@ -23,8 +23,8 @@ class FrontendMenuStructure{
public function __construct(){
$this->menuItems = [];
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today') );
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
$this->startDate = Yii::$app->formatter->asDate( strtotime('today UTC') );
$this->tomorrowDate = Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
@@ -84,6 +84,8 @@ class FrontendMenuStructure{
$items[] = ['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[id_user]' =>\Yii::$app->user->id, 'TransferSearch[id_account]' => Account::readDefault(), 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ];
$items[] = ['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ];
}
$items[] = ['label' => Yii::t('frontend/card','Vendégek'), 'url' => [ '/card/index' ] ];
$this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'),

View File

@@ -81,6 +81,16 @@ class CardController extends Controller
echo Json::encode ( $out );
}
public function actionIndex(){
$searchModel = new \common\models\CardSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
}

View File

@@ -59,7 +59,8 @@ class CustomerController extends Controller
if ( $model->isFreeCard() ){
return $this->redirect([ 'create', 'number' => $model->card->number ]);
}else if ( $model->isCustomerWithTicket()){
return $this->redirect([ 'product/sale', 'number' => $model->card->number ]);
// return $this->redirect([ 'product/sale', 'number' => $model->card->number ]);
// return $this->redirect([ 'customer/reception', 'number' => $model->card->number ]);
}else if ( $model->isCardWithCustomer() ){
return $this->redirect([ 'ticket/create', 'number' => $model->card->number ]);
}

View File

@@ -97,7 +97,7 @@ class TicketController extends FrontendController
$discounts = Discount::read();
$ticketTypes = TicketType::read(null, Account::readDefault());
$ticketTypes = TicketType::read(null, null);
$accounts = Account::readAccounts();

View File

@@ -8,6 +8,7 @@ use common\models\Card;
use common\models\Customer;
use common\models\Ticket;
use common\models\Account;
use common\models\CardSearch;
/**
* ContactForm is the model behind the contact form.
@@ -19,6 +20,7 @@ class ReceptionForm extends Model
public $customer;
public $tickets;
public $defaultAccount;
public $cardSearchModel;
/**
* @inheritdoc
@@ -56,6 +58,8 @@ class ReceptionForm extends Model
$this->defaultAccount = Account::findOne($defaultAccount);
}
$this->cardSearchModel = new CardSearch();
}
public function getDefaultAccountName(){

View File

@@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model frontend\models\CollectionSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
?>
<div class="collection-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class='row'>
<div class="col-md-4">
<?php echo $form->field($model, 'customerName') ?>
</div>
<div class="col-md-4">
<?php echo $form->field($model, 'number') ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,70 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\components\AccountTotalWidget;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\CollectionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('frontend/collection', 'Vendégek');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'card_number',
'label' => 'Kártyaszám',
],
[
'attribute' => 'customer_name',
'label' => 'Név',
],
[
'attribute' => 'customer_phone',
'label' => 'Tel',
],
[
'attribute' => 'customer_email',
'label' => 'E-mail',
],
// [
// 'attribute' => 'customer.name',
// 'value' => 'customer.name',
// ],
['class' => 'yii\grid\ActionColumn',
'template' => '{ticket} {ticket_history}',
'buttons' => [
'ticket' => function ($url, $model, $key) {
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
'ticket_history' => function ($url, $model, $key) {
return Html::a('Befizetések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
],
'urlCreator' => function ($action, $model, $key, $index){
$url = "";
if ( 'ticket' == $action ){
$url = Url::to(['ticket/create','number' => $model['card_number']]);
}else if ( 'ticket_history' == $action ){
$url = Url::to(['ticket/index','number' => $model['card_number']]);
}
return $url;
}
],
],
]); ?>
</div>

View File

@@ -6,6 +6,8 @@ use frontend\components\ReceptionCardNumberTicketsWidget;
use yii\base\Widget;
use frontend\components\ReceptionTicketWidget;
use frontend\components\ReceptionCustomerWidget;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
?>
<div class='row'>
<div class='col-md-4'>
@@ -13,6 +15,19 @@ use frontend\components\ReceptionCustomerWidget;
Aktuális kassza: <?php echo $model->getDefaultAccountName();?>
</div>
</div>
<?php $form = ActiveForm::begin([
'action' => ['card/index'],
'method' => 'get',
]); ?>
<div class='col-md-3'>
<?php echo Html::textInput('CardSearch[customerName]','',['class'=>"form-control", 'placeholder' =>'Vendég neve']) ?>
</div>
<div class='col-md-3'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<div class='row'>
<div class='col-md-3'>

View File

@@ -6,3 +6,9 @@ use frontend\components\ReceptionWidget;
?>
<h1>Recepció</h1>
<?php echo ReceptionWidget::widget( ['form' => $model, 'route' => ['customer/reception'] ] )?>
<?php
// echo "Timezone:" . date_default_timezone_get();
//echo date("Y-m-d H:i");
?>