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 年之前
8 年之前
8 年之前
8 年之前
8 年之前
8 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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"><?php
  75. $count = count($c->commandeProduits);
  76. $i = 0;
  77. foreach($c->commandeProduits as $p): ?>
  78. <?php if(isset($p->produit)): ?>
  79. <?php if($p->produit->vrac): ?>
  80. <?php echo $p->quantite; ?>g de <?php echo Html::encode($p->produit->nom) ; ?><?php if(++$i != $count): ?>, <?php endif; ?>
  81. <?php else: ?>
  82. <?php echo $p->quantite; ?> x <?php echo Html::encode($p->produit->nom) ; ?><?php if(++$i != $count): ?>, <?php endif; ?>
  83. <?php endif; ?>
  84. <?php endif; ?>
  85. <?php endforeach; ?></td>
  86. <td>
  87. <?php if(isset($c->pointVente)): ?>
  88. <?php echo '<span class="nom-point-vente">'.Html::encode($c->pointVente->nom) .'</span>'
  89. . '<br /><span class="localite">'.Html::encode($c->pointVente->localite).'</span>' ; ?>
  90. <?php if(strlen($c->commentaire_point_vente)): ?>
  91. <div class="commentaire"><span><?= Html::encode($c->commentaire_point_vente) ?></span></div>
  92. <?php endif; ?>
  93. <?php else: ?>
  94. Point de vente supprimé
  95. <?php endif; ?>
  96. </td>
  97. <td class="montant">
  98. <?php echo number_format($c->montant,2) ; ?> €<br />
  99. <?php if($c->montant_paye): ?>
  100. <?php if($c->getStatutPaiement() == Commande::STATUT_PAYEE): ?>
  101. <span class="label label-success">Payée</span>
  102. <?php elseif($c->getStatutPaiement() == Commande::STATUT_IMPAYEE): ?>
  103. <span class="label label-danger">Non payée</span><br />
  104. Reste <strong><?= $c->getMontantRestant(true); ?></strong> à payer
  105. <?php elseif($c->getStatutPaiement() == Commande::STATUT_SURPLUS): ?>
  106. <span class="label label-success">Payée</span>
  107. <?php endif; ?>
  108. <?php else: ?>
  109. <span class="label label-default">À régler sur place</span>
  110. <?php endif; ?>
  111. </td>
  112. <td class="statut">
  113. <?php
  114. if(date('H') > 20) {
  115. $date_limite = date('Y-m-d',strtotime(date('Y-m-d')) + 60*60*24) ;
  116. }
  117. else {
  118. $date_limite = date('Y-m-d') ;
  119. }
  120. ?>
  121. <?php if($c->production->date < date('Y-m-d') || ($c->production->date == date('Y-m-d') && date('H') > 13)): ?>Livrée
  122. <?php elseif($c->production->date <= $date_limite): ?>En cours de préparation
  123. <?php else: ?>
  124. <div class="btn-group">
  125. <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>
  126. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  127. <span class="caret"></span>
  128. <span class="sr-only">Toggle Dropdown</span>
  129. </button>
  130. <ul class="dropdown-menu" role="menu">
  131. <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>
  132. </ul>
  133. </div>
  134. <?php endif; ?>
  135. </td>
  136. </tr>
  137. <?php endforeach; ?>
  138. </tbody>
  139. </table>
  140. <?php else: ?>
  141. <div class="alert alert-info">Vous n'avez pas encore passé de commandes</div>
  142. <?php endif; ?>
  143. </div>