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

@@ -109,22 +109,21 @@ class SiteController extends BackendController {
public function actionIndex() {
// commandes
$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
$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)
$c->init();

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

@@ -137,7 +137,6 @@ $this->title = 'Tableau de bord';
</div>
<div class="panel-body">
<?php if(count($clients_credit_pain_negatif)): ?>
<p>Dernières inscriptions :</p>
<table class="table table-bordered table-condensed">
<thead>
<tr>
@@ -277,9 +276,9 @@ $this->title = 'Tableau de bord';
<thead>
<tr>
<th></th>
<th>Historique</th>
<th>Date</th>
<th>Client</th>
<th>Historique</th>
<th>Produits</th>
<th>Point de vente</th>
<th>Montant</th>
@@ -289,7 +288,6 @@ $this->title = 'Tableau de bord';
<?php foreach($commandes as $c): ?>
<tr class="<?= $c->getClassHistorique() ; ?>">
<td class="infos"><?= $c->getStrType(true); ?></td>
<td class="historique"><?= $c->getStrHistorique() ; ?></td>
<td class="date">
<div class="bloc-date">
<div class="jour"><?= strftime('%A', strtotime($c->production->date)) ?></div>
@@ -300,6 +298,7 @@ $this->title = 'Tableau de bord';
<td>
<?= $c->getStrUser(); ?><br />
</td>
<td class="historique"><?= $c->getStrHistorique() ; ?></td>
<td><?= $c->getResumePanier() ; ?></td>
<td><?= $c->getResumePointVente() ; ?></td>
<td><?= $c->getStrMontant() ; ?></td>

Loading…
Cancel
Save