|
|
|
|
|
|
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
use yii\helpers\Html; |
|
|
use yii\helpers\Html; |
|
|
use yii\widgets\ActiveForm; |
|
|
|
|
|
|
|
|
use yii\bootstrap\ActiveForm; |
|
|
|
|
|
use common\models\Product; |
|
|
|
|
|
use yii\helpers\ArrayHelper ; |
|
|
|
|
|
|
|
|
/* @var $this yii\web\View */ |
|
|
/* @var $this yii\web\View */ |
|
|
/* @var $model app\models\Produit */ |
|
|
/* @var $model app\models\Produit */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> |
|
|
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> |
|
|
|
|
|
|
|
|
<?= $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, '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.') |
|
|
|
|
|
->textInput() ?> |
|
|
|
|
|
|
|
|
|
|
|
<?= $form->field($model, 'photo')->fileInput() ?> |
|
|
|
|
|
<?php |
|
|
|
|
|
if(strlen($model->photo)) { |
|
|
|
|
|
$url = Yii::$app->urlManagerProducer->getHostInfo().'/'.Yii::$app->urlManagerProducer->baseUrl ; |
|
|
|
|
|
echo '<img class="photo-product" src="'.$url.'/uploads/'.$model->photo.'" width="200px" /><br />' ; |
|
|
|
|
|
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label><br /><br />' ; |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
<h2>Jours de distribution</h2> |
|
|
|
|
|
<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, 'saturday')->checkbox() ?> |
|
|
|
|
|
<?= $form->field($model, 'sunday')->checkbox() ?> |
|
|
|
|
|
|
|
|
<div> |
|
|
|
|
|
<div class="col-md-8"> |
|
|
|
|
|
<?= $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, 'recipe')->textarea()->label('Description longue') ?> |
|
|
|
|
|
|
|
|
|
|
|
<?= $form->field($model, 'unit') |
|
|
|
|
|
->dropDownList(ArrayHelper::map(Product::$unitsArray, 'unit', 'wording')) |
|
|
|
|
|
->label('Unité (pièce, poids ou volume)'); ?> |
|
|
|
|
|
<?= $form->field($model, 'price',[ |
|
|
|
|
|
'inputTemplate' => '<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>', |
|
|
|
|
|
]) ?> |
|
|
|
|
|
<?= $form->field($model, 'step')->textInput()->hint('Définit ce qui est ajouté ou enlevé lors des changements de quantité.') ?> |
|
|
|
|
|
|
|
|
|
|
|
<?= $form->field($model, 'weight')->textInput()->label('Poids (g)') ?> |
|
|
|
|
|
<?= $form->field($model, 'quantity_max') |
|
|
|
|
|
->hint('Renseignez ce champs si vous souhaitez limiter la quantité commandable pour une distribution.') |
|
|
|
|
|
->textInput() ?> |
|
|
|
|
|
<?php |
|
|
|
|
|
if(!$model->isNewRecord) { |
|
|
|
|
|
echo $form->field($model, 'apply_distributions') |
|
|
|
|
|
->checkbox() |
|
|
|
|
|
->hint('Sélectionnez cette option si vous souhaitez que ces modifications soient répercutées dans les distributions à venir déjà initialisées.'); |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-md-4"> |
|
|
|
|
|
<?= $form->field($model, 'photo')->fileInput() ?> |
|
|
|
|
|
<?php |
|
|
|
|
|
if(strlen($model->photo)) { |
|
|
|
|
|
$url = Yii::$app->urlManagerProducer->getHostInfo().'/'.Yii::$app->urlManagerProducer->baseUrl ; |
|
|
|
|
|
echo '<img class="photo-product" src="'.$url.'/uploads/'.$model->photo.'" width="200px" /><br />' ; |
|
|
|
|
|
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label><br /><br />' ; |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
<div id="days-production"> |
|
|
|
|
|
<h2>Jours de distribution</h2> |
|
|
|
|
|
<?= $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, 'saturday')->checkbox() ?> |
|
|
|
|
|
<?= $form->field($model, 'sunday')->checkbox() ?> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="clr"></div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="clr"></div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="clr"></div> |
|
|
|
|
|
|
|
|
|
|
|
<?= $form->field($model, 'id_producer')->hiddenInput()->label('') ?> |
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
|
if(!$model->isNewRecord) { |
|
|
|
|
|
echo $form->field($model, 'apply_distributions') |
|
|
|
|
|
->checkbox() |
|
|
|
|
|
->hint('Sélectionnez cette option si vous souhaitez que ces modifications soient répercutées dans les distributions à venir déjà initialisées.'); |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?= $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']) ?> |
|
|
</div> |
|
|
</div> |