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.

167 lines
7.9KB

  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> Commandes par production',
  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. ['label' => '<span class="glyphicon glyphicon-grain"></span> Produits', 'url' => ['/produit/index'], 'visible'=> !Yii::$app->user->isGuest],
  57. ['label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente', 'url' => ['/point-vente/index'], 'visible'=> !Yii::$app->user->isGuest],
  58. ['label' => '<span class="glyphicon glyphicon-user"></span> Utilisateurs', 'url' => ['/user/index'], 'visible'=> !Yii::$app->user->isGuest],
  59. ['label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres', 'url' => ['/etablissement/update'], 'visible'=> !Yii::$app->user->isGuest],
  60. ['label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer', 'url' => ['/communiquer/index'], 'visible'=> !Yii::$app->user->isGuest],
  61. ];
  62. if (Yii::$app->user->isGuest) {
  63. $menuItems[] = ['label' => 'Connexion', 'url' => ['/site/login']];
  64. } else {
  65. $menuItems[] = [
  66. 'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion',
  67. 'url' => ['/site/logout'],
  68. 'linkOptions' => ['data-method' => 'post']
  69. ];
  70. if(Yii::$app->getRequest()->serverName == 'localhost')
  71. $url = '../../frontend/web/' ;
  72. else
  73. $url = 'http://www.laboiteapain.net/' ;
  74. $menuItems[] = [
  75. 'label' => '<span class="retour-site">Retour sur le site</span>',
  76. 'url' => $url,
  77. ];
  78. }
  79. echo Nav::widget([
  80. 'options' => ['class' => 'navbar-nav navbar-right'],
  81. 'items' => $menuItems,
  82. 'encodeLabels' => false
  83. ]);
  84. NavBar::end();
  85. ?>
  86. <div class="container-fluid container-body">
  87. <?php if(!Yii::$app->user->isGuest): ?>
  88. <div class="nom-boulange">
  89. <?php if(Yii::$app->user->identity->status == User::STATUS_BOULANGER): ?>
  90. <span><?= Html::encode(Yii::$app->user->identity->getNomMagasin()) ; ?></span>
  91. <?php elseif(Yii::$app->user->identity->status == User::STATUS_ADMIN): ?>
  92. <?php $form = ActiveForm::begin(['id' => 'select-etablissement']) ; ?>
  93. <?= Html::dropDownList('select_etablissement', Yii::$app->user->identity->id_etablissement, ArrayHelper::map(Etablissement::find()->orderBy('nom ASC')->all(), 'id', function($model, $defaultValue) {
  94. return Html::encode($model->nom) ;
  95. })) ; ?>
  96. <?php ActiveForm::end(); ?>
  97. <?php endif; ?>
  98. <?php
  99. $etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ;
  100. if(!$etablissement->actif):
  101. ?>
  102. <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.">
  103. <?= Html::a('Hors-ligne',['etablissement/update']); ?>
  104. </span>
  105. <?php endif; ?>
  106. <div class="clr"></div>
  107. <?php $etat_paiement_etablissement = Yii::$app->user->identity->etatPaiementEtablissement(); ?>
  108. <?php if($etat_paiement_etablissement == 'essai'): ?>
  109. <span id="etat-paiement-etablissement">Période d'essai gratuite
  110. <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>
  111. </span>
  112. <?php elseif($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE || $etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>
  113. <span id="etat-paiement-etablissement">
  114. <span class="strong">
  115. <?php if($etat_paiement_etablissement == Etablissement::PAIEMENT_ESSAI_TERMINE): ?>Période d'essai gratuite terminée
  116. <?php elseif($etat_paiement_etablissement == Etablissement::PAIEMENT_RETARD): ?>Retard de paiement
  117. <?php endif; ?>
  118. </span>
  119. </span>
  120. <?php endif; ?>
  121. </div>
  122. <?php endif; ?>
  123. <?= Breadcrumbs::widget([
  124. 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
  125. ]) ?>
  126. <?= $content ?>
  127. </div>
  128. </div>
  129. <div id="alerts-fixed"></div>
  130. <footer class="footer">
  131. <div class="container">
  132. <p class="pull-left"></p>
  133. <p class="pull-right"><?= Yii::powered() ?></p>
  134. </div>
  135. </footer>
  136. <?php $this->endBody() ?>
  137. <!-- chat -->
  138. <?php if(!Yii::$app->user->isGuest && Yii::$app->user->identity->isBoulanger()): ?>
  139. <script src="//code.tidio.co/gngxwpdobb64cpvhd8patajpurs5feom.js"></script>
  140. <?php endif; ?>
  141. <!-- analytics -->
  142. <script>
  143. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  144. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  145. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  146. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  147. ga('create', 'UA-86917043-1', 'auto');
  148. ga('send', 'pageview');
  149. </script>
  150. </body>
  151. </html>
  152. <?php $this->endPage() ?>