Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

248 lines
12KB

  1. <?php
  2. /* @var $this yii\web\View */
  3. use yii\helpers\Html ;
  4. $this->title = 'Tableau de bord';
  5. ?>
  6. <div class="site-index">
  7. <?php if(Yii::$app->request->get('erreur_produits_points_vente')): ?>
  8. <div class="alert alert-danger">Vous devez saisir vos produits et vos points de vente
  9. avant d'initialiser vos jours de production.</div>
  10. <?php endif; ?>
  11. <div class="col-md-4">
  12. <!-- commandes -->
  13. <div class="">
  14. <div class="panel panel-default">
  15. <div class="panel-heading">
  16. <h3 class="panel-title">
  17. Commandes
  18. <?= Html::a('Voir', ['commande/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
  19. </h3>
  20. </div>
  21. <div class="panel-body">
  22. <?php if(count($productions)): ?>
  23. <p>Prochaines productions : </p>
  24. <table class="table table-bordered table-condensed">
  25. <thead>
  26. <tr>
  27. <th>Date</th>
  28. <th>Commandes</th>
  29. <th></th>
  30. </tr>
  31. </thead>
  32. <tbody>
  33. <?php foreach($productions as $p): ?>
  34. <tr>
  35. <td><?= date('d/m/Y',strtotime($p['date'])); ?></td>
  36. <td><?= count($p->commande); ?></td>
  37. <td>
  38. <?= Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['commande/index','date' => $p['date']], ['class' => 'btn btn-default btn-xs']) ; ?>
  39. <?php if(count($p->commande)): ?><?= Html::a('<span class="glyphicon glyphicon-download-alt"></span>', ['commande/report','date' => $p['date'],'global' => 1], ['class' => 'btn btn-default btn-xs']) ; ?><?php endif; ?>
  40. </td>
  41. </tr>
  42. <?php endforeach; ?>
  43. </tbody>
  44. </table>
  45. <?php else: ?>
  46. <div class="alert alert-warning">Aucune production de programmée.</div>
  47. <?php endif; ?>
  48. </div>
  49. </div>
  50. </div>
  51. <!-- Clients -->
  52. <div class="">
  53. <div class="panel panel-default">
  54. <div class="panel-heading">
  55. <h3 class="panel-title">
  56. <?= $nb_clients; ?> client<?php if($nb_clients > 1): ?>s<?php endif; ?>
  57. <?= Html::a('Ajouter',['user/create'],['class' => 'btn btn-success btn-xs margin-left']) ; ?>
  58. <?= Html::a('Liste', ['user/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
  59. </h3>
  60. </div>
  61. <div class="panel-body">
  62. <?php if($nb_clients): ?>
  63. <p>Dernières inscriptions :</p>
  64. <table class="table table-bordered table-condensed">
  65. <thead>
  66. <tr>
  67. <th>Prénom, nom</th>
  68. <th>Inscription</th>
  69. <th></th>
  70. </tr>
  71. </thead>
  72. <tbody>
  73. <?php foreach($clients as $c): ?>
  74. <tr>
  75. <td><?= Html::encode($c['prenom'].' '.$c['nom']) ?></td>
  76. <td><?= date('d/m/Y', $c['created_at']); ?></td>
  77. <td><?= Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['user/update','id' => $c['user_id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
  78. </tr>
  79. <?php endforeach; ?>
  80. </tbody>
  81. </table>
  82. <?php else: ?>
  83. <div class="alert alert-warning">Aucun client.</div>
  84. <?php endif; ?>
  85. </div>
  86. </div>
  87. </div>
  88. <!-- Paramètres -->
  89. <div class="">
  90. <div class="panel panel-default">
  91. <div class="panel-heading">
  92. <h3 class="panel-title">
  93. Paramètres
  94. <?= Html::a('Configurer',['etablissement/update'],['class' => 'btn btn-default btn-xs']) ; ?>
  95. </h3>
  96. </div>
  97. <div class="panel-body">
  98. <table class="table table-bordered table-condensed">
  99. <thead>
  100. <tr>
  101. <th>Configuration</th>
  102. <th>Valeur</th>
  103. </tr>
  104. </thead>
  105. <tbody>
  106. <tr>
  107. <td>Établissement activé</td>
  108. <td>
  109. <?php if($etablissement->actif): ?>
  110. <span class="label label-success">Active</span>
  111. <?php else: ?>
  112. <span class="label label-danger">Hors-ligne</span>
  113. <?php endif; ?>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td>Établissement protégé par un code</td>
  118. <td>
  119. <?php if(strlen($etablissement->code)): ?>
  120. <span class="label label-success">Oui</span><br />
  121. <strong><?= Html::encode($etablissement->code) ?></strong>
  122. <?php else: ?>
  123. <span class="label label-danger">Non</span>
  124. <?php endif; ?>
  125. </td>
  126. </tr>
  127. <tr>
  128. <td>Délai de commande</td>
  129. <td><?= $etablissement->delai_commande ?> jour<?php if($etablissement->delai_commande > 1): ?>s<?php endif; ?></td>
  130. </tr>
  131. <tr>
  132. <td>Heure limite de commande</td>
  133. <td><?= $etablissement->heure_limite_commande ?>h</td>
  134. </tr>
  135. <tr>
  136. <td>Système de Crédit Pain activé</td>
  137. <td>
  138. <?php if($etablissement->credit_pain): ?>
  139. <span class="label label-success">Oui</span><br />
  140. <?php else: ?>
  141. <span class="label label-danger">Non</span>
  142. <?php endif; ?>
  143. </td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. </div>
  148. </div>
  149. </div>
  150. <!-- Facturation -->
  151. <div class="" id="facturation">
  152. <div class="panel panel-default">
  153. <div class="panel-heading">
  154. <h3 class="panel-title">
  155. Facturation
  156. <?= Html::a('Voir',['etablissement/facturation'],['class' => 'btn btn-default btn-xs']) ; ?>
  157. </h3>
  158. </div>
  159. <div class="panel-body">
  160. <div class="col-md-12">
  161. <?php if(is_null($etablissement->prix_libre)): ?>
  162. <h2>Prix libre</h2>
  163. <p>Le modèle économique de <em>La boîte à pain</em> est basé sur un système de prix libre. <?= Html::a('En savoir plus',['etablissement/facturation']); ?></p>
  164. <?php else: ?>
  165. <h2><?= $etablissement->getPrixLibre() ?> / mois <?= Html::a('Modifier',['etablissement/facturation'],['class' => 'btn btn-xs btn-primary']) ?></h2>
  166. <?php endif; ?>
  167. </div>
  168. <!--<div class="col-md-6 mois-en-cours">
  169. <h2>Chiffre d'affaire<br />du mois en cours</h2>
  170. <div class="montant"><span><?= number_format($etablissement->getCA(date('Y-m')), 2); ?> €</span></div>
  171. </div>
  172. <div class="col-md-6">
  173. <?php $montant = $etablissement->getMontantFacturer(date('Y-m'), 0); ?>
  174. <h2>Participation<br /><em>La boîte à pain</em> (2%)</h2>
  175. <div class="montant"><span><?php if($montant): echo number_format($montant,2).' €' ; else: echo 'Gratuit' ; endif; ?></span></div>
  176. </div>
  177. <div class="clr"></div>-->
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="col-md-8">
  183. <!-- dernières commandes -->
  184. <div id="dernieres-commandes" class="">
  185. <div class="panel panel-default">
  186. <div class="panel-heading">
  187. <h3 class="panel-title">
  188. Dernières commandes clients
  189. </h3>
  190. </div>
  191. <div class="panel-body">
  192. <?php if(count($commandes)): ?>
  193. <table class="table table-condensed table-bordered">
  194. <thead>
  195. <tr>
  196. <th>Date</th>
  197. <th>Client</th>
  198. <th>Produits</th>
  199. <th>Point de vente</th>
  200. <th>Montant</th>
  201. </tr>
  202. </thead>
  203. <tbody>
  204. <?php foreach($commandes as $c): ?>
  205. <tr>
  206. <td class="date">
  207. <div class="bloc-date">
  208. <div class="jour"><?= strftime('%A', strtotime($c->production->date)) ?></div>
  209. <div class="num"><?= date('d', strtotime($c->production->date)) ?></div>
  210. <div class="mois"><?= strftime('%B', strtotime($c->production->date)) ?></div>
  211. </div>
  212. </td>
  213. <td>
  214. <?= $c->getStrUser(); ?><br />
  215. <span class="small">Le <?= date('d/m/Y à G\hi', strtotime($c->date)) ?></span>
  216. </td>
  217. <td><?= $c->getResumePanier() ; ?></td>
  218. <td><?= $c->getResumePointVente() ; ?></td>
  219. <td><?= $c->getStrMontant() ; ?></td>
  220. </tr>
  221. <?php endforeach; ?>
  222. </tbody>
  223. </table>
  224. <?php else: ?>
  225. <div class="alert alert-warning">Aucune commande</div>
  226. <?php endif; ?>
  227. </div>
  228. </div>
  229. </div>
  230. </div>
  231. </div>