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
// 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) |
<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> |
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 ; | |||||
} | |||||
} | } |