Browse Source

Select changement de producteur

refactoring
Guillaume Bourgeois 6 years ago
parent
commit
53d39b0d2b
10 changed files with 54 additions and 13 deletions
  1. +1
    -1
      backend/controllers/SiteController.php
  2. +6
    -4
      backend/controllers/StatsController.php
  3. +4
    -4
      backend/controllers/SubscriptionController.php
  4. +22
    -1
      backend/views/layouts/header.php
  5. +1
    -1
      backend/views/site/index.php
  6. +6
    -1
      backend/views/subscription/index.php
  7. BIN
      backend/web/.sass-cache/2a0ffb00578c9d5a537db16d14c734a22b18f35c/screen.scssc
  8. +5
    -0
      backend/web/css/screen.css
  9. +6
    -0
      backend/web/sass/_adminlte.scss
  10. +3
    -1
      backend/web/sass/screen.scss

+ 1
- 1
backend/controllers/SiteController.php View File

@@ -78,7 +78,7 @@ class SiteController extends BackendController
}
],
[
'actions' => ['change-etablissement'],
'actions' => ['change-producer'],
'allow' => true,
'roles' => ['@'],
'matchCallback' => function ($rule, $action) {

+ 6
- 4
backend/controllers/StatsController.php View File

@@ -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;
}
}
}


+ 4
- 4
backend/controllers/SubscriptionController.php View File

@@ -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,
],

+ 22
- 1
backend/views/layouts/header.php View File

@@ -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>

+ 1
- 1
backend/views/site/index.php View File

@@ -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>

+ 6
- 1
backend/views/subscription/index.php View File

@@ -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

BIN
backend/web/.sass-cache/2a0ffb00578c9d5a537db16d14c734a22b18f35c/screen.scssc View File


+ 5
- 0
backend/web/css/screen.css View File

@@ -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;
}

+ 6
- 0
backend/web/sass/_adminlte.scss View File

@@ -0,0 +1,6 @@

.main-header {
.messages-menu, .notifications-menu, .tasks-menu, .user-menu, .link-control-sidebar {
display: none ;
}
}

+ 3
- 1
backend/web/sass/screen.scss View File

@@ -1366,4 +1366,6 @@ a {
td.align-center {
text-align: center ;
}
}
}

@import "_adminlte.scss" ;

Loading…
Cancel
Save