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.

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