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.

263 linhas
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 = 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-wrench"></span> Développement',
  109. 'url' => ['/developpement/index'],
  110. 'visible' => !Yii::$app->user->isGuest
  111. ],
  112. ],
  113. ]
  114. ];
  115. if (Yii::$app->user->isGuest) {
  116. $menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
  117. } else {
  118. if (Yii::$app->user->identity->status == USER::STATUS_ADMIN) {
  119. $menuItems[] = [
  120. 'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
  121. 'url' => '#',
  122. 'items' => [
  123. [
  124. 'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs',
  125. 'url' => ['etablissement-admin/index'],
  126. 'visible' => !Yii::$app->user->isGuest,
  127. ],
  128. [
  129. 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
  130. 'url' => ['etablissement-admin/facturation'],
  131. 'visible' => !Yii::$app->user->isGuest,
  132. ],
  133. ]
  134. ];
  135. }
  136. $menuItems[] = [
  137. 'label' => '<span class="glyphicon glyphicon-off"></span>',
  138. 'url' => ['/site/logout'],
  139. 'linkOptions' => ['data-method' => 'post', 'title' => 'Déconnexion']
  140. ];
  141. $menuItems[] = [
  142. 'label' => '<span class="retour-site">Retour sur le site</span>',
  143. 'url' => Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index','slug_producer' => $producer->slug]),
  144. ];
  145. }
  146. echo Nav::widget([
  147. 'options' => ['class' => 'navbar-nav navbar-right'],
  148. 'items' => $menuItems,
  149. 'encodeLabels' => false
  150. ]);
  151. NavBar::end();
  152. ?>
  153. <div class="container-fluid container-body">
  154. <?php if (YII_ENV == 'dev' || YII_ENV == 'demo'): ?>
  155. <div id="env-dev"><?php if (YII_ENV == 'dev'): ?>Dév.<?php elseif (YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
  156. <?php endif; ?>
  157. <?php if (!Yii::$app->user->isGuest): ?>
  158. <div class="nom-boulange">
  159. <?php if (Yii::$app->user->identity->status == User::STATUS_BOULANGER): ?>
  160. <span><?= Html::encode(Yii::$app->user->identity->getNomMagasin()); ?></span>
  161. <?php elseif (Yii::$app->user->identity->status == User::STATUS_ADMIN): ?>
  162. <?php $form = ActiveForm::begin(['id' => 'select-etablissement']); ?>
  163. <?=
  164. Html::dropDownList('select_etablissement', Yii::$app->user->identity->id_etablissement, ArrayHelper::map(Etablissement::find()->orderBy('nom ASC')->all(), 'id', function($model, $defaultValue) {
  165. return $model->nom;
  166. }));
  167. ?>
  168. <?php ActiveForm::end(); ?>
  169. <?php endif; ?>
  170. <?php
  171. $etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement);
  172. if (!$etablissement->actif):
  173. ?>
  174. <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.">
  175. <?= Html::a('Hors-ligne', ['etablissement/update']); ?>
  176. </span>
  177. <?php endif; ?>
  178. <div class="clr"></div>
  179. <?php $etat_paiement_etablissement = Yii::$app->user->identity->etatPaiementEtablissement(); ?>
  180. <?php if ($etat_paiement_etablissement == 'essai'): ?>
  181. <span id="etat-paiement-etablissement">Période d'essai gratuite
  182. <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>
  183. </span>
  184. <?php elseif ($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE || $etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>
  185. <span id="etat-paiement-etablissement">
  186. <span class="strong">
  187. <?php if ($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE): ?>Période d'essai gratuite terminée
  188. <?php elseif ($etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>Retard de paiement
  189. <?php endif; ?>
  190. </span>
  191. </span>
  192. <?php endif; ?>
  193. </div>
  194. <?php endif; ?>
  195. <?php if (YII_ENV == 'demo'): ?>
  196. <div id="block-demo">
  197. <div class="container-fluid">
  198. <span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
  199. Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
  200. </div>
  201. </div>
  202. <?php endif; ?>
  203. <?=
  204. Breadcrumbs::widget([
  205. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  206. ])
  207. ?>
  208. <?= $content ?>
  209. </div>
  210. </div>
  211. <div id="alerts-fixed"></div>
  212. <footer class="footer">
  213. <div class="container-fluid">
  214. <p class="pull-left">
  215. <a href="<?php echo Url::frontend('site/contact'); ?>">Contact</a> &bull;
  216. <a href="<?php echo Url::frontend('site/mentions'); ?>">Mentions légales</a> &bull;
  217. <a href="<?php echo Url::frontend('site/cgv'); ?>">CGS</a>
  218. </p>
  219. <p class="pull-right"><?= Yii::powered() ?></p>
  220. </div>
  221. </footer>
  222. <?php $this->endBody() ?>
  223. <!-- analytics -->
  224. <script>
  225. (function (i, s, o, g, r, a, m) {
  226. i['GoogleAnalyticsObject'] = r;
  227. i[r] = i[r] || function () {
  228. (i[r].q = i[r].q || []).push(arguments)
  229. }, i[r].l = 1 * new Date();
  230. a = s.createElement(o),
  231. m = s.getElementsByTagName(o)[0];
  232. a.async = 1;
  233. a.src = g;
  234. m.parentNode.insertBefore(a, m)
  235. })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
  236. ga('create', 'UA-86917043-1', 'auto');
  237. ga('send', 'pageview');
  238. </script>
  239. </body>
  240. </html>
  241. <?php $this->endPage() ?>