<a class="btn btn-default btn-primary" v-if="idActivePointSale == 0">Tous <span class="label label-default">{{ orders.length }}</span> <span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default btn-primary" v-if="idActivePointSale == 0">Tous <span class="label label-default">{{ orders.length }}</span> <span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
<a class="btn btn-default" v-else>Tous <span class="label label-default">{{ orders.length }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default" v-else>Tous <span class="label label-default">{{ orders.length }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
</li> | </li> | ||||
<li v-for="pointSale in pointsSale" :data-id-point-sale="pointSale.id" v-if="pointSale.pointSaleDistribution[0].delivery == 1" @click="pointSaleClick"> | |||||
<li v-for="pointSale in pointsSale" :data-id-point-sale="pointSale.id" v-if="pointSale.pointSaleDistribution[0].delivery == 1 && (pointSale.status == 1 || countOrdersByPointSale[pointSale.id] > 0)" @click="pointSaleClick"> | |||||
<a class="btn btn-default btn-primary" v-if="idActivePointSale == pointSale.id">{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default btn-primary" v-if="idActivePointSale == pointSale.id">{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
<a class="btn btn-default" v-else>{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default" v-else>{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
</li> | </li> |
} | } | ||||
}, | }, | ||||
initPointsSale: function(idActivePointSale) { | initPointsSale: function(idActivePointSale) { | ||||
this.countOrdersByPointSale = [] ; | |||||
for(var i = 0; i < this.pointsSale.length ; i++) { | |||||
this.countOrdersByPointSale[this.pointsSale[i].id] = 0 ; | |||||
} | |||||
for(var i = 0; i < this.orders.length ; i++) { | |||||
this.countOrdersByPointSale[this.orders[i].id_point_sale] ++ ; | |||||
} | |||||
this.countActivePointsSale = 0 ; | this.countActivePointsSale = 0 ; | ||||
this.setIdActivePointSale(0) ; | this.setIdActivePointSale(0) ; | ||||
for(var i= 0; i < this.pointsSale.length; i++) { | for(var i= 0; i < this.pointsSale.length; i++) { | ||||
if(this.pointsSale[i].pointSaleDistribution[0].delivery == 1) { | |||||
this.countActivePointsSale ++ ; | |||||
this.setIdActivePointSale(this.pointsSale[i].id) ; | |||||
} | |||||
if(this.pointsSale[i].pointSaleDistribution[0].delivery == 1 && (this.pointsSale[i].status == 1 || this.countOrdersByPointSale[this.pointsSale[i].id] > 0)) { | |||||
this.countActivePointsSale ++ ; | |||||
this.setIdActivePointSale(this.pointsSale[i].id) ; | |||||
} | |||||
} | } | ||||
if(this.countActivePointsSale > 1) { | if(this.countActivePointsSale > 1) { | ||||
this.setIdActivePointSale(0) ; | this.setIdActivePointSale(0) ; | ||||
if(idActivePointSale) { | if(idActivePointSale) { | ||||
this.setIdActivePointSale(idActivePointSale) ; | this.setIdActivePointSale(idActivePointSale) ; | ||||
} | } | ||||
this.countOrdersByPointSale = [] ; | |||||
for(var i = 0; i < this.pointsSale.length ; i++) { | |||||
this.countOrdersByPointSale[this.pointsSale[i].id] = 0 ; | |||||
} | |||||
for(var i = 0; i < this.orders.length ; i++) { | |||||
this.countOrdersByPointSale[this.orders[i].id_point_sale] ++ ; | |||||
} | |||||
}, | }, | ||||
dayClicked: function(day) { | dayClicked: function(day) { | ||||
this.date = day.date ; | this.date = day.date ; |
public function isAvailableOnPointSale($pointSale) | public function isAvailableOnPointSale($pointSale) | ||||
{ | { | ||||
if(!$pointSale) { | |||||
return false; | |||||
} | |||||
// disponible par défaut | // disponible par défaut | ||||
if ($this->available_on_points_sale) { | if ($this->available_on_points_sale) { | ||||
foreach ($this->productPointSale as $productPointSale) { | foreach ($this->productPointSale as $productPointSale) { |
$subscription->saturday = $this->saturday; | $subscription->saturday = $this->saturday; | ||||
$subscription->sunday = $this->sunday; | $subscription->sunday = $this->sunday; | ||||
$subscription->week_frequency = $this->week_frequency; | $subscription->week_frequency = $this->week_frequency; | ||||
$subscription->auto_payment = $this->auto_payment; | |||||
$subscription->auto_payment = (int) $this->auto_payment; | |||||
$subscription->comment = $this->comment; | $subscription->comment = $this->comment; | ||||
$subscription->save(); | $subscription->save(); |
} | } | ||||
} | } | ||||
if ($model->load($posts) && $model->validate() | |||||
&& $model->save()) { | |||||
if ($model->load($posts) && $model->validate() && $model->save()) { | |||||
$subscription = Subscription::searchOne([ | $subscription = Subscription::searchOne([ | ||||
'id' => $model->id | 'id' => $model->id | ||||
]); | ]); | ||||
]), | ]), | ||||
] | ] | ||||
); | ); | ||||
if($product['unit'] == 'piece' && is_null($product['step'])) { | |||||
$product['step'] = 1; | |||||
} | |||||
} | } | ||||
$params['products'] = $productsArray; | $params['products'] = $productsArray; |
if($pointSaleDistributions && count($pointSaleDistributions) > 0) { | if($pointSaleDistributions && count($pointSaleDistributions) > 0) { | ||||
echo '<div class="point-sales">' ; | echo '<div class="point-sales">' ; | ||||
foreach($pointSaleDistributions as $pointSaleDistribution) { | foreach($pointSaleDistributions as $pointSaleDistribution) { | ||||
if($pointSaleDistribution->pointSale->status == 1) { | |||||
echo $pointSaleDistribution->pointSale->name.'' ; | echo $pointSaleDistribution->pointSale->name.'' ; | ||||
if(strlen($pointSaleDistribution->pointSale->locality)) { | if(strlen($pointSaleDistribution->pointSale->locality)) { | ||||
echo ' ('.$pointSaleDistribution->pointSale->locality.')' ; | |||||
echo ' ('.$pointSaleDistribution->pointSale->locality.')' ; | |||||
} | } | ||||
echo '<br />' ; | echo '<br />' ; | ||||
} | |||||
} | } | ||||
echo '</div>' ; | echo '</div>' ; | ||||
} | } |
<?php if(Producer::getConfig('credit')): ?> | <?php if(Producer::getConfig('credit')): ?> | ||||
<div class="form-group field-subscriptionform-auto_payment"> | <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> | <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 class="help-block"></div> | ||||
</div> | </div> | ||||
<?php endif; ?> | <?php endif; ?> |
} | } | ||||
}, | }, | ||||
dayChange: function () { | dayChange: function () { | ||||
console.log(this.monday + ' ' + this.tuesday + ' ' + this.wednesday + ' ' + | |||||
this.thursday + ' ' + this.friday + ' ' + this.saturday + ' ' + this.sunday); | |||||
var count = Number(this.monday) + Number(this.tuesday) + Number(this.wednesday) | |||||
+ Number(this.thursday) + Number(this.friday) + Number(this.saturday) | |||||
+ Number(this.sunday); | |||||
var count = Number(this.monday) + Number(this.tuesday) + Number(this.wednesday) + Number(this.thursday) + Number(this.friday) + Number(this.saturday) + Number(this.sunday); | |||||
if (count == 1 && this.lastCountDays == 0) { | if (count == 1 && this.lastCountDays == 0) { | ||||
this.lastCountDays = count; | this.lastCountDays = count; | ||||
} | } | ||||
} | } | ||||
console.log(this.autoPayment); | |||||
axios.post('ajax-process', { | axios.post('ajax-process', { | ||||
idSubscription: this.idSubscription, | idSubscription: this.idSubscription, | ||||
SubscriptionForm: { | SubscriptionForm: { | ||||
date_begin: this.dateBegin ? this.formatDate(this.dateBegin) : '', | date_begin: this.dateBegin ? this.formatDate(this.dateBegin) : '', | ||||
date_end: this.dateEnd ? this.formatDate(this.dateEnd) : '', | date_end: this.dateEnd ? this.formatDate(this.dateEnd) : '', | ||||
week_frequency: this.weekFrequency, | week_frequency: this.weekFrequency, | ||||
auto_payment: this.autoPayment, | |||||
auto_payment: this.autoPayment ? 1 : 0, | |||||
monday: this.monday == true ? 1 : 0, | monday: this.monday == true ? 1 : 0, | ||||
tuesday: this.tuesday == true ? 1 : 0, | tuesday: this.tuesday == true ? 1 : 0, | ||||
wednesday: this.wednesday == true ? 1 : 0, | wednesday: this.wednesday == true ? 1 : 0, |