浏览代码

[Espace producteurs] Correctif abonnements

prodstable
Guillaume Bourgeois 1年前
父节点
当前提交
2acc62fdca
共有 3 个文件被更改,包括 5 次插入9 次删除
  1. +2
    -7
      producer/controllers/SubscriptionController.php
  2. +1
    -1
      producer/views/subscription/_form.php
  3. +2
    -1
      producer/web/js/vuejs/subscription-form.js

+ 2
- 7
producer/controllers/SubscriptionController.php 查看文件

@@ -104,11 +104,7 @@ class SubscriptionController extends ProducerBaseController
}
}

if ($model->load($posts)) {

$model->auto_payment = (int) $posts['auto_payment'];

if($model->validate() && $model->save()) {
if ($model->load($posts) && $model->validate() && $model->save()) {
$subscription = Subscription::searchOne([
'id' => $model->id
]);
@@ -120,7 +116,6 @@ class SubscriptionController extends ProducerBaseController
Yii::$app->getSession()->setFlash('success', 'Abonnement ajouté');
}
}
}
}

/**
@@ -175,7 +170,7 @@ class SubscriptionController extends ProducerBaseController
$model->friday = $subscription->friday;
$model->saturday = $subscription->saturday;
$model->sunday = $subscription->sunday;
$model->auto_payment = (int) $subscription->auto_payment;
$model->auto_payment = $subscription->auto_payment;
$model->week_frequency = $subscription->week_frequency;

// produits

+ 1
- 1
producer/views/subscription/_form.php 查看文件

@@ -137,7 +137,7 @@ use common\models\PointSale ;
<?php if(Producer::getConfig('credit')): ?>
<div class="form-group field-subscriptionform-auto_payment">
<label><input type="checkbox" id="subscriptionform-auto_payment" name="SubscriptionForm[auto_payment]" v-model="autoPayment"> Paiement automatique</label>
<div class="hint-block">Cochez cette case si vous souhaitez que votre Crédit soit automatiquement débité.</div>
<div class="hint-block">Cochez cette case si vous souhaitez que votre Crédit soit automatiquement débité.</div>
<div class="help-block"></div>
</div>
<?php endif; ?>

+ 2
- 1
producer/web/js/vuejs/subscription-form.js 查看文件

@@ -190,6 +190,7 @@ var app = new Vue({
}
}

console.log(this.autoPayment);
axios.post('ajax-process', {
idSubscription: this.idSubscription,
SubscriptionForm: {
@@ -197,7 +198,7 @@ var app = new Vue({
date_begin: this.dateBegin ? this.formatDate(this.dateBegin) : '',
date_end: this.dateEnd ? this.formatDate(this.dateEnd) : '',
week_frequency: this.weekFrequency,
auto_payment: parseInt(this.autoPayment),
auto_payment: this.autoPayment ? 1 : 0,
monday: this.monday == true ? 1 : 0,
tuesday: this.tuesday == true ? 1 : 0,
wednesday: this.wednesday == true ? 1 : 0,

正在加载...
取消
保存