|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?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"><img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/order.png" alt="" /> Tableau de bord</h1>
-
- <h2>Boulangeries</h2>
-
- <div id="liste-boulangeries">
- <!--<div id="bloc-liste-boulangeries" class="col-md-6">-->
- <?php if(count($etablissements)): ?>
- <?php foreach($etablissements as $e): ?>
- <div class="col-md-6">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <?php echo Html::encode($e['nom']); ?>
- <span class="localite"> - <?php echo Html::encode($e['ville']).' ('.Html::encode($e['code_postal']).')'; ?></span>
- <a href="<?= Yii::$app->urlManager->createUrl(['commande/remove-etablissement','id'=>$e['id']]); ?>" class="btn btn-xs btn-default remove"><span class="glyphicon glyphicon-remove"></span></a>
- </h3>
- </div>
- <div class="panel-body">
- <a class="btn btn-primary" href="<?= Yii::$app->urlManager->createUrl(['commande/create', 'id_etablissement' => $e['id']]) ?>">Commander</a>
- <?php if(strlen($e['logo'])): ?>
- <img class="logo" src="uploads/<?= Html::encode($e['logo']); ?>" />
- <?php endif; ?>
- </div>
- </div>
- </div>
- <?php endforeach; ?>
- <?php else: ?>
- <div class="alert alert-info">Aucune boulangerie</div>
- <?php endif; ?>
- </div>
- <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>-->
- <div class="clr"></div>
-
- <!--<div class="accueil">
- <a class="btn btn-primary btn-lg" href="<?php echo Yii::$app->urlManager->createUrl(['commande/create']); ?>">Passer une commande</a>
- </div>-->
-
- <h2>Historique</h2>
- <?php if(count($commandes)): ?>
-
- <p>Retrouvez ici vos dernières commandes.</p>
-
- <?php if($commande_ok): ?>
- <div class="alert alert-success">
- <div class="icon"></div>
- Votre commande a bien été prise en compte !
- <?php if($pate_deja_petrie): ?>
- <br /><strong>Cette fournée étant déjà pétrie, la livraison se fera suivant les stocks disponibles. Merci pour votre compréhension.</strong>
- <?php endif; ?>
- </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; ?>
-
- <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($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 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: ?>
- <!-- <a href="<?php echo Yii::$app->urlManager->createUrl(['commande/update','id'=>$c->id]) ; ?>" class="btn btn-default"><span class="glyphicon glyphicon-pencil"></span> Modifier</a>-->
- <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: ?>
- <p>Vous n'avez pas encore passé de commandes</p>
- <?php endif; ?>
-
- </div>
|