add backend transfer list changes

This commit is contained in:
2015-10-13 09:27:56 +02:00
parent fda450b801
commit b04cbda645
20 changed files with 677 additions and 222 deletions

View File

@@ -9,6 +9,39 @@ use yii\helpers\ArrayHelper;
class HtmlHelper{
/**
* Mehtod used in reception widgets to render card dependent buttons
*
* @see ReceptionCardNumberTicketsWidget
* @see ReceptionCardNumberWidget
* @see ReceptionMenuWidget
* */
public static function mkReceptionCardBtn($card, $label,$route = null ){
$url = null;
$classes = 'btn btn-primary btn-reception';
if ( $card == null ){
$classes .= ' disabled';
}
if ( isset($route)){
$url = [$route, 'number' => ( isset( $card ) ? $card->number : '' )];
}
return Html::a( $label , $url, ['class' => $classes ] );
}
public static function mkReceptionBtn($card, $label,$route = null ){
$url = null;
$classes = 'btn btn-primary btn-reception';
if ( isset($route)){
$url = [$route, 'number' => ( isset( $card ) ? $card->number : '' )];
}
return Html::a( $label , $url, ['class' => $classes ] );
}
public static function mkOptions( $models, $key, $value = 'name' ){
$result = [];
$result = ArrayHelper::map( $models, $key, $value );

View File

@@ -0,0 +1,24 @@
<?php
namespace frontend\components;
use yii\base\Widget;
class ReceptionCardNumberTicketsWidget extends Widget{
public $number;
public $route;
public $customer;
public $card;
public $tickets;
public $viewFile = '//common/_card_number_tickets';
public function run(){
echo $this->render($this->viewFile,[ 'tickets' => $this->tickets, 'card' => $this->card, 'customer' =>$this->customer , 'route' => $this->route ]);
}
}

View File

@@ -0,0 +1,36 @@
<?php
namespace frontend\components;
use yii\base\Widget;
class ReceptionWidget extends Widget{
public $form;
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 ]);
}
}