Browse Source

Merge branch 'dev'

prodstable
Guillaume 2 years ago
parent
commit
dd5a77caed
2 changed files with 6 additions and 3 deletions
  1. +5
    -3
      backend/controllers/DistributionController.php
  2. +1
    -0
      backend/web/js/vuejs/distribution-index.js

+ 5
- 3
backend/controllers/DistributionController.php View File

]; ];
} }


public function actionAjaxUpdateProductOrder($idUser = false, $idPointSale = false)
public function actionAjaxUpdateProductOrder($idDistribution, $idUser = false, $idPointSale = false)
{ {
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;


$distribution = Distribution::findOne($idDistribution) ;
$user = User::findOne($idUser) ; $user = User::findOne($idUser) ;
$userProducer = UserProducer::searchOne([ $userProducer = UserProducer::searchOne([
'id_user' => $idUser, 'id_user' => $idUser,
->where([ ->where([
'id_producer' => GlobalParam::getCurrentProducerId(), 'id_producer' => GlobalParam::getCurrentProducerId(),
'product.active' => 1, 'product.active' => 1,
])->joinWith(['productPrice'])
->all();
])->joinWith(['productPrice', 'productDistribution' => function ($q) use ($distribution) {
$q->where(['id_distribution' => $distribution->id]);
}])->all();


$productOrderArray = []; $productOrderArray = [];
foreach ($productsArray as $product) { foreach ($productsArray as $product) {

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

if(order) { if(order) {
axios.get(UrlManager.getBaseUrlAbsolute() + "distribution/ajax-update-product-order", { axios.get(UrlManager.getBaseUrlAbsolute() + "distribution/ajax-update-product-order", {
params: { params: {
idDistribution: app.distribution.id,
idUser: order.id_user, idUser: order.id_user,
idPointSale: order.id_point_sale idPointSale: order.id_point_sale
} }

Loading…
Cancel
Save