|
- <?php
-
- use yii\bootstrap\Nav;
- use yii\bootstrap\NavBar;
- use yii\widgets\Breadcrumbs;
- use common\widgets\Alert;
- use common\helpers\Url;
-
- \common\assets\CommonAsset::register($this);
- \producer\assets\AppAsset::register($this);
-
- $producer = $this->context->getProducer() ;
-
- ?>
- <?php $this->beginPage() ?>
- <!DOCTYPE html>
- <head>
- <title><?= Html::encode($producer->nom); ?> • <?= $this->getTitle(); ?></title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta name="base-url" content="<?= Yii::$app->urlManager->baseUrl ; ?>">
- <?= Html::csrfMetaTags() ?>
- <link rel="icon" type="image/png" href="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/favicon4.png" />
- <?php $this->head() ?>
- </head>
- <body class="<?= Yii::$app->controller->id.'-'.Yii::$app->controller->action->id ?>">
- <?php $this->beginBody() ?>
-
- <div id="header-bap">
- <div class="container">
- <a id="logo" href="<?= Yii::$app->urlManagerFrontend->createUrl(['site/index']); ?>">
- <img class="icon" src="<?php echo Yii::$app->urlManager->getBaseUrl(); ?>/img/laboulange3.png" alt="" />
- <span class="text">La boîte à pain</span>
- </a>
- <?php
- echo Nav::widget([
- 'encodeLabels' => false,
- 'items' => [
- [
- 'label' => '<span class="glyphicon glyphicon-user"></span> Inscription',
- 'url' => Yii::$app->urlManagerFrontend->createUrl(['site/signup']),
- 'visible' => Yii::$app->user->isGuest
- ],
- [
- 'label' => '<span class="glyphicon glyphicon-log-in"></span> Connexion',
- 'url' => Yii::$app->urlManagerFrontend->createUrl(['site/login','return_url' => Yii::$app->urlManager->createUrl(['producer/index'])]),
- 'visible' => Yii::$app->user->isGuest
- ],
- [
- '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))) : '').'. ',
- 'options' => ['id' => 'label1'],
- 'url' => '#',
- 'items' => [
- [
- 'label' => 'Profil',
- 'url' => Url::frontend('user/update'),
- ],
- [
- 'label' => '<span class="glyphicon glyphicon-off"></span> Déconnexion',
- 'url' => Url::frontend('site/logout'),
- ]
- ],
- 'visible' => !Yii::$app->user->isGuest
- ],
- ],
- 'options' => ['id' =>'nav-bap'],
- ]);
- ?>
- </div>
- </div>
-
- <header id="header">
- <div class="container">
- <h1><?= Html::encode($producer->nom); ?></h1>
- <h2><?= Html::encode($producer->type) ?> à <?= Html::encode($producer->ville); ?> (<?= Html::encode($producer->code_postal); ?>)</h2>
- <?php if(!Yii::$app->user->isGuest): ?>
- <?php
- $user_etablissement = UserEtablissement::findOne(['id_user' => Yii::$app->user->identity->id, 'id_etablissement' => $producer->id ]) ;
- if($user_etablissement):
- ?>
- <div id="credit"><span>Crédit :</span> <?= number_format($user_etablissement->credit, 2); ?> €</div>
- <?php endif; ?>
- <?php endif; ?>
- </div>
- </header>
-
- <div id="main">
- <div class="container">
- <nav id="main-nav">
- <?php
- echo Nav::widget([
- 'encodeLabels' => false,
- 'options' => ['class' =>'nav nav-pills'],
- 'items' => [
- [
- 'label' => '<span class="glyphicon glyphicon-th-large"></span> Accueil',
- 'url' => Yii::$app->urlManager->createUrl(['producer/index']),
- 'active' => $this->getControllerAction() == 'producer/index',
- ],
- [
- 'label' => '<span class="glyphicon glyphicon-plus"></span> Commander',
- 'url' => Yii::$app->urlManager->createUrl(['commande/create']),
- 'visible' => !Yii::$app->user->isGuest,
- 'active' => $this->getControllerAction() == 'commande/create' || $this->getControllerAction() == 'commande/update',
- ],
- [
- 'label' => '<span class="glyphicon glyphicon-folder-open"></span> Historique',
- 'url' => Yii::$app->urlManager->createUrl(['commande/historique']),
- 'visible' => !Yii::$app->user->isGuest,
- 'active' => $this->getControllerAction() == 'commande/historique',
- ],
- [
- 'label' => '<span class="glyphicon glyphicon-envelope"></span> Contact',
- 'url' => Yii::$app->urlManager->createUrl(['producer/contact']),
- 'active' => $this->getControllerAction() == 'producer/contact',
- ],
- [
- 'label' => '<span class="glyphicon glyphicon-cog"></span> Administration',
- 'url' => Yii::$app->urlManagerBackend->createUrl(['site/index']),
- 'visible' => isset(Yii::$app->user->identity) && Yii::$app->user->identity->isBoulanger(),
- 'options' => ['id' => 'btn-administration']
- ],
- ],
- ]);
- ?>
- </nav>
-
- <?php if(strlen($this->getTitle())): ?>
- <h2 id="page-title"><?= $this->getTitle(); ?></h2>
- <?php endif; ?>
-
- <section id="content">
- <?php if (Yii::$app->session->hasFlash('error')): ?>
- <div class="alert alert-danger" role="alert">
- <?= Yii::$app->session->getFlash('error') ?>
- </div>
- <?php endif; ?>
- <?php if (Yii::$app->session->hasFlash('success')): ?>
- <div class="alert alert-success" role="alert">
- <?= Yii::$app->session->getFlash('success') ?>
- </div>
- <?php endif; ?>
-
- <?= $content ?>
- </section>
- </div>
- </div>
-
- <footer id="footer">
- <div class="container">
- <div class="overflow"></div>
- <div class="content">
- <a href="<?php echo Url::frontend('site/index') ; ?>">La boîte à pain</a>
- <a href="<?php echo Url::frontend('site/mentions') ; ?>">Mentions légales</a>
- <a href="<?php echo Url::frontend('site/cgv') ; ?>">CGS</a>
- </div>
- </div>
- </footer>
-
- <?php $this->endBody() ?>
- </body>
- </html>
- <?php $this->endPage() ?>
|