|
|
@@ -40,15 +40,15 @@ use yii\helpers\Html; |
|
|
|
use yii\widgets\ActiveForm; |
|
|
|
use yii\helpers\ArrayHelper ; |
|
|
|
use common\models\User ; |
|
|
|
use common\models\PointVente ; |
|
|
|
use common\models\PointSale ; |
|
|
|
|
|
|
|
?> |
|
|
|
|
|
|
|
<div class="commandeauto-form"> |
|
|
|
<div class="subscription-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']; |
|
|
|
<?= $form->field($model, 'id_user')->dropDownList( ArrayHelper::map(User::find()->joinWith('userProducer')->where('user_producer.id_producer = '.Producer::getId())->andWhere('user_producer.active = 1')->orderBy('lastname ASC, name ASC')->all(), 'id', function($model, $defaultValue) { |
|
|
|
return $model['lastname'].' '.$model['name']; |
|
|
|
}), ['prompt' => '--','class' => 'form-control user-id', ]) ?> |
|
|
|
</div> |
|
|
|
<div class="col-md-1" id="or-user"> |
|
|
@@ -59,49 +59,49 @@ use common\models\PointVente ; |
|
|
|
</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']; |
|
|
|
<?= $form->field($model, 'id_producer')->hiddenInput() ?> |
|
|
|
<?= $form->field($model, 'id_point_sale')->dropDownList(ArrayHelper::map(PointSale::find()->where('id_producer = '.Producer::getId())->all(), 'id', function($model, $defaultValue) { |
|
|
|
return $model['name']; |
|
|
|
}), ['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"> |
|
|
|
<?= $form->field($model, 'date_begin') ?> |
|
|
|
<?= $form->field($model, 'date_end')->hint('Laisser vide pour une durée indéterminée') ?> |
|
|
|
<div class="days"> |
|
|
|
<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() ?> |
|
|
|
<?= $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, 'saterday')->checkbox() ?> |
|
|
|
<?= $form->field($model, 'sunday')->checkbox() ?> |
|
|
|
</div> |
|
|
|
<div class="clr"></div> |
|
|
|
<?= $form->field($model, 'periodicite_semaine')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?> |
|
|
|
<?= $form->field($model, 'week_frequency')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?> |
|
|
|
|
|
|
|
<?= $form->field($model, 'paiement_automatique') |
|
|
|
<?= $form->field($model, 'auto_payment') |
|
|
|
->checkbox() |
|
|
|
->hint('Cochez cette case si vous souhaitez que le crédit pain du client soit automatiquement débité lors de la création de la commande.<br />' |
|
|
|
. 'Attention, un compte client existant doit être spécifié en haut de ce formulaire.') ?> |
|
|
|
|
|
|
|
<div class="produits"> |
|
|
|
<div class="products"> |
|
|
|
<h2>Produits</h2> |
|
|
|
<?php if(isset($model->errors['produits']) && count($model->errors['produits'])) |
|
|
|
<?php if(isset($model->errors['products']) && count($model->errors['products'])) |
|
|
|
{ |
|
|
|
echo '<div class="alert alert-danger">'.$model->errors['produits'][0].'</div>' ; |
|
|
|
echo '<div class="alert alert-danger">'.$model->errors['products'][0].'</div>' ; |
|
|
|
} |
|
|
|
?> |
|
|
|
<table class="table table-bordered table-condensed table-hover"> |
|
|
|
<?php foreach ($produits as $p) : ?> |
|
|
|
<?php foreach ($productsArray as $p) : ?> |
|
|
|
<tr> |
|
|
|
<td><?= Html::encode($p->nom) ?></td> |
|
|
|
<td><?= Html::encode($p->name) ?></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> |
|
|
|
<button class="btn btn-default btn-minus" 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']) ?> |
|
|
|
<?= Html::input('text', 'SubscriptionForm[products][product_'.$p->id.']', (isset($model->products['product_'.$p->id])) ? $model->products['product_'.$p->id] : '', ['class' => 'form-control quantity']) ?> |
|
|
|
<span class="input-group-btn"> |
|
|
|
<button class="btn btn-default btn-plus" type="button"><span class="glyphicon glyphicon-plus"></span></button> |
|
|
|
<button class="btn btn-default btn-more" type="button"><span class="glyphicon glyphicon-plus"></span></button> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</td> |