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.

286 satır
14KB

  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. <!-- Clients crédit pain négatif -->
  89. <div class="">
  90. <div class="panel panel-default">
  91. <div class="panel-heading">
  92. <h3 class="panel-title">
  93. Clients au crédit pain négatif
  94. </h3>
  95. </div>
  96. <div class="panel-body">
  97. <?php if(count($clients_credit_pain_negatif)): ?>
  98. <p>Dernières inscriptions :</p>
  99. <table class="table table-bordered table-condensed">
  100. <thead>
  101. <tr>
  102. <th>Prénom, nom</th>
  103. <th>Crédit pain</th>
  104. </tr>
  105. </thead>
  106. <tbody>
  107. <?php foreach($clients_credit_pain_negatif as $c): ?>
  108. <tr>
  109. <td><?= Html::encode($c['prenom'].' '.$c['nom']) ?></td>
  110. <td><?= number_format($c['credit'],2) ?></td>
  111. <td><?= Html::a('<span class="glyphicon glyphicon-euro"></span>', ['user/credit','id' => $c['user_id']], ['class' => 'btn btn-default btn-xs']) ; ?></td>
  112. </tr>
  113. <?php endforeach; ?>
  114. </tbody>
  115. </table>
  116. <?php else: ?>
  117. <div class="alert alert-warning">Aucun client.</div>
  118. <?php endif; ?>
  119. </div>
  120. </div>
  121. </div>
  122. <!-- Paramètres -->
  123. <div class="">
  124. <div class="panel panel-default">
  125. <div class="panel-heading">
  126. <h3 class="panel-title">
  127. Paramètres
  128. <?= Html::a('Configurer',['etablissement/update'],['class' => 'btn btn-default btn-xs']) ; ?>
  129. </h3>
  130. </div>
  131. <div class="panel-body">
  132. <table class="table table-bordered table-condensed">
  133. <thead>
  134. <tr>
  135. <th>Configuration</th>
  136. <th>Valeur</th>
  137. </tr>
  138. </thead>
  139. <tbody>
  140. <tr>
  141. <td>Établissement activé</td>
  142. <td>
  143. <?php if($etablissement->actif): ?>
  144. <span class="label label-success">Active</span>
  145. <?php else: ?>
  146. <span class="label label-danger">Hors-ligne</span>
  147. <?php endif; ?>
  148. </td>
  149. </tr>
  150. <tr>
  151. <td>Établissement protégé par un code</td>
  152. <td>
  153. <?php if(strlen($etablissement->code)): ?>
  154. <span class="label label-success">Oui</span><br />
  155. <strong><?= Html::encode($etablissement->code) ?></strong>
  156. <?php else: ?>
  157. <span class="label label-danger">Non</span>
  158. <?php endif; ?>
  159. </td>
  160. </tr>
  161. <tr>
  162. <td>Délai de commande</td>
  163. <td><?= $etablissement->delai_commande ?> jour<?php if($etablissement->delai_commande > 1): ?>s<?php endif; ?></td>
  164. </tr>
  165. <tr>
  166. <td>Heure limite de commande</td>
  167. <td><?= $etablissement->heure_limite_commande ?>h</td>
  168. </tr>
  169. <tr>
  170. <td>Système de Crédit Pain activé</td>
  171. <td>
  172. <?php if($etablissement->credit_pain): ?>
  173. <span class="label label-success">Oui</span><br />
  174. <?php else: ?>
  175. <span class="label label-danger">Non</span>
  176. <?php endif; ?>
  177. </td>
  178. </tr>
  179. </tbody>
  180. </table>
  181. </div>
  182. </div>
  183. </div>
  184. <!-- Facturation -->
  185. <div class="" id="facturation">
  186. <div class="panel panel-default">
  187. <div class="panel-heading">
  188. <h3 class="panel-title">
  189. Facturation
  190. <?= Html::a('Voir',['etablissement/facturation'],['class' => 'btn btn-default btn-xs']) ; ?>
  191. </h3>
  192. </div>
  193. <div class="panel-body">
  194. <div class="col-md-12">
  195. <?php if(is_null($etablissement->prix_libre)): ?>
  196. <h2>Prix libre</h2>
  197. <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>
  198. <?php else: ?>
  199. <h2><?= $etablissement->getPrixLibre() ?> / mois <?= Html::a('Modifier',['etablissement/facturation'],['class' => 'btn btn-xs btn-primary']) ?></h2>
  200. <?php endif; ?>
  201. </div>
  202. <!--<div class="col-md-6 mois-en-cours">
  203. <h2>Chiffre d'affaire<br />du mois en cours</h2>
  204. <div class="montant"><span><?= number_format($etablissement->getCA(date('Y-m')), 2); ?> €</span></div>
  205. </div>
  206. <div class="col-md-6">
  207. <?php $montant = $etablissement->getMontantFacturer(date('Y-m'), 0); ?>
  208. <h2>Participation<br /><em>La boîte à pain</em> (2%)</h2>
  209. <div class="montant"><span><?php if($montant): echo number_format($montant,2).' €' ; else: echo 'Gratuit' ; endif; ?></span></div>
  210. </div>
  211. <div class="clr"></div>-->
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="col-md-8">
  217. <!-- dernières commandes -->
  218. <div id="dernieres-commandes" class="">
  219. <div class="panel panel-default">
  220. <div class="panel-heading">
  221. <h3 class="panel-title">
  222. Dernières commandes clients
  223. </h3>
  224. </div>
  225. <div class="panel-body">
  226. <?php if(count($commandes)): ?>
  227. <table class="table table-condensed table-bordered">
  228. <thead>
  229. <tr>
  230. <th></th>
  231. <th>Date</th>
  232. <th>Client</th>
  233. <th>Produits</th>
  234. <th>Point de vente</th>
  235. <th>Montant</th>
  236. </tr>
  237. </thead>
  238. <tbody>
  239. <?php foreach($commandes as $c): ?>
  240. <tr>
  241. <td><?= $c->getStrType(true); ?></td>
  242. <td class="date">
  243. <div class="bloc-date">
  244. <div class="jour"><?= strftime('%A', strtotime($c->production->date)) ?></div>
  245. <div class="num"><?= date('d', strtotime($c->production->date)) ?></div>
  246. <div class="mois"><?= strftime('%B', strtotime($c->production->date)) ?></div>
  247. </div>
  248. </td>
  249. <td>
  250. <?= $c->getStrUser(); ?><br />
  251. <span class="small">Le <?= date('d/m/Y à G\hi', strtotime($c->date)) ?></span>
  252. </td>
  253. <td><?= $c->getResumePanier() ; ?></td>
  254. <td><?= $c->getResumePointVente() ; ?></td>
  255. <td><?= $c->getStrMontant() ; ?></td>
  256. </tr>
  257. <?php endforeach; ?>
  258. </tbody>
  259. </table>
  260. <?php else: ?>
  261. <div class="alert alert-warning">Aucune commande</div>
  262. <?php endif; ?>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. </div>