|
- <?php
-
-
-
- use domain\Subscription\Subscription\Subscription;
- use yii\helpers\ArrayHelper;
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
-
- $userModule = $this->getUserModule();
- $pointSaleModule = $this->getPointSaleModule();
-
- ?>
-
- <div class="subscription-form" id="app-subscription-form">
- <?php $form = ActiveForm::begin(['enableClientValidation' => false]); ?>
- <?php if($model->id): ?>
- <?= $form->field($model, 'id')->hiddenInput() ?>
- <?php endif; ?>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="fa fa-th-list"></i>
- Général
- </h3>
- </div>
- <div class="panel-body">
- <div class="col-md-5" id="bloc-select-user">
- <?= $form->field($model, 'id_user')->dropDownList($userModule->populateUserDropdownList(), ['class' => 'select2']); ?>
- </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_producer')->hiddenInput() ?>
- <?= $form->field($model, 'id_point_sale')->dropDownList(ArrayHelper::map($pointSaleModule->findPointSales(), 'id', function($model, $defaultValue) {
- return $model['name'];
- }), ['prompt' => '--','class' => 'form-control user-id']) ?>
- <?= $form->field($model, 'date_begin') ?>
- <?= $form->field($model, 'date_end')->hint('Laisser vide pour une durée indéterminée') ?>
- </div>
- </div>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="fa fa-calendar"></i>
- Jours et fréquence
- </h3>
- </div>
- <div class="panel-body">
- <div class="days">
- <?= $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>
- <?= $form->field($model, 'week_frequency')->dropDownList([1=>1, 2=>2, 3=>3, 4=>4]) ?>
- </div>
- </div>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <span class="glyphicon glyphicon-piggy-bank"></span>
- Cagnotte
- </h3>
- </div>
- <div class="panel-body">
- <?= $form->field($model, 'auto_payment')
- ->dropDownList([
- Subscription::AUTO_PAYMENT_DEDUCTED => 'Déduit',
- Subscription::AUTO_PAYMENT_YES => 'Oui',
- Subscription::AUTO_PAYMENT_NO => 'Non'
- ])
- ->hint('Attention, un compte client existant doit être spécifié en haut de ce formulaire.') ?>
- </div>
- </div>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="fa fa-clone"></i>
- Produits
- </h3>
- </div>
- <div class="panel-body">
- <div class="products">
- <?php if(isset($model->errors['products']) && count($model->errors['products']))
- {
- echo '<div class="alert alert-danger">'.$model->errors['products'][0].'</div>' ;
- }
- ?>
- <table class="table table-bordered table-condensed table-hover" id="products">
- <tr v-for="product in products" v-if="product.is_available_for_subscriptions == 1 || (product.is_available_for_subscriptions == 0 && product.quantity > 0)">
- <td>
- {{ product.name }}
- <template v-if="product.is_available_for_subscriptions == 0">
- <br /><span class="label label-warning">Indisponible pour les abonnements</span>
- </template>
- </td>
- <td>
- <input type="hidden" :value="product.step" :name="'product_step_'+product.step" />
- <input type="hidden" :value="product.price" :name="'product_price_'+product.price" />
- <div class="input-group">
- <span class="input-group-btn">
- <button class="btn btn-default" type="button" @click="changeQuantityProductSubscription(false, product)"><span class="glyphicon glyphicon-minus"></span></button>
- </span>
- <input v-model="product.quantity" :name="'SubscriptionForm[products][product_'+product.id+']'" class="form-control input-quantity" />
- <div class="input-group-addon">
- <span>{{ product.wording_unit }}</span>
- </div>
- <span class="input-group-btn">
- <button class="btn btn-default" type="button" @click="changeQuantityProductSubscription(true, product)"><span class="glyphicon glyphicon-plus"></span></button>
- </span>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="fa fa-comment"></i>
- Commentaire
- </h3>
- </div>
- <div class="panel-body">
- <?= $form->field($model, 'comment')->textarea(['rows' => 6]) ?>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <?= Html::a('Retour', ['subscription/index'], ['class' => 'btn btn-default']) ?>
- <?= Html::submitButton($model->id ? 'Modifier' : 'Créer', ['class' => 'btn btn-primary']) ?>
- </div>
-
- <?php ActiveForm::end(); ?>
- </div>
|