瀏覽代碼

Merge branch 'develop' of https://forge.laclic.fr/Laclic/Opendistrib into develop

feature/souke
Guillaume 1 年之前
父節點
當前提交
1e4a2c3fb8
共有 8 個文件被更改,包括 30 次插入25 次删除
  1. +1
    -1
      backend/views/distribution/index.php
  2. +12
    -12
      backend/web/js/vuejs/distribution-index.js
  3. +4
    -0
      common/models/Product.php
  4. +1
    -1
      common/models/SubscriptionForm.php
  5. +5
    -2
      producer/controllers/SubscriptionController.php
  6. +3
    -1
      producer/views/order/order.php
  7. +1
    -1
      producer/views/subscription/_form.php
  8. +3
    -7
      producer/web/js/vuejs/subscription-form.js

+ 1
- 1
backend/views/distribution/index.php 查看文件

@@ -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>

+ 12
- 12
backend/web/js/vuejs/distribution-index.js 查看文件

@@ -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 ;

+ 4
- 0
common/models/Product.php 查看文件

@@ -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) {

+ 1
- 1
common/models/SubscriptionForm.php 查看文件

@@ -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();

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

@@ -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;

+ 3
- 1
producer/views/order/order.php 查看文件

@@ -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>' ;
}

+ 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; ?>

+ 3
- 7
producer/web/js/vuejs/subscription-form.js 查看文件

@@ -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,

Loading…
取消
儲存