Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

236 lines
11KB

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