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 4.9KB

8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /* @var $this yii\web\View */
  3. use yii\helpers\Html;
  4. $this->title = 'Commande' ;
  5. ?>
  6. <div id="index-commande">
  7. <h1 class="title-systeme-commande"><img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/order.png" alt="" /> Tableau de bord</h1>
  8. <h2>Boulangeries</h2>
  9. <?php if(count($boulangeries)): ?>
  10. <div id="liste-boulangeries">
  11. <?php foreach($boulangeries as $b): ?>
  12. <div class="">
  13. <div class="panel panel-default">
  14. <div class="panel-heading">
  15. <h3 class="panel-title"><?php echo Html::encode($b['nom']); ?></h3>
  16. </div>
  17. <div class="panel-body">
  18. <?php if(strlen($b['logo'])): ?>
  19. <img class="logo" src="uploads/<?= Html::encode($b['logo']); ?>" />
  20. <?php endif; ?>
  21. <a class="btn btn-primary" href="<?= Yii::$app->urlManager->createUrl('commande/create') ?>">Commander</a>
  22. <?php //nl2br(Html::encode($b['description'])); ?>
  23. </div>
  24. </div>
  25. </div>
  26. <?php endforeach; ?>
  27. <div class="">
  28. <a class="btn btn-default" href="javascript:void(0);"><span class="glyphicon glyphicon-plus"></span> Ajouter une boulangerie</a>
  29. </div>
  30. </div>
  31. <div class="clr"></div>
  32. <?php else: ?>
  33. <div class="alert alert-info">Aucune boulangerie</div>
  34. <?php endif; ?>
  35. <!--<div class="accueil">
  36. <a class="btn btn-primary btn-lg" href="<?php echo Yii::$app->urlManager->createUrl(['commande/create']); ?>">Passer une commande</a>
  37. </div>-->
  38. <h2>Historique</h2>
  39. <?php if(count($commandes)): ?>
  40. <p>Retrouvez ici vos dernières commandes.</p>
  41. <?php if($commande_ok): ?>
  42. <div class="alert alert-success">
  43. <div class="icon"></div>
  44. Votre commande a bien été prise en compte !
  45. <?php if($pate_deja_petrie): ?>
  46. <br /><strong>Cette fournée étant déjà pétrie, la livraison se fera suivant les stocks disponibles. Merci pour votre compréhension.</strong>
  47. <?php endif; ?>
  48. </div>
  49. <?php endif; ?>
  50. <?php if($annule_ok): ?>
  51. <div class="alert alert-success"><div class="icon"></div>Votre commande a bien été annulée.</div>
  52. <?php endif; ?>
  53. <table id="historique-commandes" class="table table-striped table-bordered">
  54. <thead>
  55. <tr>
  56. <!-- <th>Date commande</th> -->
  57. <th>Date livraison</th>
  58. <th>Résumé</th>
  59. <th>Lieu</th>
  60. <th class="montant">Montant</th>
  61. <th class="statut"></th>
  62. </tr>
  63. </thead>
  64. <tbody>
  65. <?php foreach($commandes as $c): ?>
  66. <tr>
  67. <!-- <td><?php echo date('d/m/Y',strtotime($c->date)); ?></td> -->
  68. <td><?php echo date('d/m/Y',strtotime($c->production->date)); ?></td>
  69. <td class="resume"><?php
  70. $count = count($c->commandeProduits);
  71. $i = 0;
  72. foreach($c->commandeProduits as $p): ?>
  73. <?php if($p->produit->vrac): ?>
  74. <?php echo $p->quantite; ?>g de <?php echo Html::encode($p->produit->nom) ; ?><?php if(++$i != $count): ?>, <?php endif; ?>
  75. <?php else: ?>
  76. <?php echo $p->quantite; ?> x <?php echo Html::encode($p->produit->nom) ; ?><?php if(++$i != $count): ?>, <?php endif; ?>
  77. <?php endif; ?>
  78. <?php endforeach; ?></td>
  79. <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>
  80. <td class="montant"><?php echo number_format($c->montant,2) ; ?> €</td>
  81. <td class="statut">
  82. <?php
  83. if(date('H') > 20) {
  84. $date_limite = date('Y-m-d',strtotime(date('Y-m-d')) + 60*60*24) ;
  85. }
  86. else {
  87. $date_limite = date('Y-m-d') ;
  88. }
  89. ?>
  90. <?php if($c->production->date < date('Y-m-d') || ($c->production->date == date('Y-m-d') && date('H') > 13)): ?>Livrée
  91. <?php elseif($c->production->date <= $date_limite): ?>En cours de préparation
  92. <?php else: ?>
  93. <!-- <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>-->
  94. <div class="btn-group">
  95. <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>
  96. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  97. <span class="caret"></span>
  98. <span class="sr-only">Toggle Dropdown</span>
  99. </button>
  100. <ul class="dropdown-menu" role="menu">
  101. <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>
  102. </ul>
  103. </div>
  104. <?php endif; ?>
  105. </td>
  106. </tr>
  107. <?php endforeach; ?>
  108. </tbody>
  109. </table>
  110. <?php else: ?>
  111. <p>Vous n'avez pas encore passé de commandes</p>
  112. <?php endif; ?>
  113. </div>