|
- <?php
-
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
- use yii\helpers\ArrayHelper ;
- use common\models\User ;
- use common\models\PointVente ;
-
- ?>
-
- <div class="commandeauto-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'];
- }), ['prompt' => '--','class' => 'form-control user-id', ]) ?>
- </div>
- <div class="col-md-1" id="or-user">
- <span>OU</span>
- </div>
- <div class="col-md-6">
- <?= $form->field($model, 'username')->textInput() ?>
- </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'];
- }), ['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">
- <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() ?>
- </div>
- <div class="clr"></div>
- <?= $form->field($model, 'periodicite_semaine')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?>
-
- <div class="produits">
- <h2>Produits</h2>
- <?php if(isset($model->errors['produits']) && count($model->errors['produits']))
- {
- echo '<div class="alert alert-danger">'.$model->errors['produits'][0].'</div>' ;
- }
- ?>
- <table class="table table-bordered table-condensed table-hover">
- <?php foreach ($produits as $p) : ?>
- <tr>
- <td><?= Html::encode($p->nom) ?></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>
- </span>
- <?= Html::input('text', 'CommandeAutoForm[produits][produit_'.$p->id.']', (isset($model->produits['produit_'.$p->id])) ? $model->produits['produit_'.$p->id] : '', ['class' => 'form-control quantite']) ?>
- <span class="input-group-btn">
- <button class="btn btn-default btn-plus" type="button"><span class="glyphicon glyphicon-plus"></span></button>
- </span>
- </div>
- </td>
- </tr>
- <?php endforeach; ?>
- </table>
- </div>
-
- <?= Html::submitButton('Enregistrer' , ['class' => 'btn btn-primary']) ?>
- <?php ActiveForm::end(); ?>
- </div>
|