You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.php 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. /* @var $this yii\web\View */
  3. use yii\helpers\Html;
  4. use yii\bootstrap\ActiveForm;
  5. use common\models\Commande ;
  6. $this->title = 'Commande' ;
  7. ?>
  8. <div id="index-commande">
  9. <h1 class="title-systeme-commande"><span class="glyphicon glyphicon-th-list"></span> Tableau de bord</h1>
  10. <h2>Boulangeries</h2>
  11. <?php if($commande_ok): ?>
  12. <div class="alert alert-success">
  13. <div class="icon"></div>
  14. Votre commande a bien été prise en compte.
  15. </div>
  16. <?php endif; ?>
  17. <?php if($annule_ok): ?>
  18. <div class="alert alert-success"><div class="icon"></div>Votre commande a bien été annulée.</div>
  19. <?php endif; ?>
  20. <div id="liste-boulangeries">
  21. <?=
  22. $this->render('_liste_etablissements.php',[
  23. 'etablissements' => $etablissements,
  24. 'context' => 'index'
  25. ]) ;
  26. ?>
  27. <div class="col-md-6" id="bloc-add-etablissement">
  28. <div class="panel panel-default">
  29. <div class="panel-heading">
  30. <h3 class="panel-title"><span class="glyphicon glyphicon-plus"></span> Ajouter une boulangerie</h3>
  31. </div>
  32. <div class="panel-body">
  33. <?php $form = ActiveForm::begin(['id' => 'form-add-boulanger','enableClientValidation'=> false]); ?>
  34. <?= $form->field($model_form_etablissement, 'id_etablissement')
  35. ->label('')
  36. ->dropDownList($data_etablissements_dispos,
  37. ['prompt' => '--',
  38. 'encode' => false,
  39. 'options' => $options_etablissements_dispos
  40. ]) ; ?>
  41. <div id="bloc-code-acces">
  42. <?= $form->field($model_form_etablissement, 'code',[
  43. 'inputTemplate' => '<div class="input-group"><span class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>{input}</div>',
  44. ])
  45. ->label('Code')
  46. ->hint('Renseignez-vous auprès de votre boulangerie pour qu\'elle vous fournisse le code d\'accès') ; ?>
  47. </div>
  48. <?= Html::submitButton('<span class="glyphicon glyphicon-plus"></span> Valider', ['class' => 'btn btn-default', 'name' => 'add-etablissement-button']) ?>
  49. <?php ActiveForm::end(); ?>
  50. </div>
  51. </div>
  52. </div>
  53. <div class="clr"></div>
  54. </div>
  55. <h2>Historique</h2>
  56. <?php if(count($commandes)): ?>
  57. <p>Retrouvez ici vos dernières commandes.</p>
  58. <table id="historique-commandes" class="table table-striped table-bordered">
  59. <thead>
  60. <tr>
  61. <th>Boulangerie</th>
  62. <th>Date livraison</th>
  63. <th>Résumé</th>
  64. <th>Lieu</th>
  65. <th class="montant">Montant</th>
  66. <th class="statut"></th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. <?php foreach($commandes as $c): ?>
  71. <tr>
  72. <td><?= Html::encode($c->production->etablissement->nom) ?></td>
  73. <td><?php echo date('d/m/Y',strtotime($c->production->date)); ?></td>
  74. <td class="resume"><?= $c->getResumePanier() ; ?></td>
  75. <td><?= $c->getResumePointVente(); ?></td>
  76. <td class="montant"><?= $c->getResumeMontant(); ?></td>
  77. <td class="statut">
  78. <?php
  79. if(date('H') > 20) {
  80. $date_limite = date('Y-m-d',strtotime(date('Y-m-d')) + 60*60*24) ;
  81. }
  82. else {
  83. $date_limite = date('Y-m-d') ;
  84. }
  85. ?>
  86. <?php if($c->production->date < date('Y-m-d') || ($c->production->date == date('Y-m-d') && date('H') > 13)): ?>Livrée
  87. <?php elseif($c->production->date <= $date_limite): ?>En cours de préparation
  88. <?php else: ?>
  89. <div class="btn-group">
  90. <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>
  91. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  92. <span class="caret"></span>
  93. <span class="sr-only">Toggle Dropdown</span>
  94. </button>
  95. <ul class="dropdown-menu" role="menu">
  96. <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>
  97. </ul>
  98. </div>
  99. <?php endif; ?>
  100. </td>
  101. </tr>
  102. <?php endforeach; ?>
  103. </tbody>
  104. </table>
  105. <?php else: ?>
  106. <div class="alert alert-info">Vous n'avez pas encore passé de commandes</div>
  107. <?php endif; ?>
  108. </div>