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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <?php
  2. use backend\assets\AppAsset;
  3. use yii\helpers\Html;
  4. use yii\bootstrap\Nav;
  5. use yii\bootstrap\NavBar;
  6. use yii\widgets\Breadcrumbs;
  7. use common\models\Etablissement;
  8. use common\models\User;
  9. use yii\widgets\ActiveForm;
  10. use yii\helpers\ArrayHelper;
  11. use common\helpers\Url;
  12. /* @var $this \yii\web\View */
  13. /* @var $content string */
  14. AppAsset::register($this);
  15. ?>
  16. <?php $this->beginPage() ?>
  17. <!DOCTYPE html>
  18. <html lang="<?= Yii::$app->language ?>">
  19. <head>
  20. <meta charset="<?= Yii::$app->charset ?>">
  21. <meta name="viewport" content="width=device-width, initial-scale=1">
  22. <link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon3.png" />
  23. <?= Html::csrfMetaTags() ?>
  24. <title><?= Html::encode($this->title) ?> - La boîte à pain</title>
  25. <?php $this->head() ?>
  26. </head>
  27. <body>
  28. <?php $this->beginBody() ?>
  29. <div class="wrap">
  30. <?php
  31. NavBar::begin([
  32. 'brandLabel' => '<img class="logo" src="' . Yii::$app->urlManager->getBaseUrl() . '/img/laboulange3.png" />',
  33. 'brandUrl' => Yii::$app->homeUrl,
  34. 'innerContainerOptions' => ['class' => 'container-fluid'],
  35. 'options' => [
  36. 'class' => 'navbar-inverse navbar-fixed-top nav-header',
  37. ],
  38. ]);
  39. $menuItems = [
  40. [
  41. 'label' => '<span class="glyphicon glyphicon-home"></span> Tableau de bord',
  42. 'url' => ['/site/index'],
  43. 'visible' => !Yii::$app->user->isGuest
  44. ],
  45. [
  46. 'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes',
  47. 'url' => ['/commande/index'],
  48. 'visible' => !Yii::$app->user->isGuest,
  49. 'items' => [
  50. [
  51. 'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
  52. 'url' => ['/commande/index'],
  53. 'visible' => !Yii::$app->user->isGuest
  54. ],
  55. [
  56. 'label' => '<span class="glyphicon glyphicon-repeat"></span> Commandes récurrentes',
  57. 'url' => ['/commandeauto/index'],
  58. 'visible' => !Yii::$app->user->isGuest
  59. ],
  60. ]
  61. ],
  62. [
  63. 'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
  64. 'url' => ['/produit/index'],
  65. 'visible' => !Yii::$app->user->isGuest
  66. ],
  67. [
  68. 'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
  69. 'url' => ['/point-vente/index'],
  70. 'visible' => !Yii::$app->user->isGuest
  71. ],
  72. [
  73. 'label' => '<span class="glyphicon glyphicon-user"></span> Clients',
  74. 'url' => ['/user/index'],
  75. 'visible' => !Yii::$app->user->isGuest
  76. ],
  77. [
  78. 'label' => '<span class="glyphicon glyphicon-plus"></span>',
  79. 'url' => ['/etablissement/update'],
  80. 'visible' => !Yii::$app->user->isGuest,
  81. 'items' => [
  82. [
  83. 'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
  84. 'url' => ['/etablissement/update'],
  85. 'visible' => !Yii::$app->user->isGuest
  86. ],
  87. [
  88. 'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
  89. 'url' => ['/communiquer/index'],
  90. 'visible' => !Yii::$app->user->isGuest
  91. ],
  92. [
  93. 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
  94. 'url' => ['/etablissement/facturation'],
  95. 'visible' => !Yii::$app->user->isGuest,
  96. ],
  97. [
  98. 'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques',
  99. 'url' => ['/stats/index'],
  100. 'visible' => !Yii::$app->user->isGuest,
  101. ],
  102. [
  103. 'label' => '<span class="glyphicon glyphicon-wrench"></span> Développement',
  104. 'url' => ['/developpement/index'],
  105. 'visible' => !Yii::$app->user->isGuest
  106. ],
  107. ],
  108. ]
  109. ];
  110. if (Yii::$app->user->isGuest) {
  111. $menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
  112. } else {
  113. if (Yii::$app->user->identity->status == USER::STATUS_ADMIN) {
  114. $menuItems[] = [
  115. 'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
  116. 'url' => '#',
  117. 'items' => [
  118. [
  119. 'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs',
  120. 'url' => ['etablissement-admin/index'],
  121. 'visible' => !Yii::$app->user->isGuest,
  122. ],
  123. [
  124. 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
  125. 'url' => ['etablissement-admin/facturation'],
  126. 'visible' => !Yii::$app->user->isGuest,
  127. ],
  128. ]
  129. ];
  130. }
  131. $menuItems[] = [
  132. 'label' => '<span class="glyphicon glyphicon-off"></span>',
  133. 'url' => ['/site/logout'],
  134. 'linkOptions' => ['data-method' => 'post', 'title' => 'Déconnexion']
  135. ];
  136. $menuItems[] = [
  137. 'label' => '<span class="retour-site">Retour sur le site</span>',
  138. 'url' => Url::frontend(),
  139. ];
  140. }
  141. echo Nav::widget([
  142. 'options' => ['class' => 'navbar-nav navbar-right'],
  143. 'items' => $menuItems,
  144. 'encodeLabels' => false
  145. ]);
  146. NavBar::end();
  147. ?>
  148. <div class="container-fluid container-body">
  149. <?php if (YII_ENV == 'dev' || YII_ENV == 'demo'): ?>
  150. <div id="env-dev"><?php if (YII_ENV == 'dev'): ?>Dév.<?php elseif (YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
  151. <?php endif; ?>
  152. <?php if (!Yii::$app->user->isGuest): ?>
  153. <div class="nom-boulange">
  154. <?php if (Yii::$app->user->identity->status == User::STATUS_BOULANGER): ?>
  155. <span><?= Html::encode(Yii::$app->user->identity->getNomMagasin()); ?></span>
  156. <?php elseif (Yii::$app->user->identity->status == User::STATUS_ADMIN): ?>
  157. <?php $form = ActiveForm::begin(['id' => 'select-etablissement']); ?>
  158. <?=
  159. Html::dropDownList('select_etablissement', Yii::$app->user->identity->id_etablissement, ArrayHelper::map(Etablissement::find()->orderBy('nom ASC')->all(), 'id', function($model, $defaultValue) {
  160. return $model->nom;
  161. }));
  162. ?>
  163. <?php ActiveForm::end(); ?>
  164. <?php endif; ?>
  165. <?php
  166. $etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement);
  167. if (!$etablissement->actif):
  168. ?>
  169. <span class="label label-danger" data-toggle="tooltip" data-placement="bottom" data-original-title="Activez votre établissement quand vous le souhaitez afin de la rendre visible à vos clients.">
  170. <?= Html::a('Hors-ligne', ['etablissement/update']); ?>
  171. </span>
  172. <?php endif; ?>
  173. <div class="clr"></div>
  174. <?php $etat_paiement_etablissement = Yii::$app->user->identity->etatPaiementEtablissement(); ?>
  175. <?php if ($etat_paiement_etablissement == 'essai'): ?>
  176. <span id="etat-paiement-etablissement">Période d'essai gratuite
  177. <span class="strong"><?php echo Yii::$app->user->identity->periodeEssai(); ?> jours</span> <a class="btn btn-success" href="<?php echo Yii::$app->urlManager->createUrl(['paiement/index']) ?>">S'abonner</a>
  178. </span>
  179. <?php elseif ($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE || $etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>
  180. <span id="etat-paiement-etablissement">
  181. <span class="strong">
  182. <?php if ($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE): ?>Période d'essai gratuite terminée
  183. <?php elseif ($etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>Retard de paiement
  184. <?php endif; ?>
  185. </span>
  186. </span>
  187. <?php endif; ?>
  188. </div>
  189. <?php endif; ?>
  190. <?php if (YII_ENV == 'demo'): ?>
  191. <div id="block-demo">
  192. <div class="container-fluid">
  193. <span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
  194. Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
  195. </div>
  196. </div>
  197. <?php endif; ?>
  198. <?=
  199. Breadcrumbs::widget([
  200. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  201. ])
  202. ?>
  203. <?= $content ?>
  204. </div>
  205. </div>
  206. <div id="alerts-fixed"></div>
  207. <footer class="footer">
  208. <div class="container-fluid">
  209. <p class="pull-left">
  210. <a href="<?php echo Url::frontend('site/contact'); ?>">Contact</a> &bull;
  211. <a href="<?php echo Url::frontend('site/mentions'); ?>">Mentions légales</a> &bull;
  212. <a href="<?php echo Url::frontend('site/cgv'); ?>">CGS</a>
  213. </p>
  214. <p class="pull-right"><?= Yii::powered() ?></p>
  215. </div>
  216. </footer>
  217. <?php $this->endBody() ?>
  218. <!-- analytics -->
  219. <script>
  220. (function (i, s, o, g, r, a, m) {
  221. i['GoogleAnalyticsObject'] = r;
  222. i[r] = i[r] || function () {
  223. (i[r].q = i[r].q || []).push(arguments)
  224. }, i[r].l = 1 * new Date();
  225. a = s.createElement(o),
  226. m = s.getElementsByTagName(o)[0];
  227. a.async = 1;
  228. a.src = g;
  229. m.parentNode.insertBefore(a, m)
  230. })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
  231. ga('create', 'UA-86917043-1', 'auto');
  232. ga('send', 'pageview');
  233. </script>
  234. </body>
  235. </html>
  236. <?php $this->endPage() ?>