@@ -78,7 +78,7 @@ class SiteController extends BackendController | |||
} | |||
], | |||
[ | |||
'actions' => ['change-etablissement'], | |||
'actions' => ['change-producer'], | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { |
@@ -105,10 +105,12 @@ class StatsController extends BackendController | |||
'params' => [':date' => $dateStart] | |||
]) ; | |||
foreach ($ordersArray as $order) { | |||
$month = date('m/Y', strtotime($order->distribution->date)); | |||
if (isset($data[$month])) { | |||
$data[$month] += $order->amount; | |||
if($ordersArray) { | |||
foreach ($ordersArray as $order) { | |||
$month = date('m/Y', strtotime($order->distribution->date)); | |||
if (isset($data[$month])) { | |||
$data[$month] += $order->amount; | |||
} | |||
} | |||
} | |||
@@ -104,10 +104,10 @@ class SubscriptionController extends BackendController | |||
{ | |||
$dataProvider = new ActiveDataProvider([ | |||
'query' => Subscription::find() | |||
->with(['user', 'producer', 'pointSale', 'productSubscription']) | |||
->joinWith(['user']) | |||
->where(['subscription.id_producer' => Producer::getId()]) | |||
->orderBy('subscription.id_point_sale ASC, CASE `subscription`.`username` WHEN "" THEN `user`.`name` ELSE `subscription`.`username` END ASC'), | |||
->with(['user', 'producer', 'pointSale', 'productSubscription', 'productSubscription.product']) | |||
->joinWith(['user']) | |||
->where(['subscription.id_producer' => Producer::getId()]) | |||
->orderBy('subscription.id_point_sale ASC, CASE `subscription`.`username` WHEN "" THEN `user`.`name` ELSE `subscription`.`username` END ASC'), | |||
'pagination' => [ | |||
'pageSize' => 1000, | |||
], |
@@ -37,6 +37,10 @@ termes. | |||
*/ | |||
use yii\helpers\Html; | |||
use common\models\Producer; | |||
use common\models\User; | |||
use yii\widgets\ActiveForm; | |||
use yii\helpers\ArrayHelper; | |||
/* @var $this \yii\web\View */ | |||
/* @var $content string */ | |||
@@ -309,9 +313,26 @@ use yii\helpers\Html; | |||
</li> | |||
<!-- User Account: style can be found in dropdown.less --> | |||
<li> | |||
<li class="link-control-sidebar"> | |||
<a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a> | |||
</li> | |||
<?php if (User::isCurrentProducer() || User::isCurrentAdmin()): ?> | |||
<li class="dropdown"> | |||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> | |||
<span><?= Html::encode(Yii::$app->user->identity->getNameProducer()); ?></span> | |||
</a> | |||
<?php if(User::isCurrentAdmin()): ?> | |||
<ul class="dropdown-menu"> | |||
<?php $producersArray = Producer::find()->orderBy('name ASC')->all(); ?> | |||
<?php foreach($producersArray as $producer): ?> | |||
<li><a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/change-producer', 'id' => $producer->id]); ?>"><?= Html::encode($producer->name) ?></a></li> | |||
<?php endforeach; ?> | |||
</ul> | |||
<?php endif; ?> | |||
</li> | |||
<?php endif; ?> | |||
</ul> | |||
</div> | |||
</nav> |
@@ -259,7 +259,7 @@ $this->title = 'Tableau de bord'; | |||
</h3> | |||
</div> | |||
<div class="panel-body"> | |||
<?php if(count($ordersArray)): ?> | |||
<?php if(is_array($ordersArray) && count($ordersArray)): ?> | |||
<table class="table table-condensed table-bordered"> | |||
<thead> | |||
<tr> |
@@ -81,7 +81,12 @@ $this->params['breadcrumbs'][] = $this->title; | |||
$html = '' ; | |||
foreach($model->productSubscription as $productSubscription) | |||
{ | |||
$html .= $productSubscription->quantity . ' x '.Html::encode($productSubscription->product->name).'<br />' ; | |||
if(isset($productSubscription->product)) { | |||
$html .= $productSubscription->quantity . ' x '.Html::encode($productSubscription->product->name).'<br />' ; | |||
} | |||
else { | |||
$html .= 'Produit non défini<br />' ; | |||
} | |||
} | |||
// aucun produit |
@@ -1387,3 +1387,8 @@ a:hover, a:focus, a:active { | |||
.stats-products td.align-center { | |||
text-align: center; | |||
} | |||
/* line 3, ../sass/_adminlte.scss */ | |||
.main-header .messages-menu, .main-header .notifications-menu, .main-header .tasks-menu, .main-header .user-menu, .main-header .link-control-sidebar { | |||
display: none; | |||
} |
@@ -0,0 +1,6 @@ | |||
.main-header { | |||
.messages-menu, .notifications-menu, .tasks-menu, .user-menu, .link-control-sidebar { | |||
display: none ; | |||
} | |||
} |
@@ -1366,4 +1366,6 @@ a { | |||
td.align-center { | |||
text-align: center ; | |||
} | |||
} | |||
} | |||
@import "_adminlte.scss" ; |