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.

86 lines
2.9KB

  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. <?=
  16. GridView::widget([
  17. 'dataProvider' => $data_provider_commandes,
  18. 'summary' => '',
  19. 'beforeRow' => function($model) {
  20. $model->init() ;
  21. },
  22. 'columns' => [
  23. [
  24. 'attribute' => 'production.date',
  25. 'label' => 'Date de livraison',
  26. 'value' => function($model) {
  27. return date('d/m/Y', strtotime($model->production->date)) ;
  28. }
  29. ],
  30. [
  31. 'label' => 'Résumé',
  32. 'format' => 'raw',
  33. 'value' => function($model) {
  34. return $model->getResumePanier();
  35. }
  36. ],
  37. [
  38. 'label' => 'Point de vente',
  39. 'format' => 'raw',
  40. 'value' => function($model) {
  41. return $model->getResumePointVente();
  42. }
  43. ],
  44. [
  45. 'label' => 'Montant',
  46. 'format' => 'raw',
  47. 'value' => function($model) {
  48. return $model->getResumeMontant();
  49. }
  50. ],
  51. [
  52. 'label' => 'Statut',
  53. 'format' => 'raw',
  54. 'value' => function($c) {
  55. if($c->getEtat() == Commande::ETAT_LIVREE) {
  56. return 'Livrée' ;
  57. }
  58. elseif($c->getEtat() == Commande::ETAT_PREPARATION) {
  59. return 'En préparation' ;
  60. }
  61. elseif($c->getEtat() == Commande::ETAT_MODIFIABLE) {
  62. return '<div class="btn-group">
  63. <a href="'.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>
  64. <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
  65. <span class="caret"></span>
  66. <span class="sr-only">Toggle Dropdown</span>
  67. </button>
  68. <ul class="dropdown-menu" role="menu">
  69. <li><a href="'.Yii::$app->urlManager->createUrl(['commande/annuler','id'=>$c->id]).'"><span class="glyphicon glyphicon-trash"></span> Annuler la commande</a></li>
  70. </ul>
  71. </div>' ;
  72. }
  73. }
  74. ],
  75. ]
  76. ]);
  77. ?>