Pārlūkot izejas kodu

[Administration] Distributions : optimisation mise à jour des quantités maximum

feature/rotating_product
Guillaume Bourgeois pirms 4 mēnešiem
vecāks
revīzija
63f04d9605
2 mainītis faili ar 19 papildinājumiem un 3 dzēšanām
  1. +7
    -1
      backend/controllers/DistributionController.php
  2. +12
    -2
      backend/web/js/vuejs/distribution-index.js

+ 7
- 1
backend/controllers/DistributionController.php Parādīt failu

@@ -673,7 +673,13 @@ class DistributionController extends BackendController
$productDistributionModule = $this->getProductDistributionModule();
$productDistribution = $this->getProductDistribution($idProduct, $idDistribution);
$productDistributionModule->updateProductDistributionQuantityMax($productDistribution, (float) $quantityMax);
return ['success'];
return [
'quantity_remaining' => $this->getOrderModule()->getResolver()
->getProductQuantityRemaining(
$productDistribution->product,
$productDistribution->distribution
)
];
}

public function actionAjaxProcessActiveProduct(int $idDistribution, int $idProduct, int $active)

+ 12
- 2
backend/web/js/vuejs/distribution-index.js Parādīt failu

@@ -351,15 +351,16 @@ if($(selector).length) {
productQuantityMaxChange: function (event) {
var app = this;
var quantityMax = event.currentTarget.value;
var idProduct = event.currentTarget.getAttribute('data-id-product');
axios.get("ajax-process-product-quantity-max", {
params: {
idDistribution: this.distribution.id,
idProduct: event.currentTarget.getAttribute('data-id-product'),
idProduct: idProduct,
quantityMax: (!quantityMax || quantityMax.length === 0) ? -1 : quantityMax
}
})
.then(function (response) {
app.init(app.idActivePointSale);
Vue.set(app.products[app.getProductIndex(idProduct)], 'quantity_remaining', response.data.quantity_remaining);
});
},
productActiveClick: function (event) {
@@ -994,6 +995,15 @@ if($(selector).length) {

return false;
},
getProductIndex: function(idProduct) {
for (var i = 0; i < this.products.length; i++) {
if (this.products[i].id == idProduct) {
return i;
}
}

return false;
},
countDocuments: function (order) {
var count = 0;


Notiek ielāde…
Atcelt
Saglabāt