Browse Source

Refactoring/traduction vues backend/views/product

dev
Guillaume Bourgeois 6 years ago
parent
commit
e2357dfbb9
4 changed files with 24 additions and 34 deletions
  1. +16
    -26
      backend/views/product/_form.php
  2. +1
    -1
      backend/views/product/create.php
  3. +6
    -6
      backend/views/product/index.php
  4. +1
    -1
      backend/views/product/update.php

backend/views/produit/_form.php → backend/views/product/_form.php View File

/* @var $form yii\widgets\ActiveForm */ /* @var $form yii\widgets\ActiveForm */
?> ?>


<div class="produit-form">
<div class="product-form">


<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>


<?= $form->field($model, 'actif')->radioList([1 => 'Oui',0 => 'Non' ]) ?>
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'active')->radioList([1 => 'Oui',0 => 'Non' ]) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?> <?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'recette')->textarea() ?>
<?= $form->field($model, 'prix')->textInput() ?>
<?= $form->field($model, 'poids')->textInput() ?>
<?= $form->field($model, 'quantite_max')
<?= $form->field($model, 'recipe')->textarea() ?>
<?= $form->field($model, 'price')->textInput() ?>
<?= $form->field($model, 'weight')->textInput() ?>
<?= $form->field($model, 'quantity_max')
->hint('Renseignez ce champs si vous souhaitez limiter la quantité commandable pour ce produit.') ->hint('Renseignez ce champs si vous souhaitez limiter la quantité commandable pour ce produit.')
->textInput() ?> ->textInput() ?>
} }
?> ?>
<?php if(Yii::$app->user->identity->id_etablissement == 1): ?>
<?= $form->field($model, 'illustration')->fileInput() ?>
<?php
if(strlen($model->illustration)) {
echo '<img src="../../frontend/web/uploads/'.$model->illustration.'" width="200px" /><br />' ;
echo '<input type="checkbox" name="delete_illustration" id="delete_illustration" /> <label for="delete_illustration">Supprimer l\'illustration</label><br /><br />' ;
}
?>
<?php endif; ?>
<h2>Jours de production</h2> <h2>Jours de production</h2>
<div id="jours-production">
<?= $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() ?>
<div id="days-production">
<?= $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>
<div class="clr"></div> <div class="clr"></div>
<?= $form->field($model, 'id_etablissement')->hiddenInput()->label('') ?>
<?= $form->field($model, 'id_producer')->hiddenInput()->label('') ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>

backend/views/produit/create.php → backend/views/product/create.php View File

$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = 'Ajouter'; $this->params['breadcrumbs'][] = 'Ajouter';
?> ?>
<div class="produit-create">
<div class="product-create">


<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>



backend/views/produit/index.php → backend/views/product/index.php View File

$this->title = 'Produits'; $this->title = 'Produits';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="produit-index">
<div class="product-index">


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


'headerOptions' => ['class' => 'td-photo'], 'headerOptions' => ['class' => 'td-photo'],
'value' => function($model) { 'value' => function($model) {
if(strlen($model->photo)) { if(strlen($model->photo)) {
$url = Url::frontend() ;
$url = Yii::$app->urlManagerProducer->getBaseUrl() ;
return '<img class="photo-produit" src="'.$url.'uploads/'.$model->photo.'" />' ; return '<img class="photo-produit" src="'.$url.'uploads/'.$model->photo.'" />' ;
} }
return '' ; return '' ;
} }
], ],
'nom',
'name',
'description', 'description',
[ [
'attribute' => 'actif',
'headerOptions' => ['class' => 'actif'],
'attribute' => 'active',
'headerOptions' => ['class' => 'active'],
'contentOptions' => ['class' => 'center'], 'contentOptions' => ['class' => 'center'],
'format' => 'raw', 'format' => 'raw',
'value' => function($model) { 'value' => function($model) {
if($model->actif)
if($model->active)
{ {
return '<span class="label label-success">oui</span>' ; return '<span class="label label-success">oui</span>' ;
} }

backend/views/produit/update.php → backend/views/product/update.php View File

$this->params['breadcrumbs'][] = ['label' => $model->nom, 'url' => ['update', 'id' => $model->id]]; $this->params['breadcrumbs'][] = ['label' => $model->nom, 'url' => ['update', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Modifier'; $this->params['breadcrumbs'][] = 'Modifier';
?> ?>
<div class="produit-update">
<div class="product-update">


<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>



Loading…
Cancel
Save