Browse Source

Select changement de producteur

refactoring
Guillaume Bourgeois 5 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

} }
], ],
[ [
'actions' => ['change-etablissement'],
'actions' => ['change-producer'],
'allow' => true, 'allow' => true,
'roles' => ['@'], 'roles' => ['@'],
'matchCallback' => function ($rule, $action) { 'matchCallback' => function ($rule, $action) {

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

'params' => [':date' => $dateStart] '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

{ {
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => Subscription::find() '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' => [ 'pagination' => [
'pageSize' => 1000, 'pageSize' => 1000,
], ],

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

*/ */


use yii\helpers\Html; 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 $this \yii\web\View */
/* @var $content string */ /* @var $content string */
</li> </li>


<!-- User Account: style can be found in dropdown.less --> <!-- 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> <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
</li> </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> </ul>
</div> </div>
</nav> </nav>

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

</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<?php if(count($ordersArray)): ?>
<?php if(is_array($ordersArray) && count($ordersArray)): ?>
<table class="table table-condensed table-bordered"> <table class="table table-condensed table-bordered">
<thead> <thead>
<tr> <tr>

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

$html = '' ; $html = '' ;
foreach($model->productSubscription as $productSubscription) 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 // aucun produit

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


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

.stats-products td.align-center { .stats-products td.align-center {
text-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


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

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

td.align-center { td.align-center {
text-align: center ; text-align: center ;
} }
}
}

@import "_adminlte.scss" ;

Loading…
Cancel
Save