add default account to frontend

This commit is contained in:
2015-10-26 07:49:10 +01:00
parent 0c92fdf167
commit 01da3c470c
45 changed files with 948 additions and 220 deletions

View File

@@ -28,7 +28,7 @@ class FrontendMenuStructure{
if ( $this->isLogged() ){
$lastAccountState = AccountState::find()->andWhere(['id_user' => Yii::$app->user->id])->orderBy(['account_state.created_at' => SORT_DESC])->limit(1)->one();
if ( isset($lastAccountState) ){
$this->start = strtotime( $lastAccountState->created_at . ' UTC' );
$this->start = Yii::$app->formatter->asDatetime(strtotime( $lastAccountState->created_at . ' UTC' ));
}
}
@@ -60,6 +60,7 @@ class FrontendMenuStructure{
$this->menuItems[] = ['label' => 'Pénzmozgások', 'url' => [ '/money-movement/index', 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow ] ];
$this->menuItems[] = ['label' => 'Kassza',
'items' => [
['label' => Yii::t('frontend/account-state','Default account'), 'url' => ['/account/select'] ],
['label' => Yii::t('frontend/account-state', 'Account states'), 'url' => ['/account-state/index'] ],
['label' => Yii::t('frontend/account-state','Open account state'), 'url' => ['/account-state/open'] ],
['label' => Yii::t('frontend/account-state','Close account state'), 'url' => ['/account-state/close'] ],

View File

@@ -17,9 +17,10 @@ class HtmlHelper{
* @see ReceptionCardNumberWidget
* @see ReceptionMenuWidget
* */
public static function mkReceptionCardBtn($card, $label,$route = null ){
public static function mkReceptionCardBtn($recptionForm, $label,$route = null ){
$url = null;
$card = $recptionForm->card;
$classes = 'btn btn-primary btn-reception';
if ( $card == null ){
$classes .= ' disabled';
@@ -29,10 +30,25 @@ class HtmlHelper{
}
return Html::a( $label , $url, ['class' => $classes ] );
}
public static function mkReceptionBtn($card, $label,$route = null ){
public static function mkReceptionCustomerBtn($recptionForm, $label,$route = null ){
$url = null;
$card = $recptionForm->card;
$customer = $recptionForm->customer;
$classes = 'btn btn-primary btn-reception';
if ( $card == null || $customer == null){
$classes .= ' disabled';
}
if ( isset($route)){
$url = [$route, 'number' => ( isset( $card ) ? $card->number : '' )];
}
return Html::a( $label , $url, ['class' => $classes ] );
}
public static function mkReceptionBtn($recptionForm, $label,$route = null ){
$url = null;
$card = $recptionForm->card;
$classes = 'btn btn-primary btn-reception';
if ( isset($route)){

View File

@@ -8,14 +8,12 @@ class ReceptionCardNumberWidget extends Widget{
public $number;
public $route;
public $customer;
public $card;
public $viewFile = '//common/_form_card_number';
public $model;
public $viewFile = '//common/_reception_form_card_number';
public function run(){
echo $this->render($this->viewFile,['card' => $this->card, 'customer' =>$this->customer , 'route' => $this->route ]);
echo $this->render($this->viewFile,['model' => $this->model, 'route' => $this->route ]);
}

View File

@@ -0,0 +1,22 @@
<?php
namespace frontend\components;
use yii\base\Widget;
/**
* This is the model class for table "customer".
*
* @property string $viewFile
* @property common\models\ReceptionForm $model
* */
class ReceptionCustomerWidget extends Widget{
public $viewFile = '//common/_reception_customer';
public $model;
public function run(){
echo $this->render($this->viewFile,[ 'model' => $this->model ]);
}
}

View File

@@ -11,11 +11,12 @@ class ReceptionMenuWidget extends Widget{
public $customer;
public $card;
public $viewFile = '//common/_menu_reception';
public $viewFile = '//common/_reception_menu';
public $model;
public function run(){
echo $this->render($this->viewFile,['card' => $this->card, 'customer' =>$this->customer ]);
echo $this->render($this->viewFile,[ 'model' => $this->model ]);
}

View File

@@ -0,0 +1,22 @@
<?php
namespace frontend\components;
use yii\base\Widget;
/**
* This is the model class for table "customer".
*
* @property string $viewFile
* @property common\models\ReceptionForm $model
* */
class ReceptionTicketWidget extends Widget{
public $viewFile = '//common/_reception_ticket';
public $model;
public function run(){
echo $this->render($this->viewFile,[ 'model' => $this->model ]);
}
}

View File

@@ -10,26 +10,17 @@ class ReceptionWidget extends Widget{
public $number;
public $route;
public $customer;
public $card;
public $tickets;
public $viewFile = '//common/_reception';
public function init(){
parent::init();
if ( isset($this->form)){
$this->card = $this->form->card;
$this->customer = $this->form->customer;
$this->tickets = $this->form->tickets;
}
}
public function run(){
echo $this->render($this->viewFile,['card' => $this->card, 'customer' =>$this->customer, 'tickets' => $this->tickets ]);
echo $this->render($this->viewFile,[ 'model' => $this->form ]);
}