No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

232 líneas
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-calendar"></span> Commandes',
  42. 'url' => ['/commande/index'],
  43. 'visible'=> !Yii::$app->user->isGuest,
  44. 'items' => [
  45. [
  46. 'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
  47. 'url' => ['/commande/index'],
  48. 'visible' => !Yii::$app->user->isGuest
  49. ],
  50. [
  51. 'label' => '<span class="glyphicon glyphicon-repeat"></span> Commandes récurrentes',
  52. 'url' => ['/commandeauto/index'],
  53. 'visible' => !Yii::$app->user->isGuest
  54. ],
  55. ]
  56. ],
  57. [
  58. 'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
  59. 'url' => ['/produit/index'],
  60. 'visible'=> !Yii::$app->user->isGuest
  61. ],
  62. [
  63. 'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
  64. 'url' => ['/point-vente/index'],
  65. 'visible'=> !Yii::$app->user->isGuest
  66. ],
  67. [
  68. 'label' => '<span class="glyphicon glyphicon-user"></span> Utilisateurs',
  69. 'url' => ['/user/index'],
  70. 'visible'=> !Yii::$app->user->isGuest
  71. ],
  72. [
  73. 'label' => '<span class="glyphicon glyphicon-plus"></span>',
  74. 'url' => ['/etablissement/update'],
  75. 'visible'=> !Yii::$app->user->isGuest,
  76. 'items' => [
  77. [
  78. 'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
  79. 'url' => ['/etablissement/update'],
  80. 'visible'=> !Yii::$app->user->isGuest
  81. ],
  82. [
  83. 'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
  84. 'url' => ['/communiquer/index'],
  85. 'visible'=> !Yii::$app->user->isGuest
  86. ],
  87. [
  88. 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
  89. 'url' => ['/etablissement/facturation'],
  90. 'visible'=> !Yii::$app->user->isGuest,
  91. ]
  92. ],
  93. ]
  94. ];
  95. if (Yii::$app->user->isGuest) {
  96. $menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
  97. } else {
  98. if(Yii::$app->user->identity->status == USER::STATUS_ADMIN)
  99. {
  100. $menuItems[] = [
  101. 'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
  102. 'url' => '#',
  103. 'items' => [
  104. [
  105. 'label' => '<span class="glyphicon glyphicon-th-list"></span> Boulangeries',
  106. 'url' => ['etablissement-admin/index'],
  107. 'visible'=> !Yii::$app->user->isGuest,
  108. ],
  109. [
  110. 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
  111. 'url' => ['etablissement-admin/facturation'],
  112. 'visible'=> !Yii::$app->user->isGuest,
  113. ],
  114. ]
  115. ] ;
  116. }
  117. $menuItems[] = [
  118. 'label' => '<span class="glyphicon glyphicon-off"></span>',
  119. 'url' => ['/site/logout'],
  120. 'linkOptions' => ['data-method' => 'post','title' => 'Déconnexion']
  121. ];
  122. $menuItems[] = [
  123. 'label' => '<span class="retour-site">Retour sur le site</span>',
  124. 'url' => Url::frontend(),
  125. ];
  126. }
  127. echo Nav::widget([
  128. 'options' => ['class' => 'navbar-nav navbar-right'],
  129. 'items' => $menuItems,
  130. 'encodeLabels' => false
  131. ]);
  132. NavBar::end();
  133. ?>
  134. <div class="container-fluid container-body">
  135. <?php if(YII_ENV == 'dev' || YII_ENV == 'demo'): ?>
  136. <div id="env-dev"><?php if(YII_ENV == 'dev'): ?>Dév.<?php elseif(YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
  137. <?php endif; ?>
  138. <?php if(!Yii::$app->user->isGuest): ?>
  139. <div class="nom-boulange">
  140. <?php if(Yii::$app->user->identity->status == User::STATUS_BOULANGER): ?>
  141. <span><?= Html::encode(Yii::$app->user->identity->getNomMagasin()) ; ?></span>
  142. <?php elseif(Yii::$app->user->identity->status == User::STATUS_ADMIN): ?>
  143. <?php $form = ActiveForm::begin(['id' => 'select-etablissement']) ; ?>
  144. <?= Html::dropDownList('select_etablissement', Yii::$app->user->identity->id_etablissement, ArrayHelper::map(Etablissement::find()->orderBy('nom ASC')->all(), 'id', function($model, $defaultValue) {
  145. return Html::encode($model->nom) ;
  146. })) ; ?>
  147. <?php ActiveForm::end(); ?>
  148. <?php endif; ?>
  149. <?php
  150. $etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ;
  151. if(!$etablissement->actif):
  152. ?>
  153. <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.">
  154. <?= Html::a('Hors-ligne',['etablissement/update']); ?>
  155. </span>
  156. <?php endif; ?>
  157. <div class="clr"></div>
  158. <?php $etat_paiement_etablissement = Yii::$app->user->identity->etatPaiementEtablissement(); ?>
  159. <?php if($etat_paiement_etablissement == 'essai'): ?>
  160. <span id="etat-paiement-etablissement">Période d'essai gratuite
  161. <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>
  162. </span>
  163. <?php elseif($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE || $etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>
  164. <span id="etat-paiement-etablissement">
  165. <span class="strong">
  166. <?php if($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE): ?>Période d'essai gratuite terminée
  167. <?php elseif($etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>Retard de paiement
  168. <?php endif; ?>
  169. </span>
  170. </span>
  171. <?php endif; ?>
  172. </div>
  173. <?php endif; ?>
  174. <?php if(YII_ENV == 'demo'): ?>
  175. <div id="block-demo">
  176. <div class="container-fluid">
  177. <span class="glyphicon glyphicon-eye-open"></span> <strong>Espace de démonstration</strong> :
  178. Testez la plateforme sans avoir à vous inscrire. Les données sont réinitialisées quotidiennement &bull; <?= Html::a('Retour', Url::env('prod', 'frontend')) ?>
  179. </div>
  180. </div>
  181. <?php endif; ?>
  182. <?= Breadcrumbs::widget([
  183. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  184. ]) ?>
  185. <?= $content ?>
  186. </div>
  187. </div>
  188. <div id="alerts-fixed"></div>
  189. <footer class="footer">
  190. <div class="container">
  191. <p class="pull-left"></p>
  192. <p class="pull-right"><?= Yii::powered() ?></p>
  193. </div>
  194. </footer>
  195. <?php $this->endBody() ?>
  196. <!-- chat -->
  197. <?php if(!Yii::$app->user->isGuest && Yii::$app->user->identity->isBoulanger()): ?>
  198. <script src="//code.tidio.co/gngxwpdobb64cpvhd8patajpurs5feom.js"></script>
  199. <?php endif; ?>
  200. <!-- analytics -->
  201. <script>
  202. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  203. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  204. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  205. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  206. ga('create', 'UA-86917043-1', 'auto');
  207. ga('send', 'pageview');
  208. </script>
  209. </body>
  210. </html>
  211. <?php $this->endPage() ?>