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ů.

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