add backend transfer list changes
This commit is contained in:
@@ -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 );
|
||||
|
||||
24
frontend/components/ReceptionCardNumberTicketsWidget.php
Normal file
24
frontend/components/ReceptionCardNumberTicketsWidget.php
Normal 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 ]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
36
frontend/components/ReceptionWidget.php
Normal file
36
frontend/components/ReceptionWidget.php
Normal 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 ]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user