Browse Source

Merge branch 'feature/backend/divers_tableau_bord' into dev

refactoring
Guillaume Bourgeois 6 years ago
parent
commit
eb71973fda
2 changed files with 14 additions and 16 deletions
  1. +12
    -13
      backend/controllers/SiteController.php
  2. +2
    -3
      backend/views/site/index.php

+ 12
- 13
backend/controllers/SiteController.php View File

public function actionIndex() { public function actionIndex() {
// commandes // commandes
$productions = Production::find() $productions = Production::find()
->with('commande')
->where(['>=', 'production.date', date('Y-m-d')])
->andWhere([
'production.id_etablissement' => Yii::$app->user->identity->id_etablissement,
'production.actif' => 1
])
->orderBy('date ASC')
->limit(5)
->all();
->with('commande')
->where(['>=', 'production.date', date('Y-m-d')])
->andWhere([
'production.id_etablissement' => Yii::$app->user->identity->id_etablissement,
'production.actif' => 1
])
->orderBy('date ASC')
->limit(5)
->all();


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


foreach ($commandes as $c) foreach ($commandes as $c)
$c->init(); $c->init();

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

</div> </div>
<div class="panel-body"> <div class="panel-body">
<?php if(count($clients_credit_pain_negatif)): ?> <?php if(count($clients_credit_pain_negatif)): ?>
<p>Dernières inscriptions :</p>
<table class="table table-bordered table-condensed"> <table class="table table-bordered table-condensed">
<thead> <thead>
<tr> <tr>
<thead> <thead>
<tr> <tr>
<th></th> <th></th>
<th>Historique</th>
<th>Date</th> <th>Date</th>
<th>Client</th> <th>Client</th>
<th>Historique</th>
<th>Produits</th> <th>Produits</th>
<th>Point de vente</th> <th>Point de vente</th>
<th>Montant</th> <th>Montant</th>
<?php foreach($commandes as $c): ?> <?php foreach($commandes as $c): ?>
<tr class="<?= $c->getClassHistorique() ; ?>"> <tr class="<?= $c->getClassHistorique() ; ?>">
<td class="infos"><?= $c->getStrType(true); ?></td> <td class="infos"><?= $c->getStrType(true); ?></td>
<td class="historique"><?= $c->getStrHistorique() ; ?></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>
<td> <td>
<?= $c->getStrUser(); ?><br /> <?= $c->getStrUser(); ?><br />
</td> </td>
<td class="historique"><?= $c->getStrHistorique() ; ?></td>
<td><?= $c->getResumePanier() ; ?></td> <td><?= $c->getResumePanier() ; ?></td>
<td><?= $c->getResumePointVente() ; ?></td> <td><?= $c->getResumePointVente() ; ?></td>
<td><?= $c->getStrMontant() ; ?></td> <td><?= $c->getStrMontant() ; ?></td>

Loading…
Cancel
Save