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.

114 satır
5.1KB

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