選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

223 行
10KB

  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. /* @var $this \yii\web\View */
  12. /* @var $content string */
  13. 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-calendar"></span> Commandes',
  41. 'url' => ['/commande/index'],
  42. 'visible'=> !Yii::$app->user->isGuest,
  43. 'items' => [
  44. [
  45. 'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
  46. 'url' => ['/commande/index'],
  47. 'visible' => !Yii::$app->user->isGuest
  48. ],
  49. [
  50. 'label' => '<span class="glyphicon glyphicon-repeat"></span> Commandes automatiques',
  51. 'url' => ['/commandeauto/index'],
  52. 'visible' => !Yii::$app->user->isGuest
  53. ],
  54. ]
  55. ],
  56. [
  57. 'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
  58. 'url' => ['/produit/index'],
  59. 'visible'=> !Yii::$app->user->isGuest
  60. ],
  61. [
  62. 'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
  63. 'url' => ['/point-vente/index'],
  64. 'visible'=> !Yii::$app->user->isGuest
  65. ],
  66. [
  67. 'label' => '<span class="glyphicon glyphicon-user"></span> Utilisateurs',
  68. 'url' => ['/user/index'],
  69. 'visible'=> !Yii::$app->user->isGuest
  70. ],
  71. [
  72. 'label' => '<span class="glyphicon glyphicon-plus"></span>',
  73. 'url' => ['/etablissement/update'],
  74. 'visible'=> !Yii::$app->user->isGuest,
  75. 'items' => [
  76. [
  77. 'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
  78. 'url' => ['/etablissement/update'],
  79. 'visible'=> !Yii::$app->user->isGuest
  80. ],
  81. [
  82. 'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
  83. 'url' => ['/communiquer/index'],
  84. 'visible'=> !Yii::$app->user->isGuest
  85. ],
  86. [
  87. 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
  88. 'url' => ['/etablissement/facturation'],
  89. 'visible'=> !Yii::$app->user->isGuest,
  90. ]
  91. ],
  92. ]
  93. ];
  94. if (Yii::$app->user->isGuest) {
  95. $menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
  96. } else {
  97. if(Yii::$app->user->identity->status == USER::STATUS_ADMIN)
  98. {
  99. $menuItems[] = [
  100. 'label' => '<span class="glyphicon glyphicon-asterisk"></span>',
  101. 'url' => '#',
  102. 'items' => [
  103. [
  104. 'label' => '<span class="glyphicon glyphicon-th-list"></span> Boulangeries',
  105. 'url' => ['etablissement-admin/index'],
  106. 'visible'=> !Yii::$app->user->isGuest,
  107. ],
  108. [
  109. 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
  110. 'url' => ['etablissement-admin/facturation'],
  111. 'visible'=> !Yii::$app->user->isGuest,
  112. ],
  113. ]
  114. ] ;
  115. }
  116. $menuItems[] = [
  117. 'label' => '<span class="glyphicon glyphicon-off"></span>',
  118. 'url' => ['/site/logout'],
  119. 'linkOptions' => ['data-method' => 'post','title' => 'Déconnexion']
  120. ];
  121. if(Yii::$app->getRequest()->serverName == 'localhost')
  122. $url = '../../frontend/web/' ;
  123. else
  124. $url = 'http://www.laboiteapain.net/' ;
  125. $menuItems[] = [
  126. 'label' => '<span class="retour-site">Retour sur le site</span>',
  127. 'url' => $url,
  128. ];
  129. }
  130. echo Nav::widget([
  131. 'options' => ['class' => 'navbar-nav navbar-right'],
  132. 'items' => $menuItems,
  133. 'encodeLabels' => false
  134. ]);
  135. NavBar::end();
  136. ?>
  137. <div class="container-fluid container-body">
  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. <?= Breadcrumbs::widget([
  175. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  176. ]) ?>
  177. <?= $content ?>
  178. </div>
  179. </div>
  180. <div id="alerts-fixed"></div>
  181. <footer class="footer">
  182. <div class="container">
  183. <p class="pull-left"></p>
  184. <p class="pull-right"><?= Yii::powered() ?></p>
  185. </div>
  186. </footer>
  187. <?php $this->endBody() ?>
  188. <!-- chat -->
  189. <?php if(!Yii::$app->user->isGuest && Yii::$app->user->identity->isBoulanger()): ?>
  190. <script src="//code.tidio.co/gngxwpdobb64cpvhd8patajpurs5feom.js"></script>
  191. <?php endif; ?>
  192. <!-- analytics -->
  193. <script>
  194. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  195. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  196. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  197. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  198. ga('create', 'UA-86917043-1', 'auto');
  199. ga('send', 'pageview');
  200. </script>
  201. </body>
  202. </html>
  203. <?php $this->endPage() ?>