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.

74 lines
3.5KB

  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(['enableClientValidation' => false]); ?>
  10. <div class="col-md-5" id="bloc-select-user">
  11. <?= $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) {
  12. return $model['nom'].' '.$model['prenom'];
  13. }), ['prompt' => '--','class' => 'form-control user-id', ]) ?>
  14. </div>
  15. <div class="col-md-1" id="or-user">
  16. <span>OU</span>
  17. </div>
  18. <div class="col-md-6">
  19. <?= $form->field($model, 'username')->textInput() ?>
  20. </div>
  21. <div class="clr"></div>
  22. <?= $form->field($model, 'id_etablissement')->hiddenInput() ?>
  23. <?= $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) {
  24. return $model['nom'];
  25. }), ['prompt' => '--','class' => 'form-control user-id']) ?>
  26. <?= $form->field($model, 'date_debut') ?>
  27. <?= $form->field($model, 'date_fin')->hint('Laisser vide pour une durée indéterminée') ?>
  28. <div class="jours">
  29. <h2>Jours</h2>
  30. <?= $form->field($model, 'lundi')->checkbox() ?>
  31. <?= $form->field($model, 'mardi')->checkbox() ?>
  32. <?= $form->field($model, 'mercredi')->checkbox() ?>
  33. <?= $form->field($model, 'jeudi')->checkbox() ?>
  34. <?= $form->field($model, 'vendredi')->checkbox() ?>
  35. <?= $form->field($model, 'samedi')->checkbox() ?>
  36. <?= $form->field($model, 'dimanche')->checkbox() ?>
  37. </div>
  38. <div class="clr"></div>
  39. <?= $form->field($model, 'periodicite_semaine')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?>
  40. <div class="produits">
  41. <h2>Produits</h2>
  42. <?php if(isset($model->errors['produits']) && count($model->errors['produits']))
  43. {
  44. echo '<div class="alert alert-danger">'.$model->errors['produits'][0].'</div>' ;
  45. }
  46. ?>
  47. <table class="table table-bordered table-condensed table-hover">
  48. <?php foreach ($produits as $p) : ?>
  49. <tr>
  50. <td><?= Html::encode($p->nom) ?></td>
  51. <td>
  52. <div class="input-group">
  53. <span class="input-group-btn">
  54. <button class="btn btn-default btn-moins" type="button"><span class="glyphicon glyphicon-minus"></span></button>
  55. </span>
  56. <?= Html::input('text', 'CommandeAutoForm[produits][produit_'.$p->id.']', (isset($model->produits['produit_'.$p->id])) ? $model->produits['produit_'.$p->id] : '', ['class' => 'form-control quantite']) ?>
  57. <span class="input-group-btn">
  58. <button class="btn btn-default btn-plus" type="button"><span class="glyphicon glyphicon-plus"></span></button>
  59. </span>
  60. </div>
  61. </td>
  62. </tr>
  63. <?php endforeach; ?>
  64. </table>
  65. </div>
  66. <?= Html::submitButton('Enregistrer' , ['class' => 'btn btn-primary']) ?>
  67. <?php ActiveForm::end(); ?>
  68. </div>