Browse Source

Backend : classement commandes récurrentes

Classement des commandes récurrentes par point de vente et par nom d'utilisateur.
master
keun 8 years ago
parent
commit
59316a9b69
2 changed files with 7 additions and 4 deletions
  1. +4
    -2
      backend/controllers/CommandeautoController.php
  2. +3
    -2
      backend/views/commandeauto/index.php

+ 4
- 2
backend/controllers/CommandeautoController.php View File

{ {
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => CommandeAuto::find() 'query' => CommandeAuto::find()
->with('user', 'etablissement', 'pointVente','commandeAutoProduit')
->where(['id_etablissement'=>Yii::$app->user->identity->id_etablissement]),
->with(['user','etablissement', 'pointVente','commandeAutoProduit'])
->joinWith(['user'])
->where(['commande_auto.id_etablissement' => Yii::$app->user->identity->id_etablissement])
->orderBy('commande_auto.id_point_vente ASC, CASE `commande_auto`.`username` WHEN "" THEN `user`.`nom` ELSE `commande_auto`.`username` END ASC'),
'pagination' => [ 'pagination' => [
'pageSize' => 1000, 'pageSize' => 1000,
], ],

+ 3
- 2
backend/views/commandeauto/index.php View File

'attribute' => 'id_user', 'attribute' => 'id_user',
'format' => 'raw', 'format' => 'raw',
'value' => function($model) { 'value' => function($model) {
//print_r($model) ;
if(strlen($model->username)) if(strlen($model->username))
{ {
return Html::encode($model->username) ; return Html::encode($model->username) ;
} }
else { else {
return Html::encode($model->user->nom.' '.$model->user->prenom) ;
if(isset($model->user))
return Html::encode($model->user->nom.' '.$model->user->prenom) ;
} }
} }
], ],
[ [

Loading…
Cancel
Save