Browse Source

Refactoring/traduction vues backend/views/layouts

dev
Guillaume Bourgeois 6 years ago
parent
commit
4559eda0bf
1 changed files with 31 additions and 30 deletions
  1. +31
    -30
      backend/views/layouts/main.php

+ 31
- 30
backend/views/layouts/main.php View File

@@ -40,7 +40,7 @@ use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use common\models\Etablissement;
use common\models\Producer;
use common\models\User;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
@@ -53,8 +53,9 @@ use common\helpers\Url;
\backend\assets\AppAsset::register($this);

$producer = null ;
if(!Yii::$app->user->isGuest)
$producer = Etablissement::findOne(Yii::$app->user->identity->id_etablissement) ;
if(!Yii::$app->user->isGuest) {
$producer = Producer::findOne(Producer::getId()) ;
}

?>
<?php $this->beginPage() ?>
@@ -91,29 +92,29 @@ if(!Yii::$app->user->isGuest)
],
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes',
'url' => ['/commande/index'],
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
'url' => ['/commande/index'],
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-repeat"></span> Commandes récurrentes',
'url' => ['/commandeauto/index'],
'label' => '<span class="glyphicon glyphicon-repeat"></span> Abonnements',
'url' => ['/subscription/index'],
'visible' => !Yii::$app->user->isGuest
],
]
],
[
'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
'url' => ['/produit/index'],
'url' => ['/product/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
'url' => ['/point-vente/index'],
'url' => ['/point-sale/index'],
'visible' => !Yii::$app->user->isGuest
],
[
@@ -123,22 +124,22 @@ if(!Yii::$app->user->isGuest)
],
[
'label' => '<span class="glyphicon glyphicon-plus"></span>',
'url' => ['/etablissement/update'],
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest,
'items' => [
[
'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
'url' => ['/etablissement/update'],
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
'url' => ['/communiquer/index'],
'url' => ['/communicate/index'],
'visible' => !Yii::$app->user->isGuest
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Mon abonnement',
'url' => ['/etablissement/facturation'],
'url' => ['/producer/facturation'],
'visible' => !Yii::$app->user->isGuest,
],
[
@@ -148,12 +149,12 @@ if(!Yii::$app->user->isGuest)
],
[
'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques produits',
'url' => ['/stats/produits'],
'url' => ['/stats/products'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-wrench"></span> Développement',
'url' => ['/developpement/index'],
'url' => ['/development/index'],
'visible' => !Yii::$app->user->isGuest
],
],
@@ -171,12 +172,12 @@ if(!Yii::$app->user->isGuest)
'items' => [
[
'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs',
'url' => ['etablissement-admin/index'],
'url' => ['producer-admin/index'],
'visible' => !Yii::$app->user->isGuest,
],
[
'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
'url' => ['etablissement-admin/facturation'],
'url' => ['producer-admin/facturation'],
'visible' => !Yii::$app->user->isGuest,
],
]
@@ -207,27 +208,27 @@ if(!Yii::$app->user->isGuest)
<div id="env-dev"><?php if (YII_ENV == 'dev'): ?>Dév.<?php elseif (YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
<?php endif; ?>
<?php if (!Yii::$app->user->isGuest): ?>
<div class="nom-boulange">
<?php if (Yii::$app->user->identity->status == User::STATUS_BOULANGER): ?>
<span><?= Html::encode(Yii::$app->user->identity->getNomMagasin()); ?></span>
<?php elseif (Yii::$app->user->identity->status == User::STATUS_ADMIN): ?>
<?php $form = ActiveForm::begin(['id' => 'select-etablissement']); ?>
<div class="name-producer">
<?php if (User::getStatus() == User::STATUS_PRODUCER): ?>
<span><?= Html::encode(Yii::$app->user->identity->getNameProducer()); ?></span>
<?php elseif (User::getStatus() == User::STATUS_ADMIN): ?>
<?php $form = ActiveForm::begin(['id' => 'select-producer']); ?>
<?=
Html::dropDownList('select_etablissement', Yii::$app->user->identity->id_etablissement, ArrayHelper::map(Etablissement::find()->orderBy('nom ASC')->all(), 'id', function($model, $defaultValue) {
return $model->nom;
}));
Html::dropDownList('select_producer', Producer::getId(), ArrayHelper::map(Producer::find()->orderBy('name ASC')->all(), 'id', function($model, $defaultValue) {
return $model->nom;
}));
?>
<?php ActiveForm::end(); ?>
<?php endif; ?>

<?php
$etablissement = Etablissement::findOne(Yii::$app->user->identity->id_etablissement);
if (!$etablissement->actif):
$producer = Producer::findOne(Producer::getId());
if (!$producer->active):
?>
<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.">
<?= Html::a('Hors-ligne', ['etablissement/update']); ?>
<?= Html::a('Hors-ligne', ['producer/update']); ?>
</span>
<?php endif; ?>
<?php endif; ?>

<div class="clr"></div>
</div>
@@ -247,7 +248,7 @@ if(!Yii::$app->user->isGuest)
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
])
?>
<?= $content ?>
<?= $content ?>
</div>
</div>


Loading…
Cancel
Save