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.

152 lines
6.5KB

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