Browse Source

Première version propre du formulaire de produits

Suppression des saisons, de l'ordre, mise en page des jours de production, traduction du titre et du bouton de validation.
master
keun 8 years ago
parent
commit
83df2ee28b
8 changed files with 49 additions and 16 deletions
  1. +4
    -1
      backend/controllers/ProduitController.php
  2. +13
    -13
      backend/views/produit/_form.php
  3. +1
    -1
      backend/views/produit/create.php
  4. +1
    -1
      backend/views/produit/update.php
  5. BIN
      backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc
  6. +14
    -0
      backend/web/css/screen.css
  7. +16
    -0
      backend/web/sass/screen.scss
  8. BIN
      frontend/web/uploads/rameau-556562071cbe4-5819ade284b89.jpg

+ 4
- 1
backend/controllers/ProduitController.php View File

@@ -92,7 +92,10 @@ class ProduitController extends Controller
public function actionCreate()
{
$model = new Produit();

$model->actif = 1 ;
$model->id_etablissement = Yii::$app->user->identity->id_etablissement ;
$model->saison = 'all' ;
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Upload::uploadFile($model, 'illustration') ;
Upload::uploadFile($model, 'photo') ;

+ 13
- 13
backend/views/produit/_form.php View File

@@ -13,12 +13,9 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>

<?= $form->field($model, 'actif')->radioList([1 => 'Oui',0 => 'Non' ]) ?>
<?= $form->field($model, 'order')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'nom')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'diminutif')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'recette')->textarea() ?>
<?= $form->field($model, 'saison')->dropDownList(['all' => 'Toutes les saisons', 'printemps' => 'Printemps', 'ete' => 'Été', 'automne' => 'Automne', 'hiver' => 'Hiver']) ; ?>
<?= $form->field($model, 'prix')->textInput() ?>
<?= $form->field($model, 'poids')->textInput() ?>
<?= $form->field($model, 'quantite_max')->textInput() ?>
@@ -31,19 +28,22 @@ use yii\widgets\ActiveForm;
}
?>
<h2>Production</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() ?>
<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>
<div class="clr"></div>
<?= $form->field($model, 'id_etablissement')->hiddenInput()->label('') ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?>

+ 1
- 1
backend/views/produit/create.php View File

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

$this->title = 'Create Produit';
$this->title = 'Ajouter un produit';
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

+ 1
- 1
backend/views/produit/update.php View File

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

$this->title = 'Update Produit: ' . ' ' . $model->id;
$this->title = 'Modifier un produit';
$this->params['breadcrumbs'][] = ['label' => 'Produits', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';

BIN
backend/web/.sass-cache/c8fef7d48da4dc7f024edc2b0fada9d8d6de5dac/screen.scssc View File


+ 14
- 0
backend/web/css/screen.css View File

@@ -331,3 +331,17 @@
#email-masse-form #ids-users .label {
text-transform: capitalize;
}

/* line 357, ../sass/screen.scss */
.produit-create #jours-production .form-group {
float: left;
margin-right: 15px;
}
/* line 361, ../sass/screen.scss */
.produit-create #jours-production .form-group label {
font-weight: normal;
}
/* line 366, ../sass/screen.scss */
.produit-create .field-produit-id_etablissement {
display: none;
}

+ 16
- 0
backend/web/sass/screen.scss View File

@@ -350,4 +350,20 @@
text-transform: capitalize ;
}
}
}

.produit-create {
#jours-production {
.form-group {
float: left ;
margin-right: 15px ;
label {
font-weight: normal ;
}
}
}
.field-produit-id_etablissement {
display: none;
}
}

BIN
frontend/web/uploads/rameau-556562071cbe4-5819ade284b89.jpg View File

Before After
Width: 602  |  Height: 400  |  Size: 24KB

Loading…
Cancel
Save