Browse Source

Refactoring/traduction vues backend/views/layouts

refactoring
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

use yii\bootstrap\Nav; use yii\bootstrap\Nav;
use yii\bootstrap\NavBar; use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs; use yii\widgets\Breadcrumbs;
use common\models\Etablissement;
use common\models\Producer;
use common\models\User; use common\models\User;
use yii\widgets\ActiveForm; use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
\backend\assets\AppAsset::register($this); \backend\assets\AppAsset::register($this);


$producer = null ; $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() ?> <?php $this->beginPage() ?>
], ],
[ [
'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes', 'label' => '<span class="glyphicon glyphicon-calendar"></span> Commandes',
'url' => ['/commande/index'],
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest, 'visible' => !Yii::$app->user->isGuest,
'items' => [ 'items' => [
[ [
'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes', 'label' => '<span class="glyphicon glyphicon-calendar"></span> Toutes les commandes',
'url' => ['/commande/index'],
'url' => ['/order/index'],
'visible' => !Yii::$app->user->isGuest '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 'visible' => !Yii::$app->user->isGuest
], ],
] ]
], ],
[ [
'label' => '<span class="glyphicon glyphicon-grain"></span> Produits', 'label' => '<span class="glyphicon glyphicon-grain"></span> Produits',
'url' => ['/produit/index'],
'url' => ['/product/index'],
'visible' => !Yii::$app->user->isGuest 'visible' => !Yii::$app->user->isGuest
], ],
[ [
'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente', 'label' => '<span class="glyphicon glyphicon-map-marker"></span> Points de vente',
'url' => ['/point-vente/index'],
'url' => ['/point-sale/index'],
'visible' => !Yii::$app->user->isGuest 'visible' => !Yii::$app->user->isGuest
], ],
[ [
], ],
[ [
'label' => '<span class="glyphicon glyphicon-plus"></span>', 'label' => '<span class="glyphicon glyphicon-plus"></span>',
'url' => ['/etablissement/update'],
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest, 'visible' => !Yii::$app->user->isGuest,
'items' => [ 'items' => [
[ [
'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres', 'label' => '<span class="glyphicon glyphicon-cog"></span> Paramètres',
'url' => ['/etablissement/update'],
'url' => ['/producer/update'],
'visible' => !Yii::$app->user->isGuest 'visible' => !Yii::$app->user->isGuest
], ],
[ [
'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer', 'label' => '<span class="glyphicon glyphicon-bullhorn"></span> Communiquer',
'url' => ['/communiquer/index'],
'url' => ['/communicate/index'],
'visible' => !Yii::$app->user->isGuest 'visible' => !Yii::$app->user->isGuest
], ],
[ [
'label' => '<span class="glyphicon glyphicon-euro"></span> Mon abonnement', 'label' => '<span class="glyphicon glyphicon-euro"></span> Mon abonnement',
'url' => ['/etablissement/facturation'],
'url' => ['/producer/facturation'],
'visible' => !Yii::$app->user->isGuest, 'visible' => !Yii::$app->user->isGuest,
], ],
[ [
], ],
[ [
'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques produits', 'label' => '<span class="glyphicon glyphicon-stats"></span> Statistiques produits',
'url' => ['/stats/produits'],
'url' => ['/stats/products'],
'visible' => !Yii::$app->user->isGuest, 'visible' => !Yii::$app->user->isGuest,
], ],
[ [
'label' => '<span class="glyphicon glyphicon-wrench"></span> Développement', 'label' => '<span class="glyphicon glyphicon-wrench"></span> Développement',
'url' => ['/developpement/index'],
'url' => ['/development/index'],
'visible' => !Yii::$app->user->isGuest 'visible' => !Yii::$app->user->isGuest
], ],
], ],
'items' => [ 'items' => [
[ [
'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs', 'label' => '<span class="glyphicon glyphicon-th-list"></span> Producteurs',
'url' => ['etablissement-admin/index'],
'url' => ['producer-admin/index'],
'visible' => !Yii::$app->user->isGuest, 'visible' => !Yii::$app->user->isGuest,
], ],
[ [
'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation', 'label' => '<span class="glyphicon glyphicon-euro"></span> Facturation',
'url' => ['etablissement-admin/facturation'],
'url' => ['producer-admin/facturation'],
'visible' => !Yii::$app->user->isGuest, 'visible' => !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> <div id="env-dev"><?php if (YII_ENV == 'dev'): ?>Dév.<?php elseif (YII_ENV == 'demo'): ?>Démo<?php endif; ?></div>
<?php endif; ?> <?php endif; ?>
<?php if (!Yii::$app->user->isGuest): ?> <?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 ActiveForm::end(); ?>
<?php endif; ?> <?php endif; ?>


<?php <?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."> <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> </span>
<?php endif; ?>
<?php endif; ?>


<div class="clr"></div> <div class="clr"></div>
</div> </div>
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ])
?> ?>
<?= $content ?>
<?= $content ?>
</div> </div>
</div> </div>



Loading…
Cancel
Save