Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

268 linhas
13KB

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