add product sell discount js changes

This commit is contained in:
2015-10-20 17:23:52 +02:00
parent 1a1477b26b
commit f2e30779f0
10 changed files with 165 additions and 90 deletions

View File

@@ -4,15 +4,41 @@ namespace frontend\components;
use Yii;
use common\models\Order;
use yii\helpers\Html;
use common\models\MoneyMovement;
use yii\db\Query;
use common\models\AccountState;
class FrontendMenuStructure{
public $menuItems;
public $start;
public $tomorrow;
public function FrontendMenuStructure(){
public function __construct(){
$this->menuItems = [];
// print('abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>abcd<br>');
$this->start = Yii::$app->formatter->asDatetime( strtotime('today UTC') );
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
Yii::info("Start date is : ". $this->start);
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' );
}
}
// print_r($this->start);
// print_r($this->tomorrow);
}
protected function can($authItem){
$result = false;
if (\Yii::$app->user->can($authItem)) {
@@ -30,7 +56,8 @@ class FrontendMenuStructure{
protected function addRecepcio(){
if ( $this->isLogged() ){
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
$this->menuItems[] = ['label' => 'Pénzmozgások', 'url' => ['/money-movement/index'] ];
// , 'MoneyMovementSearch[start]' => $this->start, 'MoneyMovementSearch[end]' => $this->tomorrow
$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', 'Account states'), 'url' => ['/account-state/index'] ],