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.

index.php 14KB

8 yıl önce
8 yıl önce
8 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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>Historique</th>
  232. <th>Date</th>
  233. <th>Client</th>
  234. <th>Produits</th>
  235. <th>Point de vente</th>
  236. <th>Montant</th>
  237. </tr>
  238. </thead>
  239. <tbody>
  240. <?php foreach($commandes as $c): ?>
  241. <tr class="<?= $c->getClassHistorique() ; ?>">
  242. <td class="infos"><?= $c->getStrType(true); ?></td>
  243. <td class="historique"><?= $c->getStrHistorique() ; ?></td>
  244. <td class="date">
  245. <div class="bloc-date">
  246. <div class="jour"><?= strftime('%A', strtotime($c->production->date)) ?></div>
  247. <div class="num"><?= date('d', strtotime($c->production->date)) ?></div>
  248. <div class="mois"><?= strftime('%B', strtotime($c->production->date)) ?></div>
  249. </div>
  250. </td>
  251. <td>
  252. <?= $c->getStrUser(); ?><br />
  253. </td>
  254. <td><?= $c->getResumePanier() ; ?></td>
  255. <td><?= $c->getResumePointVente() ; ?></td>
  256. <td><?= $c->getStrMontant() ; ?></td>
  257. </tr>
  258. <?php endforeach; ?>
  259. </tbody>
  260. </table>
  261. <?php else: ?>
  262. <div class="alert alert-warning">Aucune commande</div>
  263. <?php endif; ?>
  264. </div>
  265. </div>
  266. </div>
  267. </div>
  268. </div>