소스 검색

[Administration] Distributions : correctif bug changement de prix

develop
Guillaume Bourgeois 4 달 전
부모
커밋
c1218219c3
1개의 변경된 파일54개의 추가작업 그리고 43개의 파일을 삭제
  1. +54
    -43
      backend/web/js/vuejs/distribution-index.js

+ 54
- 43
backend/web/js/vuejs/distribution-index.js 파일 보기

@@ -83,6 +83,8 @@ if($(selector).length) {
messageGenerateDeliveryNoteDisplayed: false,
missingSubscriptions: false,
loadingUpdateProductOrder: false,
timerAjaxUpdateProductOrder: null,
xhr: null,
units: [],
calendar: {
mode: 'single',
@@ -858,7 +860,7 @@ if($(selector).length) {
}
return JSON.stringify(productOrderArrayRequest);
},
updateProductOrders: function (updatePricesOnUpdateOrder) {
updateProductOrders: function (updatePrices) {
var app = this;
app.loadingUpdateProductOrder = true;
var order = null;
@@ -876,57 +878,66 @@ if($(selector).length) {
}

if (order) {
axios.get(UrlManager.getBaseUrlAbsolute() + "distribution/ajax-update-product-order", {
params: {
idDistribution: app.distribution.id,
idUser: order.id_user,
idPointSale: order.id_point_sale,
idOrder: order.id,
productOrderFormArray: app.getProductOrderArrayRequest(order)
if (app.timerAjaxUpdateProductOrder) {
clearTimeout(app.timerAjaxUpdateProductOrder);
}
app.timerAjaxUpdateProductOrder = setTimeout(function(app) {
if(app.xhr) {
app.xhr.abort();
}
})
.then(function (response) {
if (response.data) {
for (idProduct in response.data) {

if (app.showModalFormOrderCreate) {
Vue.set(app.orderCreate.productOrder[idProduct], 'quantity_remaining', response.data[idProduct].quantity_remaining);
Vue.set(app.orderCreate.productOrder[idProduct], 'prices', response.data[idProduct].prices);
Vue.set(app.orderCreate.productOrder[idProduct], 'active', response.data[idProduct].active);
Vue.set(app.orderCreate.productOrder[idProduct], 'price', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, false));
Vue.set(app.orderCreate.productOrder[idProduct], 'price_with_tax', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, true));
}
app.xhr = $.get(UrlManager.getBaseUrlAbsolute() + "distribution/ajax-update-product-order", {
idDistribution: app.distribution.id,
idUser: order.id_user,
idPointSale: order.id_point_sale,
idOrder: order.id,
productOrderFormArray: app.getProductOrderArrayRequest(order)
}, function (response) {
if (response) {
for (idProduct in response) {

if (app.showModalFormOrderCreate) {
Vue.set(app.orderCreate.productOrder[idProduct], 'quantity_remaining', response[idProduct].quantity_remaining);
Vue.set(app.orderCreate.productOrder[idProduct], 'prices', response[idProduct].prices);
Vue.set(app.orderCreate.productOrder[idProduct], 'active', response[idProduct].active);

if(updatePrices) {
Vue.set(app.orderCreate.productOrder[idProduct], 'price', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, false));
Vue.set(app.orderCreate.productOrder[idProduct], 'price_with_tax', app.getBestProductPrice(app.orderCreate, idProduct, app.orderCreate.productOrder[idProduct].quantity, true));
}
}

if (app.showModalFormOrderUpdate && app.idOrderUpdate) {
for (keyOrderUpdate in app.ordersUpdate) {
if (order.id == app.idOrderUpdate) {
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'quantity_remaining', response.data[idProduct].quantity_remaining);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'prices', response.data[idProduct].prices);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'active', response.data[idProduct].active);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'invoice_price', response.data[idProduct].invoice_price);

if (updatePricesOnUpdateOrder) {
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, false));
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price_with_tax',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, true));
if (app.showModalFormOrderUpdate && app.idOrderUpdate) {
for (keyOrderUpdate in app.ordersUpdate) {
if (order.id == app.idOrderUpdate) {
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'quantity_remaining', response[idProduct].quantity_remaining);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'prices', response[idProduct].prices);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'active', response[idProduct].active);
Vue.set(app.ordersUpdate[keyOrderUpdate].productOrder[idProduct], 'invoice_price', response[idProduct].invoice_price);

if (updatePrices) {
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, false));
Vue.set(
app.ordersUpdate[keyOrderUpdate].productOrder[idProduct],
'price_with_tax',
app.getBestProductPrice(app.ordersUpdate[keyOrderUpdate], idProduct, app.ordersUpdate[keyOrderUpdate].productOrder[idProduct].quantity, true));
}
}
}
}
}
}

if (updatePricesOnUpdateOrder) {
appAlerts.alert('info', 'Prix rechargés');
if (updatePrices) {
appAlerts.alert('info', 'Prix rechargés');
}
}
}

app.loadingUpdateProductOrder = false;
});
app.loadingUpdateProductOrder = false;
}, 'json');
}.bind(this, app), 500);
}
},
updateInvoicePrices: function () {

Loading…
취소
저장