您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

248 行
16KB

  1. <?php
  2. use yii\helpers\Html;
  3. use common\models\Commande;
  4. use common\models\User ;
  5. use yii\helpers\ArrayHelper ;
  6. use yii\widgets\ActiveForm;
  7. $this->title = 'Commande';
  8. $cpt_non_vrac = 0;
  9. foreach ($produits as $p) {
  10. if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']) {
  11. if (!$p->vrac) {
  12. $cpt_non_vrac ++;
  13. }
  14. }
  15. }
  16. ?>
  17. <div id="page-commande">
  18. <div id="row1">
  19. <div class="col-md-3">
  20. <div class="panel panel-default">
  21. <div class="panel-heading">
  22. <h3 class="panel-title">Calendrier</h3>
  23. </div>
  24. <div class="panel-body">
  25. <?php
  26. // chargement assets
  27. common\components\fullcalendar\FullcalendarWidget::widget();
  28. // --> lancement du js en manuel (via lechatdesnoisettes.js)
  29. ?>
  30. <div id="calendar"></div>
  31. </div>
  32. </div>
  33. </div>
  34. <?php if ($date != ''): ?>
  35. <div class="col-md-5" id="bloc-production">
  36. <input type="hidden" id="date-production" value="<?= $date ?>" />
  37. <div class="panel panel-default">
  38. <div class="panel-heading">
  39. <?php if (!count($commandes)): ?><span class="label label-danger">Aucune commande</span>
  40. <?php else: ?><span class="label label-success"><?= count($commandes) ?> commande<?php if(count($commandes) > 1): ?>s<?php endif; ?></span>
  41. <?php endif; ?>
  42. <h3 class="panel-title">Production du <strong><?php echo date('d/m/Y', strtotime($date)); ?></strong></h3>
  43. </div>
  44. <div class="panel-body">
  45. <strong>Production</strong><br />
  46. <div class="btn-group" role="group">
  47. <a class="btn btn-default<?php if ($production->actif): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state', 'date' => $date, 'actif' => 1]); ?>">Activé</a>
  48. <a class="btn btn-default<?php if (!$production->actif): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-state', 'date' => $date, 'actif' => 0]); ?>">Désactivé</a>
  49. </div>
  50. <br />
  51. <br />
  52. <?php if ($production->actif): ?>
  53. <strong>Livraison</strong><br />
  54. <div class="btn-group" role="group">
  55. <a class="btn btn-default<?php if ($production->livraison): ?> btn-success<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 1]); ?>">Activé</a>
  56. <a class="btn btn-default<?php if (!$production->livraison): ?> btn-danger<?php endif; ?>" href="<?php echo Yii::$app->urlManager->createUrl(['commande/change-livraison', 'date' => $date, 'livraison' => 0]); ?>">Désactivé</a>
  57. </div>
  58. <?php endif; ?>
  59. </div>
  60. </div>
  61. </div>
  62. <?php endif; ?>
  63. <?php if ($production): ?>
  64. <div id="bloc-produits" class="col-md-4">
  65. <div class="panel panel-default">
  66. <div class="panel-heading">
  67. <h3 class="panel-title">Produits</h3>
  68. </div>
  69. <div class="panel-body">
  70. <!-- produits sélectionnés -->
  71. <form id="produits-production" action="<?php echo Yii::$app->urlManager->createUrl(['commande/index', 'date' => $date]); ?>" method="post">
  72. <div class="overflow">
  73. <table class="table table-condensed">
  74. <thead>
  75. <tr>
  76. <th class="td-actif">Actif</th>
  77. <th class="td-produit">Produit</th>
  78. <th class="td-max">Max.</th>
  79. </tr>
  80. </thead>
  81. <tbody>
  82. <?php foreach ($produits as $p): ?>
  83. <tr<?php if ($p->vrac): ?> style="display:none;"<?php endif; ?> <?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>class="active"<?php endif; ?>>
  84. <td class="td-actif"><input id="produit-<?php echo $p->id; ?>" name="Produit[<?php echo $p->id; ?>][actif]" type="checkbox" <?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>checked="checked"<?php endif; ?> /></td>
  85. <td class="td-produit"><label for="produit-<?php echo $p->id; ?>"><?= Html::encode($p->nom) ?></label></td>
  86. <td class="td-max"><input class="quantite-max" name="Produit[<?php echo $p->id; ?>][quantite_max]" type="text" value="<?php if (isset($produits_selec[$p->id])) echo $produits_selec[$p->id]['quantite_max']; ?>" /></td>
  87. </tr>
  88. <?php endforeach; ?>
  89. </tbody>
  90. </table>
  91. </div>
  92. <input type="submit" name="valider_produit_selec" class="btn btn-default" value="Valider" />
  93. </form>
  94. </div>
  95. </div>
  96. </div>
  97. <?php endif; ?>
  98. </div>
  99. <div id="row2" class="col-md-12">
  100. <input type="hidden" value="<?php echo $date; ?>" id="current-date" />
  101. <ul id="jours-production">
  102. <?php foreach ($jours_production as $j) : ?>
  103. <li><?php echo $j->date; ?></li>
  104. <?php endforeach; ?>
  105. </ul>
  106. <?php if ($date != ''): ?>
  107. <?php
  108. $num_jour_semaine = date('w', strtotime($date));
  109. $arr_jour_semaine = [0 => 'dimanche', 1 => 'lundi', 2 => 'mardi', 3 => 'mercredi', 4 => 'jeudi', 5 => 'vendredi', 6 => 'samedi'];
  110. $champs_horaires_point_vente = 'horaires_' . $arr_jour_semaine[$num_jour_semaine];
  111. ?>
  112. <div class="panel panel-default">
  113. <div class="panel-heading">
  114. <h3 class="panel-title">
  115. Commandes
  116. <?php if (count($commandes)): ?>
  117. <a id="btn-export-commandes" class="btn btn-primary" href="<?php echo Yii::$app->urlManager->createUrl(['commande/report', 'date' => $date, 'id_point_vente' => 0, 'global' => 1]); ?>"><span class="glyphicon glyphicon-download-alt"></span> Exporter</a>
  118. <?php endif; ?>
  119. <a id="btn-commande-auto" class="btn btn-default" href="<?php echo Yii::$app->urlManager->createUrl(['commandeauto/index']); ?>"><span class="glyphicon glyphicon-repeat"></span> Commandes automatiques</a>
  120. </h3>
  121. </div>
  122. <div class="panel-body">
  123. <div class="col-md-9">
  124. <!-- Nav tabs -->
  125. <ul class="nav nav-tabs" role="tablist">
  126. <?php foreach($points_vente as $pv): ?>
  127. <li role="presentation" class="<?php if($pv->point_fabrication): ?>active<?php endif; ?>">
  128. <a href="#point-vente-<?= $pv->id ?>" id="btn-point-vente-<?= $pv->id ?>" aria-controls="point-vente-<?= $pv->id ?>" role="tab" data-toggle="tab"><?= Html::encode($pv->nom) ?> <span class="badge badge-<?php if(count($pv->commandes)): ?>success<?php else: ?>danger<?php endif; ?>"><?php echo count($pv->commandes); ?></span></a>
  129. </li>
  130. <?php endforeach; ?>
  131. </ul>
  132. <!-- Tab panes -->
  133. <div class="tab-content" id="commandes-points-vente">
  134. <?php foreach($points_vente as $pv): ?>
  135. <div role="tabpanel" data-id-pv="<?= $pv->id ?>" class="bloc-point-vente tab-pane <?php if($pv->point_fabrication): ?> active<?php endif; ?>" id="point-vente-<?= $pv->id ?>">
  136. <div class="col-md-4">
  137. <div class="alert alert-warning recap-pv <?php if(!count($pv->commandes)): ?>no-commande<?php endif; ?>">
  138. <?php if(count($pv->commandes)): ?>
  139. <strong class="commandes"><?= count($pv->commandes) ?> commande<?php if(count($pv->commandes) > 1): ?>s<?php endif; ?></strong>
  140. <span class="recettes"><?= number_format($pv->recettes, 2) ?> €</span>
  141. <?php else: ?>
  142. <strong class="commandes">Aucune commande</strong>
  143. <span class="recettes"></span>
  144. <?php endif; ?>
  145. </div>
  146. <ul class="liste-commandes btn-group-vertical">
  147. <?php foreach($pv->commandes as $c): ?>
  148. <li>
  149. <a href="javascript:void(0);" class="btn btn-default" data-pv-id="<?= $pv->id ?>" data-id-commande="<?= $c->id ?>" data-commande='<?= $pv->data_options_commandes[$c->id]['data-commande'] ?>' data-commentaire="<?= Html::encode($c->commentaire) ?>" data-date="<?= date('d/m à H:i',strtotime($c->date)); ?>">
  150. <span class="montant"><?= Html::encode(number_format($c->montant, 2)); ?> €</span>
  151. <span class="user">
  152. <?php if(isset($c->user)): ?>
  153. <?= Html::encode($c->user->nom.' '.$c->user->prenom); ?>
  154. <?php else: ?>
  155. <?= Html::encode($c->username); ?>
  156. <?php endif; ?>
  157. </span>
  158. <?php if (strlen($c->commentaire)): ?>
  159. <span class="glyphicon glyphicon-comment"></span>
  160. <?php endif; ?>
  161. </a>
  162. </li>
  163. <?php endforeach; ?>
  164. </ul>
  165. <?= Html::a('<span class="glyphicon glyphicon-plus"></span> Créer une commande', 'javascript:void(0);', ['class' => 'btn btn-default creer-commande', 'data-pv-id' => $pv->id]) ?>
  166. </div>
  167. <div class="col-md-8">
  168. <h2 class="title-user">
  169. <span class="buttons-edit-remove">
  170. <?= Html::a('<span class="glyphicon glyphicon-trash"></span> Supprimer', 'javascript:void(0);', ['class' => 'btn btn-default btn-remove']) ?>
  171. <?= Html::a('<span class="glyphicon glyphicon-pencil"></span> Modifier', 'javascript:void(0);', ['class' => 'btn btn-default btn-edit']) ?>
  172. </span>
  173. <span class="buttons-save-cancel">
  174. <?= Html::a('<span class="glyphicon glyphicon-ok"></span> Sauvegarder', 'javascript:void(0);', ['class' => 'btn btn-primary btn-save']) ?>
  175. <?= Html::a('<span class="glyphicon glyphicon-remove"></span> Annuler', 'javascript:void(0);', ['class' => 'btn btn-default btn-cancel']) ?>
  176. </span>
  177. <span class="the-title"></span>
  178. <span class="choix-user">
  179. <?= Html::activeDropDownList(new User, 'id', ArrayHelper::map(User::find()->joinWith('userEtablissement')->where('user_etablissement.id_etablissement = '.Yii::$app->user->identity->id_etablissement)->all(), 'id', function($model, $defaultValue) {
  180. return $model['nom'].' '.$model['prenom'];
  181. }), ['prompt' => '--','class' => 'form-control user-id']) ?>
  182. OU <input type="text" class="form-control username" placeholder="Choisissez un nom" />
  183. </span>
  184. </h2>
  185. <div class="commentaire alert alert-info">
  186. </div>
  187. <table class="table table-bordered table-condensed tab-content table-produits">
  188. <tbody>
  189. <?php foreach ($produits as $p): ?>
  190. <?php if (isset($produits_selec[$p->id]['actif']) && $produits_selec[$p->id]['actif']): ?>
  191. <tr class="produit-<?= $p->id ?>" data-id-produit="<?= $p->id ?>">
  192. <td class="td-commande"></td>
  193. <td class="td-produit"><?php echo Html::encode($p->getLibelleAdmin()); ?></td>
  194. </tr>
  195. <?php endif; ?>
  196. <?php endforeach; ?>
  197. <tr class="tr-total">
  198. <td class="td-total"></td>
  199. <td></td>
  200. </tr>
  201. </tbody>
  202. </table>
  203. </div>
  204. </div>
  205. <?php endforeach; ?>
  206. </div>
  207. </div>
  208. <div class="col-md-3" id="bloc-totaux">
  209. <?= $this->render('_total_commandes.php',[
  210. 'produits' => $produits,
  211. 'commandes' => $commandes,
  212. 'produits_selec' => $produits_selec,
  213. 'recettes_pain' => $recettes_pain,
  214. 'poids_pain' => $poids_pain,
  215. 'ca_potentiel' => $ca_potentiel,
  216. 'poids_total' => $poids_total,
  217. ]); ?>
  218. </div>
  219. </div>
  220. </div>
  221. <div class="clr"></div>
  222. <?php endif; ?>
  223. </div>
  224. </div>