|
- <?php
- /* @var $this yii\web\View */
-
- use yii\helpers\Html;
- use yii\bootstrap\ActiveForm;
- use common\models\Commande ;
-
- $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
- ]) ; ?>
-
-
- <div id="bloc-code-acces">
- <?= $form->field($model_form_etablissement, 'code',[
- 'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
-
- ])
- ->label('Code')
- ->hint('Renseignez-vous auprès de votre boulangerie pour qu\'elle vous fournisse le code d\'accès') ; ?>
- </div>
- <?= Html::submitButton('<span class="glyphicon glyphicon-plus"></span> Valider', ['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"><?= $c->getResumePanier() ; ?></td>
- <td><?= $c->getResumePointVente(); ?></td>
- <td class="montant"><?= $c->getResumeMontant(); ?></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>
|