Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

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