Bladeren bron

Correctifs

dev
Guillaume 3 jaren geleden
bovenliggende
commit
272f41d8e6
2 gewijzigde bestanden met toevoegingen van 54 en 35 verwijderingen
  1. +0
    -1
      producer/controllers/OrderController.php
  2. +54
    -34
      producer/web/js/vuejs/order-order.js

+ 0
- 1
producer/controllers/OrderController.php Bestand weergeven

@@ -701,7 +701,6 @@ class OrderController extends ProducerBaseController
'id_user' => User::getCurrentId(),
] ;

//if($pointSaleId && $producer->option_order_entry_point == Producer::ORDER_ENTRY_POINT_POINT_SALE) {
if($pointSaleId) {
$conditionOrderUser['id_point_sale'] = $pointSaleId ;
}

+ 54
- 34
producer/web/js/vuejs/order-order.js Bestand weergeven

@@ -114,11 +114,16 @@ var app = new Vue({
}
}
},
init: function(type) {
init: function(type, oldStep, step) {

var app = this ;
this.loading = true ;

if(app.isChangeState('date', 'date', 'point-sale')) {
app.pointSaleActive = null ;
app.products = [] ;
}

axios.get("ajax-infos",{params: {
date : this.getDate(),
pointSaleId: this.pointSaleActive ? this.pointSaleActive.id : 0
@@ -187,42 +192,59 @@ var app = new Vue({
}
}

// produits
if(response.data.products) {
app.products = response.data.products ;
}

// catégories
if(response.data.categories) {
app.categories = response.data.categories ;
app.setCategoryCurrent(response.data.categories[0]) ;
}

// producer
app.producer = response.data.producer;

// user
app.user = response.data.user;

if(type != 'products') {
// use credit
app.useCredit = response.data.producer.use_credit_checked_default;

app.producer = response.data.producer;
app.user = response.data.user;
app.useCredit = response.data.producer.use_credit_checked_default;
// points de vente
if (response.data.points_sale) {
app.pointsSale = [];
var orderPointSale = 0;
for (var key in response.data.points_sale) {
response.data.points_sale[key].order = orderPointSale++;
app.pointsSale[response.data.points_sale[key].id] = response.data.points_sale[key];
app.pointsSaleCodes[response.data.points_sale[key].id] = '';
Vue.set(app.pointsSaleCodes, response.data.points_sale[key].id, '');
}
}

if (response.data.points_sale) {
app.pointsSale = [];
var orderPointSale = 0;
for (var key in response.data.points_sale) {
response.data.points_sale[key].order = orderPointSale++;
app.pointsSale[response.data.points_sale[key].id] = response.data.points_sale[key];
app.pointsSaleCodes[response.data.points_sale[key].id] = '';
Vue.set(app.pointsSaleCodes, response.data.points_sale[key].id, '');
}
if(app.isChangeState('point-sale', 'point-sale', 'date')) {
app.date = null ;
app.dateFormat = null ;
}

// update order
var updateOrder = false ;
if(app.isChangeState('date', 'point-sale', 'products')
|| app.isChangeState('date', 'date', 'point-sale')
|| app.isChangeState('point-sale', 'date', 'products')
|| app.isChangeState('point-sale', 'point-sale', 'date')) {

updateOrder = true ;
}

if(updateOrder) {
// products
if(response.data.products) {
app.products = response.data.products ;
}

// commande
// order
app.order = null ;
if(response.data.order) {
app.order = response.data.order ;
app.comment = app.order.comment ;
console.log(app.order) ;
app.delivery = app.order.delivery_home ;
if(app.order.delivery_address && app.order.delivery_address.length > 0) {
app.deliveryAddress = app.order.delivery_address ;
@@ -236,7 +258,6 @@ var app = new Vue({
if(app.user.address.length > 0) {
app.deliveryAddress = app.user.address ;
}
app.pointSaleActive = null ;
}
}

@@ -253,6 +274,15 @@ var app = new Vue({
});
},

isChangeState: function(entryPoint, oldStep, newStep) {

return this.producer
&& entryPoint == this.producer.option_order_entry_point
&& oldStep == this.oldStep
&& newStep == this.step ;

},

nextStep: function() {
this.errors = [] ;
var oldStep = this.step ;
@@ -286,6 +316,7 @@ var app = new Vue({
changeStep: function(step) {
this.errors = [] ;
var oldStep = this.step ;
this.oldStep = oldStep ;
if(oldStep == 'products' && step == 'payment') {
this.checkProducts() ;
@@ -293,18 +324,7 @@ var app = new Vue({
if(!this.errors.length) {
this.step = step ;
window.scroll(0, $('#page-title').position().top - 25) ;

if((oldStep == 'date' && step == 'point-sale')
|| (oldStep == 'date' && step == 'products')) {

this.init('basic') ;
}

if((oldStep == 'point-sale' && step == 'products')
|| (oldStep == 'point-sale' && step == 'date')) {

this.init('products') ;
}
this.init('basic', oldStep, step) ;
}
},
dayClickList: function(event) {

Laden…
Annuleren
Opslaan