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.

260 lines
12KB

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