@@ -256,7 +256,7 @@ $this->setPageTitle('Distributions') ; | |||
<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> | |||
</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" v-else>{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | |||
</li> |
@@ -240,13 +240,21 @@ var app = new Vue({ | |||
} | |||
}, | |||
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.setIdActivePointSale(0) ; | |||
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) { | |||
this.setIdActivePointSale(0) ; | |||
@@ -254,14 +262,6 @@ var app = new Vue({ | |||
if(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) { | |||
this.date = day.date ; |
@@ -242,6 +242,10 @@ class Product extends ActiveRecordCommon | |||
public function isAvailableOnPointSale($pointSale) | |||
{ | |||
if(!$pointSale) { | |||
return false; | |||
} | |||
// disponible par défaut | |||
if ($this->available_on_points_sale) { | |||
foreach ($this->productPointSale as $productPointSale) { |
@@ -149,7 +149,7 @@ class SubscriptionForm extends Model | |||
$subscription->saturday = $this->saturday; | |||
$subscription->sunday = $this->sunday; | |||
$subscription->week_frequency = $this->week_frequency; | |||
$subscription->auto_payment = $this->auto_payment; | |||
$subscription->auto_payment = (int) $this->auto_payment; | |||
$subscription->comment = $this->comment; | |||
$subscription->save(); |
@@ -104,8 +104,7 @@ class SubscriptionController extends ProducerBaseController | |||
} | |||
} | |||
if ($model->load($posts) && $model->validate() | |||
&& $model->save()) { | |||
if ($model->load($posts) && $model->validate() && $model->save()) { | |||
$subscription = Subscription::searchOne([ | |||
'id' => $model->id | |||
]); | |||
@@ -295,6 +294,10 @@ class SubscriptionController extends ProducerBaseController | |||
]), | |||
] | |||
); | |||
if($product['unit'] == 'piece' && is_null($product['step'])) { | |||
$product['step'] = 1; | |||
} | |||
} | |||
$params['products'] = $productsArray; |
@@ -184,11 +184,13 @@ $producer = $this->context->getProducer(); | |||
if($pointSaleDistributions && count($pointSaleDistributions) > 0) { | |||
echo '<div class="point-sales">' ; | |||
foreach($pointSaleDistributions as $pointSaleDistribution) { | |||
if($pointSaleDistribution->pointSale->status == 1) { | |||
echo $pointSaleDistribution->pointSale->name.'' ; | |||
if(strlen($pointSaleDistribution->pointSale->locality)) { | |||
echo ' ('.$pointSaleDistribution->pointSale->locality.')' ; | |||
echo ' ('.$pointSaleDistribution->pointSale->locality.')' ; | |||
} | |||
echo '<br />' ; | |||
} | |||
} | |||
echo '</div>' ; | |||
} |
@@ -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; ?> |
@@ -116,12 +116,7 @@ var app = new Vue({ | |||
} | |||
}, | |||
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) { | |||
this.lastCountDays = count; | |||
@@ -195,6 +190,7 @@ var app = new Vue({ | |||
} | |||
} | |||
console.log(this.autoPayment); | |||
axios.post('ajax-process', { | |||
idSubscription: this.idSubscription, | |||
SubscriptionForm: { | |||
@@ -202,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: 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, |