|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- /* @var $this yii\web\View */
-
- use yii\helpers\Html;
- use yii\bootstrap\ActiveForm;
-
- $this->title = 'Commande' ;
-
- ?>
-
- <div id="index-commande">
-
- <h1 class="title-systeme-commande"><span class="glyphicon glyphicon-th-list"></span> Tableau de bord</h1>
-
- <h2>Boulangeries</h2>
-
- <?php if($commande_ok): ?>
- <div class="alert alert-success">
- <div class="icon"></div>
- Votre commande a bien été prise en compte.
- </div>
- <?php endif; ?>
-
- <?php if($annule_ok): ?>
- <div class="alert alert-success"><div class="icon"></div>Votre commande a bien été annulée.</div>
- <?php endif; ?>
-
- <div id="liste-boulangeries">
-
- <?=
- $this->render('_liste_etablissements.php',[
- 'etablissements' => $etablissements,
- 'context' => 'index'
- ]) ;
- ?>
-
- <div class="col-md-6" id="bloc-add-etablissement">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title"><span class="glyphicon glyphicon-plus"></span> Ajouter une boulangerie</h3>
- </div>
- <div class="panel-body">
- <?php $form = ActiveForm::begin(['id' => 'form-add-boulanger','enableClientValidation'=> false]); ?>
- <?= $form->field($model_form_etablissement, 'id_etablissement')->label('')->dropDownList($data_etablissements_dispos, ['prompt' => '--','encode' => false,'options' => $options_etablissements_dispos]) ?>
- <?= Html::submitButton('<span class="glyphicon glyphicon-plus"></span> Ajouter', ['class' => 'btn btn-default', 'name' => 'add-etablissement-button']) ?>
- <?php ActiveForm::end(); ?>
- </div>
- </div>
- </div>
- <div class="clr"></div>
- </div>
-
- <h2>Historique</h2>
- <?php if(count($commandes)): ?>
-
- <p>Retrouvez ici vos dernières commandes.</p>
-
- <table id="historique-commandes" class="table table-striped table-bordered">
- <thead>
- <tr>
- <th>Boulangerie</th>
- <th>Date livraison</th>
- <th>Résumé</th>
- <th>Lieu</th>
- <th class="montant">Montant</th>
- <th class="statut"></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach($commandes as $c): ?>
- <tr>
- <td><?= Html::encode($c->production->etablissement->nom) ?></td>
- <td><?php echo date('d/m/Y',strtotime($c->production->date)); ?></td>
- <td class="resume"><?php
- $count = count($c->commandeProduits);
- $i = 0;
- foreach($c->commandeProduits as $p): ?>
- <?php if(isset($p->produit)): ?>
- <?php if($p->produit->vrac): ?>
- <?php echo $p->quantite; ?>g de <?php echo Html::encode($p->produit->nom) ; ?><?php if(++$i != $count): ?>, <?php endif; ?>
- <?php else: ?>
- <?php echo $p->quantite; ?> x <?php echo Html::encode($p->produit->nom) ; ?><?php if(++$i != $count): ?>, <?php endif; ?>
- <?php endif; ?>
- <?php endif; ?>
- <?php endforeach; ?></td>
- <td><?php echo '<span class="nom-point-vente">'.Html::encode($c->pointVente->nom) .'</span><br /><span class="localite">'.Html::encode($c->pointVente->localite).'</span>' ; ?></td>
- <td class="montant"><?php echo number_format($c->montant,2) ; ?> €</td>
- <td class="statut">
- <?php
- if(date('H') > 20) {
- $date_limite = date('Y-m-d',strtotime(date('Y-m-d')) + 60*60*24) ;
- }
- else {
- $date_limite = date('Y-m-d') ;
- }
- ?>
-
- <?php if($c->production->date < date('Y-m-d') || ($c->production->date == date('Y-m-d') && date('H') > 13)): ?>Livrée
-
- <?php elseif($c->production->date <= $date_limite): ?>En cours de préparation
- <?php else: ?>
- <div class="btn-group">
- <a href="<?php echo Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id, 'id_etablissement'=>$c->production->etablissement->id]) ; ?>" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
- <span class="caret"></span>
- <span class="sr-only">Toggle Dropdown</span>
- </button>
- <ul class="dropdown-menu" role="menu">
- <li><a href="<?php echo Yii::$app->urlManager->createUrl(['commande/annuler','id'=>$c->id]) ; ?>"><span class="glyphicon glyphicon-trash"></span> Annuler la commande</a></li>
- </ul>
- </div>
- <?php endif; ?>
- </td>
-
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- <?php else: ?>
- <div class="alert alert-info">Vous n'avez pas encore passé de commandes</div>
- <?php endif; ?>
-
- </div>
|