Browse Source

[Administration] Distributions : correctif mise à jour quantités max

feature/rotating_product
Guillaume Bourgeois 4 months ago
parent
commit
7b7d7451c6
2 changed files with 8 additions and 1 deletions
  1. +7
    -1
      backend/controllers/DistributionController.php
  2. +1
    -0
      backend/web/js/vuejs/distribution-index.js

+ 7
- 1
backend/controllers/DistributionController.php View File

public function actionAjaxProcessProductQuantityMax($idDistribution, $idProduct, $quantityMax) public function actionAjaxProcessProductQuantityMax($idDistribution, $idProduct, $quantityMax)
{ {
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$orderModule = $this->getOrderModule();
$productDistributionModule = $this->getProductDistributionModule(); $productDistributionModule = $this->getProductDistributionModule();
$productDistribution = $this->getProductDistribution($idProduct, $idDistribution); $productDistribution = $this->getProductDistribution($idProduct, $idDistribution);
$productDistributionModule->updateProductDistributionQuantityMax($productDistribution, (float) $quantityMax); $productDistributionModule->updateProductDistributionQuantityMax($productDistribution, (float) $quantityMax);
return [ return [
'quantity_remaining' => $this->getOrderModule()->getResolver()
'quantity_max' => $orderModule->getResolver()
->getProductQuantityMax(
$productDistribution->product,
$productDistribution->distribution
),
'quantity_remaining' => $orderModule->getResolver()
->getProductQuantityRemaining( ->getProductQuantityRemaining(
$productDistribution->product, $productDistribution->product,
$productDistribution->distribution $productDistribution->distribution

+ 1
- 0
backend/web/js/vuejs/distribution-index.js View File

} }
}) })
.then(function (response) { .then(function (response) {
Vue.set(app.products[app.getProductIndex(idProduct)], 'quantity_max', response.data.quantity_max);
Vue.set(app.products[app.getProductIndex(idProduct)], 'quantity_remaining', response.data.quantity_remaining); Vue.set(app.products[app.getProductIndex(idProduct)], 'quantity_remaining', response.data.quantity_remaining);
}); });
}, },

Loading…
Cancel
Save