You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
3.1KB

  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\ActiveForm;
  4. use yii\helpers\ArrayHelper ;
  5. use common\models\User ;
  6. use common\models\PointVente ;
  7. ?>
  8. <div class="commandeauto-form">
  9. <?php $form = ActiveForm::begin(); ?>
  10. <?= $form->field($model, 'id_user')->dropDownList( ArrayHelper::map(User::find()->joinWith('userEtablissement')->where('user_etablissement.id_etablissement = '.Yii::$app->user->identity->id_etablissement)->all(), 'id', function($model, $defaultValue) {
  11. return $model['nom'].' '.$model['prenom'];
  12. }), ['prompt' => '--','class' => 'form-control user-id', ]) ?>
  13. <?= $form->field($model, 'id_etablissement')->hiddenInput() ?>
  14. <?= $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) {
  15. return $model['nom'];
  16. }), ['prompt' => '--','class' => 'form-control user-id']) ?>
  17. <?= $form->field($model, 'date_debut') ?>
  18. <?= $form->field($model, 'date_fin')->hint('Laisser vide pour une durée indéterminée') ?>
  19. <div class="jours">
  20. <h2>Jours</h2>
  21. <?= $form->field($model, 'lundi')->checkbox() ?>
  22. <?= $form->field($model, 'mardi')->checkbox() ?>
  23. <?= $form->field($model, 'mercredi')->checkbox() ?>
  24. <?= $form->field($model, 'jeudi')->checkbox() ?>
  25. <?= $form->field($model, 'vendredi')->checkbox() ?>
  26. <?= $form->field($model, 'samedi')->checkbox() ?>
  27. <?= $form->field($model, 'dimanche')->checkbox() ?>
  28. </div>
  29. <div class="clr"></div>
  30. <?= $form->field($model, 'periodicite_semaine')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?>
  31. <div class="produits">
  32. <h2>Produits</h2>
  33. <?php if(isset($model->errors['produits']) && count($model->errors['produits']))
  34. {
  35. echo '<div class="alert alert-danger">'.$model->errors['produits'][0].'</div>' ;
  36. }
  37. ?>
  38. <table class="table table-bordered table-condensed table-hover">
  39. <?php foreach ($produits as $p) : ?>
  40. <tr>
  41. <td><?= Html::encode($p->nom) ?></td>
  42. <td>
  43. <div class="input-group">
  44. <span class="input-group-btn">
  45. <button class="btn btn-default btn-moins" type="button"><span class="glyphicon glyphicon-minus"></span></button>
  46. </span>
  47. <?= Html::input('text', 'CommandeAutoForm[produits][produit_'.$p->id.']', (isset($model->produits['produit_'.$p->id])) ? $model->produits['produit_'.$p->id] : '', ['class' => 'form-control quantite']) ?>
  48. <span class="input-group-btn">
  49. <button class="btn btn-default btn-plus" type="button"><span class="glyphicon glyphicon-plus"></span></button>
  50. </span>
  51. </div>
  52. </td>
  53. </tr>
  54. <?php endforeach; ?>
  55. </table>
  56. </div>
  57. <?= Html::submitButton('Enregistrer' , ['class' => 'btn btn-primary']) ?>
  58. <?php ActiveForm::end(); ?>
  59. </div>