Sfoglia il codice sorgente

Refactoring/traduction vues backend/views/subscription

refactoring
parent
commit
04a2cb9f31
4 ha cambiato i file con 65 aggiunte e 64 eliminazioni
  1. +27
    -27
      backend/views/subscription/_form.php
  2. +5
    -5
      backend/views/subscription/create.php
  3. +29
    -28
      backend/views/subscription/index.php
  4. +4
    -4
      backend/views/subscription/update.php

backend/views/commandeauto/_form.php → backend/views/subscription/_form.php Vedi File

@@ -40,15 +40,15 @@ use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper ;
use common\models\User ;
use common\models\PointVente ;
use common\models\PointSale ;

?>

<div class="commandeauto-form">
<div class="subscription-form">
<?php $form = ActiveForm::begin(['enableClientValidation' => false]); ?>
<div class="col-md-5" id="bloc-select-user">
<?= $form->field($model, 'id_user')->dropDownList( ArrayHelper::map(User::find()->joinWith('userEtablissement')->where('user_etablissement.id_etablissement = '.Yii::$app->user->identity->id_etablissement)->andWhere('user_etablissement.actif = 1')->orderBy('nom ASC, prenom ASC')->all(), 'id', function($model, $defaultValue) {
return $model['nom'].' '.$model['prenom'];
<?= $form->field($model, 'id_user')->dropDownList( ArrayHelper::map(User::find()->joinWith('userProducer')->where('user_producer.id_producer = '.Producer::getId())->andWhere('user_producer.active = 1')->orderBy('lastname ASC, name ASC')->all(), 'id', function($model, $defaultValue) {
return $model['lastname'].' '.$model['name'];
}), ['prompt' => '--','class' => 'form-control user-id', ]) ?>
</div>
<div class="col-md-1" id="or-user">
@@ -59,49 +59,49 @@ use common\models\PointVente ;
</div>
<div class="clr"></div>
<?= $form->field($model, 'id_etablissement')->hiddenInput() ?>
<?= $form->field($model, 'id_point_vente')->dropDownList( ArrayHelper::map(PointVente::find()->where('id_etablissement = '.Yii::$app->user->identity->id_etablissement)->all(), 'id', function($model, $defaultValue) {
return $model['nom'];
<?= $form->field($model, 'id_producer')->hiddenInput() ?>
<?= $form->field($model, 'id_point_sale')->dropDownList(ArrayHelper::map(PointSale::find()->where('id_producer = '.Producer::getId())->all(), 'id', function($model, $defaultValue) {
return $model['name'];
}), ['prompt' => '--','class' => 'form-control user-id']) ?>
<?= $form->field($model, 'date_debut') ?>
<?= $form->field($model, 'date_fin')->hint('Laisser vide pour une durée indéterminée') ?>
<div class="jours">
<?= $form->field($model, 'date_begin') ?>
<?= $form->field($model, 'date_end')->hint('Laisser vide pour une durée indéterminée') ?>
<div class="days">
<h2>Jours</h2>
<?= $form->field($model, 'lundi')->checkbox() ?>
<?= $form->field($model, 'mardi')->checkbox() ?>
<?= $form->field($model, 'mercredi')->checkbox() ?>
<?= $form->field($model, 'jeudi')->checkbox() ?>
<?= $form->field($model, 'vendredi')->checkbox() ?>
<?= $form->field($model, 'samedi')->checkbox() ?>
<?= $form->field($model, 'dimanche')->checkbox() ?>
<?= $form->field($model, 'monday')->checkbox() ?>
<?= $form->field($model, 'tuesday')->checkbox() ?>
<?= $form->field($model, 'wednesday')->checkbox() ?>
<?= $form->field($model, 'thursday')->checkbox() ?>
<?= $form->field($model, 'friday')->checkbox() ?>
<?= $form->field($model, 'saterday')->checkbox() ?>
<?= $form->field($model, 'sunday')->checkbox() ?>
</div>
<div class="clr"></div>
<?= $form->field($model, 'periodicite_semaine')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?>
<?= $form->field($model, 'week_frequency')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?>

<?= $form->field($model, 'paiement_automatique')
<?= $form->field($model, 'auto_payment')
->checkbox()
->hint('Cochez cette case si vous souhaitez que le crédit pain du client soit automatiquement débité lors de la création de la commande.<br />'
. 'Attention, un compte client existant doit être spécifié en haut de ce formulaire.') ?>
<div class="produits">
<div class="products">
<h2>Produits</h2>
<?php if(isset($model->errors['produits']) && count($model->errors['produits']))
<?php if(isset($model->errors['products']) && count($model->errors['products']))
{
echo '<div class="alert alert-danger">'.$model->errors['produits'][0].'</div>' ;
echo '<div class="alert alert-danger">'.$model->errors['products'][0].'</div>' ;
}
?>
<table class="table table-bordered table-condensed table-hover">
<?php foreach ($produits as $p) : ?>
<?php foreach ($productsArray as $p) : ?>
<tr>
<td><?= Html::encode($p->nom) ?></td>
<td><?= Html::encode($p->name) ?></td>
<td>
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default btn-moins" type="button"><span class="glyphicon glyphicon-minus"></span></button>
<button class="btn btn-default btn-minus" type="button"><span class="glyphicon glyphicon-minus"></span></button>
</span>
<?= Html::input('text', 'CommandeAutoForm[produits][produit_'.$p->id.']', (isset($model->produits['produit_'.$p->id])) ? $model->produits['produit_'.$p->id] : '', ['class' => 'form-control quantite']) ?>
<?= Html::input('text', 'SubscriptionForm[products][product_'.$p->id.']', (isset($model->products['product_'.$p->id])) ? $model->products['product_'.$p->id] : '', ['class' => 'form-control quantity']) ?>
<span class="input-group-btn">
<button class="btn btn-default btn-plus" type="button"><span class="glyphicon glyphicon-plus"></span></button>
<button class="btn btn-default btn-more" type="button"><span class="glyphicon glyphicon-plus"></span></button>
</span>
</div>
</td>

backend/views/commandeauto/create.php → backend/views/subscription/create.php Vedi File

@@ -41,17 +41,17 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Produit */

$this->title = 'Ajouter une commande automatique';
$this->params['breadcrumbs'][] = ['label' => 'Commandes automatiques', 'url' => ['index']];
$this->title = 'Ajouter un abonnement';
$this->params['breadcrumbs'][] = ['label' => 'Abonnements', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Ajouter';
?>
<div class="commandeauto-create">
<div class="subscription-create">
<h1><?= Html::encode($this->title) ?></h1>

<?= $this->render('_form', [
'model' => $model,
'produits' => $produits
'productsArray' => $productsArray
]) ?>

</div>

backend/views/commandeauto/index.php → backend/views/subscription/index.php Vedi File

@@ -42,10 +42,10 @@ use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Commandes récurrentes';
$this->title = 'Abonnements';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="commande-auto-index">
<div class="subscription-index">

<h1><?= Html::encode($this->title) ?> <?= Html::a('Ajouter', ['create'], ['class' => 'btn btn-success']) ?></h1>

@@ -61,30 +61,31 @@ $this->params['breadcrumbs'][] = $this->title;
return Html::encode($model->username) ;
}
else {
if(isset($model->user))
return Html::encode($model->user->nom.' '.$model->user->prenom) ;
if(isset($model->user)) {
return Html::encode($model->user->lastname.' '.$model->user->name) ;
}
}
}
],
[
'attribute' => 'id_point_vente',
'attribute' => 'id_point_sale',
'format' => 'raw',
'value' => function($model) {
return Html::encode($model->pointVente->nom) ;
return Html::encode($model->pointSale->name) ;
}
],
[
'attribute' => 'produits',
'attribute' => 'products',
'format' => 'raw',
'value' => function($model) {
$html = '' ;
foreach($model->commandeAutoProduit as $commande_produit)
foreach($model->productSubscription as $productSubscription)
{
$html .= $commande_produit->quantite . ' x '.Html::encode($commande_produit->produit->nom).'<br />' ;
$html .= $productSubscription->quantity . ' x '.Html::encode($productSubscription->product->name).'<br />' ;
}
// aucun produit
if(!count($model->commandeAutoProduit))
if(!count($model->productSubscription))
{
$html .= '<span class="glyphicon glyphicon-warning-sign"></span> Aucun produit' ;
}
@@ -93,39 +94,39 @@ $this->params['breadcrumbs'][] = $this->title;
}
],
[
'attribute' => 'date_debut',
'attribute' => 'date_begin',
'value' => function($model) {
return date('d/m/Y',strtotime($model->date_debut)) ;
return date('d/m/Y',strtotime($model->date_begin)) ;
}
],
[
'attribute' => 'date_fin',
'attribute' => 'date_end',
'value' => function($model) {
if($model->date_fin)
return date('d/m/Y',strtotime($model->date_fin)) ;
if($model->date_end)
return date('d/m/Y',strtotime($model->date_end)) ;
else
return 'indéterminée' ;
}
],
[
'attribute' => 'lundi',
'attribute' => 'monday',
'label' => 'Jours',
'format' => 'raw',
'value' => function($model) {
$html = '' ;
if($model->lundi)
if($model->monday)
$html .= 'lundi, ' ;
if($model->mardi)
if($model->tuesday)
$html .= 'mardi, ' ;
if($model->mercredi)
if($model->wednesday)
$html .= 'mercredi, ' ;
if($model->jeudi)
if($model->thursday)
$html .= 'jeudi, ' ;
if($model->vendredi)
if($model->friday)
$html .= 'vendredi, ' ;
if($model->samedi)
if($model->saterday)
$html .= 'samedi, ' ;
if($model->dimanche)
if($model->sunday)
$html .= 'dimanche, ' ;
if(strlen($html))
@@ -135,19 +136,19 @@ $this->params['breadcrumbs'][] = $this->title;
}
],
[
'attribute' => 'periodicite_semaine',
'attribute' => 'week_frequency',
'value' => function($model) {
if($model->periodicite_semaine == 1)
if($model->week_frequency == 1)
return 'Toutes les semaines' ;
else
return 'Toutes les '.$model->periodicite_semaine.' semaines' ;
return 'Toutes les '.$model->week_frequency.' semaines' ;
}
],
[
'attribute' => 'paiement_automatique',
'attribute' => 'auto_payment',
'format' => 'raw',
'value' => function($model) {
if($model->paiement_automatique)
if($model->auto_payment)
return '<span class="label label-success">Oui</span>' ;
else
return '<span class="label label-danger">Non</span>' ;

backend/views/commandeauto/update.php → backend/views/subscription/update.php Vedi File

@@ -41,15 +41,15 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model app\models\Produit */

$this->title = 'Modifier une commande récurrente';
$this->params['breadcrumbs'][] = ['label' => 'Commandes récurrentes', 'url' => ['index']];
$this->title = 'Modifier un abonnement';
$this->params['breadcrumbs'][] = ['label' => 'Abonnements', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Modifier';
?>
<div class="commandeauto-update">
<div class="subscription-update">
<h1><?= Html::encode($this->title) ?></h1>

<?= $this->render('_form', [
'model' => $model,
'produits' => $produits
'productsArray' => $productsArray
]) ?>
</div>

Loading…
Annulla
Salva