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.

258 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. <!-- commandes -->
  12. <div class="col-md-4">
  13. <div class="panel panel-default">
  14. <div class="panel-heading">
  15. <h3 class="panel-title">
  16. Commandes
  17. <?= Html::a('Voir', ['commande/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
  18. </h3>
  19. </div>
  20. <div class="panel-body">
  21. <?php if(count($productions)): ?>
  22. <p>Prochaines productions : </p>
  23. <table class="table table-bordered table-condensed">
  24. <thead>
  25. <tr>
  26. <th>Date</th>
  27. <th>Commandes</th>
  28. <th></th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. <?php foreach($productions as $p): ?>
  33. <tr>
  34. <td><?= date('d/m/Y',strtotime($p['date'])); ?></td>
  35. <td><?= count($p->commande); ?></td>
  36. <td>
  37. <?= Html::a('<span class="glyphicon glyphicon-eye-open"></span>', ['commande/index','date' => $p['date']], ['class' => 'btn btn-default btn-xs']) ; ?>
  38. <?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; ?>
  39. </td>
  40. </tr>
  41. <?php endforeach; ?>
  42. </tbody>
  43. </table>
  44. <?php else: ?>
  45. <div class="alert alert-warning">Aucune production de programmée.</div>
  46. <?php endif; ?>
  47. </div>
  48. </div>
  49. </div>
  50. <!-- produits -->
  51. <div class="col-md-4">
  52. <div class="panel panel-default">
  53. <div class="panel-heading">
  54. <h3 class="panel-title">
  55. <?= $nb_produits ?> produit<?php if($nb_produits > 1): ?>s<?php endif; ?>
  56. <?= Html::a('Ajouter',['produit/create'],['class' => 'btn btn-success btn-xs margin-left']) ; ?>
  57. <?= Html::a('Liste', ['produit/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
  58. </h3>
  59. </div>
  60. <div class="panel-body">
  61. <?php if($nb_points_vente): ?>
  62. <p>Derniers produits ajoutés :</p>
  63. <table class="table table-bordered table-condensed">
  64. <thead>
  65. <tr>
  66. <th>Nom</th>
  67. <th>Description</th>
  68. <th></th>
  69. </tr>
  70. </thead>
  71. <tbody>
  72. <?php foreach($produits as $p): ?>
  73. <tr>
  74. <td><?= Html::encode($p['nom']) ?></td>
  75. <td><?= Html::encode($p['description']) ?></td>
  76. <td><?= Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['produit/update','id' => $p['id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
  77. </tr>
  78. <?php endforeach; ?>
  79. </tbody>
  80. </table>
  81. <?php else: ?>
  82. <div class="alert alert-warning">Aucun produit.</div>
  83. <?php endif; ?>
  84. </div>
  85. </div>
  86. </div>
  87. <!-- Points de vente -->
  88. <div class="col-md-4">
  89. <div class="panel panel-default">
  90. <div class="panel-heading">
  91. <h3 class="panel-title">
  92. <?= $nb_points_vente ?> point<?php if($nb_points_vente > 1): ?>s<?php endif; ?> de vente
  93. <?= Html::a('Ajouter',['point-vente/create'],['class' => 'btn btn-success btn-xs margin-left']) ; ?>
  94. <?= Html::a('Liste', ['point-vente/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
  95. </h3>
  96. </div>
  97. <div class="panel-body">
  98. <?php if($nb_points_vente): ?>
  99. <p>Derniers points de vente ajoutés :</p>
  100. <table class="table table-bordered table-condensed">
  101. <thead>
  102. <tr>
  103. <th>Nom</th>
  104. <th>Localisation</th>
  105. <th></th>
  106. </tr>
  107. </thead>
  108. <tbody>
  109. <?php foreach($points_vente as $pv): ?>
  110. <tr>
  111. <td><?= Html::encode($pv['nom']) ?></td>
  112. <td><?= Html::encode($pv['localite']) ?></td>
  113. <td><?= Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['point-vente/update','id' => $pv['id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
  114. </tr>
  115. <?php endforeach; ?>
  116. </tbody>
  117. </table>
  118. <?php else: ?>
  119. <div class="alert alert-warning">Aucun point de vente.</div>
  120. <?php endif; ?>
  121. </div>
  122. </div>
  123. </div>
  124. <!-- Clients -->
  125. <div class="col-md-4">
  126. <div class="panel panel-default">
  127. <div class="panel-heading">
  128. <h3 class="panel-title">
  129. <?= $nb_clients; ?> client<?php if($nb_clients > 1): ?>s<?php endif; ?>
  130. <?= Html::a('Ajouter',['user/create'],['class' => 'btn btn-success btn-xs margin-left']) ; ?>
  131. <?= Html::a('Liste', ['user/index'], ['class' => 'btn btn-default btn-xs']) ; ?>
  132. </h3>
  133. </div>
  134. <div class="panel-body">
  135. <?php if($nb_clients): ?>
  136. <p>Dernières inscriptions :</p>
  137. <table class="table table-bordered table-condensed">
  138. <thead>
  139. <tr>
  140. <th>Prénom, nom</th>
  141. <th>Inscription</th>
  142. <th></th>
  143. </tr>
  144. </thead>
  145. <tbody>
  146. <?php foreach($clients as $c): ?>
  147. <tr>
  148. <td><?= Html::encode($c['prenom'].' '.$c['nom']) ?></td>
  149. <td><?= date('d/m/Y', $c['created_at']); ?></td>
  150. <td><?= Html::a('<span class="glyphicon glyphicon-pencil"></span>', ['user/update','id' => $c['user_id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
  151. </tr>
  152. <?php endforeach; ?>
  153. </tbody>
  154. </table>
  155. <?php else: ?>
  156. <div class="alert alert-warning">Aucun client.</div>
  157. <?php endif; ?>
  158. </div>
  159. </div>
  160. </div>
  161. <!-- Paramètres -->
  162. <div class="col-md-4">
  163. <div class="panel panel-default">
  164. <div class="panel-heading">
  165. <h3 class="panel-title">
  166. Paramètres
  167. <?= Html::a('Configurer',['etablissement/update'],['class' => 'btn btn-default btn-xs']) ; ?>
  168. </h3>
  169. </div>
  170. <div class="panel-body">
  171. <table class="table table-bordered table-condensed">
  172. <thead>
  173. <tr>
  174. <th>Configuration</th>
  175. <th>Valeur</th>
  176. </tr>
  177. </thead>
  178. <tbody>
  179. <tr>
  180. <td>Boulangerie activée</td>
  181. <td>
  182. <?php if($etablissement->actif): ?>
  183. <span class="label label-success">Active</span>
  184. <?php else: ?>
  185. <span class="label label-danger">Hors-ligne</span>
  186. <?php endif; ?>
  187. </td>
  188. </tr>
  189. <tr>
  190. <td>Boulangerie protégée par un code</td>
  191. <td>
  192. <?php if(strlen($etablissement->code)): ?>
  193. <span class="label label-success">Oui</span><br />
  194. <strong><?= Html::encode($etablissement->code) ?></strong>
  195. <?php else: ?>
  196. <span class="label label-danger">Non</span>
  197. <?php endif; ?>
  198. </td>
  199. </tr>
  200. <tr>
  201. <td>Délai de commande</td>
  202. <td><?= $etablissement->delai_commande ?> jour<?php if($etablissement->delai_commande > 1): ?>s<?php endif; ?></td>
  203. </tr>
  204. <tr>
  205. <td>Heure limite de commande</td>
  206. <td><?= $etablissement->heure_limite_commande ?>h</td>
  207. </tr>
  208. <tr>
  209. <td>Système de Crédit Pain activé</td>
  210. <td>
  211. <?php if($etablissement->credit_pain): ?>
  212. <span class="label label-success">Oui</span><br />
  213. <?php else: ?>
  214. <span class="label label-danger">Non</span>
  215. <?php endif; ?>
  216. </td>
  217. </tr>
  218. </tbody>
  219. </table>
  220. </div>
  221. </div>
  222. </div>
  223. <!-- Facturation -->
  224. <div class="col-md-4" id="facturation">
  225. <div class="panel panel-default">
  226. <div class="panel-heading">
  227. <h3 class="panel-title">
  228. Facturation
  229. <?= Html::a('Voir',['etablissement/facturation'],['class' => 'btn btn-default btn-xs']) ; ?>
  230. </h3>
  231. </div>
  232. <div class="panel-body">
  233. <div class="col-md-6 mois-en-cours">
  234. <h2>Chiffre d'affaire<br />du mois en cours</h2>
  235. <div class="montant"><span><?= number_format($etablissement->getCA(date('Y-m')), 2); ?> €</span></div>
  236. </div>
  237. <div class="col-md-6">
  238. <?php $montant = $etablissement->getMontantFacturer(date('Y-m'), 0); ?>
  239. <h2>Participation<br /><em>La boîte à pain</em> (2%)</h2>
  240. <div class="montant"><span><?php if($montant): echo number_format($montant,2).' €' ; else: echo 'Gratuit' ; endif; ?></span></div>
  241. </div>
  242. <div class="clr"></div>
  243. </div>
  244. </div>
  245. </div>
  246. </div>