You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
8.2KB

  1. <?php
  2. use yii\bootstrap\Nav;
  3. use yii\bootstrap\NavBar;
  4. use yii\widgets\Breadcrumbs;
  5. use common\widgets\Alert;
  6. use common\helpers\Url;
  7. \common\assets\CommonAsset::register($this);
  8. \producer\assets\AppAsset::register($this);
  9. $producer = $this->context->getProducer() ;
  10. ?>
  11. <?php $this->beginPage() ?>
  12. <!DOCTYPE html>
  13. <head>
  14. <title><?= Html::encode($producer->nom); ?> &bull; <?= $this->getPageTitle(); ?></title>
  15. <meta charset="utf-8">
  16. <meta name="viewport" content="width=device-width, initial-scale=1">
  17. <meta name="base-url" content="<?= Yii::$app->urlManager->baseUrl ; ?>">
  18. <?= Html::csrfMetaTags() ?>
  19. <link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon4.png" />
  20. <?php $this->head() ?>
  21. </head>
  22. <body class="<?= Yii::$app->controller->id.'-'.Yii::$app->controller->action->id ?>">
  23. <?php $this->beginBody() ?>
  24. <div id="header-bap">
  25. <div class="container">
  26. <a id="logo" href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']); ?>">
  27. <img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" />
  28. <span class="text">La boîte à pain</span>
  29. </a>
  30. <?php
  31. echo Nav::widget([
  32. 'encodeLabels' => false,
  33. 'items' => [
  34. [
  35. 'label' => '<span class="glyphicon glyphicon-user"></span> Inscription',
  36. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/signup']),
  37. 'visible' => Yii::$app->user->isGuest
  38. ],
  39. [
  40. 'label' => '<span class="glyphicon glyphicon-log-in"></span> Connexion',
  41. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/login','return_url' => Yii::$app->urlManager->createAbsoluteUrl(['site/index'])]),
  42. 'visible' => Yii::$app->user->isGuest
  43. ],
  44. [
  45. 'label' => '<span class="glyphicon glyphicon-user"></span> '.((!Yii::$app->user->isGuest) ? Html::encode(Yii::$app->user->identity->prenom .' '.strtoupper(substr(Yii::$app->user->identity->nom, 0, 1))) : '').'. ',
  46. 'options' => ['id' => 'label1'],
  47. 'url' => '#',
  48. 'items' => [
  49. [
  50. 'label' => 'Profil',
  51. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['user/update']),
  52. ],
  53. [
  54. 'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion',
  55. 'url' => Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/logout']),
  56. ]
  57. ],
  58. 'visible' => !Yii::$app->user->isGuest
  59. ],
  60. ],
  61. 'options' => ['id' =>'nav-bap'],
  62. ]);
  63. ?>
  64. </div>
  65. </div>
  66. <header id="header">
  67. <div class="container">
  68. <h1><?= Html::encode($producer->nom); ?></h1>
  69. <h2><?= Html::encode($producer->type) ?> à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2>
  70. <?php if(!Yii::$app->user->isGuest): ?>
  71. <?php
  72. $user_etablissement = UserEtablissement::findOne(['id_user' => Yii::$app->user->identity->id, 'id_etablissement' => $producer->id ]) ;
  73. if($user_etablissement):
  74. ?>
  75. <div id="credit">
  76. <div class="info"><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl('site/creditpain'); ?>"><span class="text">Crédit </span><span class="glyphicon glyphicon-info-sign"></span></a></div>
  77. <div id="the-credit"><?= number_format($user_etablissement->credit, 2); ?> €</div>
  78. </div>
  79. <?php endif; ?>
  80. <?php endif; ?>
  81. </div>
  82. </header>
  83. <div id="main">
  84. <div class="container">
  85. <nav id="main-nav">
  86. <?php
  87. echo Nav::widget([
  88. 'encodeLabels' => false,
  89. 'options' => ['class' =>'nav nav-pills'],
  90. 'items' => [
  91. [
  92. 'label' => '<span class="glyphicon glyphicon-th-large"></span> Accueil',
  93. 'url' => Yii::$app->urlManager->createUrl(['site/index']),
  94. 'active' => $this->getControllerAction() == 'site/index',
  95. ],
  96. [
  97. 'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
  98. 'url' => Yii::$app->urlManager->createUrl(['commande/create']),
  99. 'visible' => !Yii::$app->user->isGuest,
  100. 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
  101. ],
  102. [
  103. 'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique',
  104. 'url' => Yii::$app->urlManager->createUrl(['commande/historique']),
  105. 'visible' => !Yii::$app->user->isGuest,
  106. 'active' => $this->getControllerAction() == 'commande/historique',
  107. ],
  108. [
  109. 'label' => '<span class="glyphicon glyphicon-envelope"></span> Contact',
  110. 'url' => Yii::$app->urlManager->createUrl(['site/contact']),
  111. 'active' => $this->getControllerAction() == 'site/contact',
  112. ],
  113. [
  114. 'label' => '<span class="glyphicon glyphicon-cog"></span> Administration',
  115. 'url' => Yii::$app->urlManagerBackend->createAbsoluteUrl(['site/index']),
  116. 'visible' => isset(Yii::$app->user->identity) && Yii::$app->user->identity->isBoulanger(),
  117. 'options' => ['id' => 'btn-administration']
  118. ],
  119. ],
  120. ]);
  121. ?>
  122. </nav>
  123. <?php if(strlen($this->getTitle())): ?>
  124. <h2 id="page-title"><?= $this->getTitle(); ?></h2>
  125. <?php endif; ?>
  126. <section id="content">
  127. <?php if (Yii::$app->session->hasFlash('error')): ?>
  128. <div class="alert alert-danger" role="alert">
  129. <?= Yii::$app->session->getFlash('error') ?>
  130. </div>
  131. <?php endif; ?>
  132. <?php if (Yii::$app->session->hasFlash('success')): ?>
  133. <div class="alert alert-success" role="alert">
  134. <?= Yii::$app->session->getFlash('success') ?>
  135. </div>
  136. <?php endif; ?>
  137. <?= $content ?>
  138. </section>
  139. </div>
  140. </div>
  141. <footer id="footer">
  142. <div class="container">
  143. <div class="overflow"></div>
  144. <div class="content">
  145. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']) ; ?>">La boîte à pain</a>
  146. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/mentions']) ; ?>">Mentions légales</a>
  147. <a href="<?php echo Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/cgv']) ; ?>">CGS</a>
  148. </div>
  149. </div>
  150. </footer>
  151. <?php $this->endBody() ?>
  152. </body>
  153. </html>
  154. <?php $this->endPage() ?>