Browse Source

[Backend] Tableau de bord : ajout des commandes ajoutées par les producteurs

Les commandes listées sur le tableau de bord comprennent désormais les commandes ajoutées par le producteur et celles effectuées directement par les clients.
prodstable
keun 6 years ago
parent
commit
202b9db9ea
3 changed files with 28 additions and 3 deletions
  1. +1
    -2
      backend/controllers/SiteController.php
  2. +2
    -0
      backend/views/site/index.php
  3. +25
    -1
      common/models/Commande.php

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

// dernières commandes // dernières commandes
$commandes = Commande::findBy([ $commandes = Commande::findBy([
'type' => Commande::TYPE_USER,
'orderby' => 'date DESC', 'orderby' => 'date DESC',
'limit' => 15, 'limit' => 15,
'condition' => 'production.date > \''.date('Y-m-d 00:00:00').'\''
'condition' => 'production.date > \''.date('Y-m-d 00:00:00').'\' AND (type = \''.Commande::TYPE_USER.'\' OR type = \''.Commande::TYPE_ADMIN.'\')'
]) ; ]) ;
foreach($commandes as $c) foreach($commandes as $c)

+ 2
- 0
backend/views/site/index.php View File

<table class="table table-condensed table-bordered"> <table class="table table-condensed table-bordered">
<thead> <thead>
<tr> <tr>
<th></th>
<th>Date</th> <th>Date</th>
<th>Client</th> <th>Client</th>
<th>Produits</th> <th>Produits</th>
<tbody> <tbody>
<?php foreach($commandes as $c): ?> <?php foreach($commandes as $c): ?>
<tr> <tr>
<td><?= $c->getStrType(true); ?></td>
<td class="date"> <td class="date">
<div class="bloc-date"> <div class="bloc-date">
<div class="jour"><?= strftime('%A', strtotime($c->production->date)) ?></div> <div class="jour"><?= strftime('%A', strtotime($c->production->date)) ?></div>

+ 25
- 1
common/models/Commande.php View File

if(isset($params['date'])) if(isset($params['date']))
$commandes = $commandes->andWhere(['production.date' => $params['date']]); $commandes = $commandes->andWhere(['production.date' => $params['date']]);
if(isset($params['type']))
if(isset($params['type']))
$commandes = $commandes->andWhere(['commande.type' => $params['type']]); $commandes = $commandes->andWhere(['commande.type' => $params['type']]);
if(isset($params['orderby'])) if(isset($params['orderby']))
$commandes = $commandes->orderBy($params['orderby']); $commandes = $commandes->orderBy($params['orderby']);
return self::ETAT_PREPARATION ; return self::ETAT_PREPARATION ;
} }
public function getStrType($with_label = false) {
$class_label = '' ;
$str = '' ;
if($this->type == self::TYPE_USER) {
$class_label = 'success' ;
$str = 'Client' ;
}
elseif($this->type == self::TYPE_AUTO) {
$class_label = 'default' ;
$str = 'Auto' ;
}
elseif($this->type == self::TYPE_ADMIN) {
$class_label = 'warning' ;
$str = 'Vous' ;
}
if($with_label)
return '<span class="label label-'.$class_label.'">'.$str.'</span>' ;
else
return $str ;
}
} }

Loading…
Cancel
Save