Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

main.php 11KB

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