|
|
@@ -190,19 +190,6 @@ class DistributionController extends BackendController |
|
|
|
|
|
|
|
$json['orders'] = $ordersArray ; |
|
|
|
|
|
|
|
// order create |
|
|
|
$productOrderArray = [] ; |
|
|
|
foreach($productsArray as $product) { |
|
|
|
$productOrderArray[$product['id']] = 0 ; |
|
|
|
} |
|
|
|
$json['order_create'] = [ |
|
|
|
'id_point_sale' => 0, |
|
|
|
'id_user' => 0, |
|
|
|
'username' => '', |
|
|
|
'comment' => '', |
|
|
|
'productOrder' => $productOrderArray |
|
|
|
] ; |
|
|
|
|
|
|
|
// points de vente |
|
|
|
$pointsSaleArray = PointSale::find() |
|
|
|
->joinWith(['pointSaleDistribution' => function($q) use ($distribution) { |
|
|
@@ -214,8 +201,28 @@ class DistributionController extends BackendController |
|
|
|
->asArray() |
|
|
|
->all(); |
|
|
|
|
|
|
|
$idPointSaleDefault = 0 ; |
|
|
|
foreach($pointsSaleArray as $pointSale) { |
|
|
|
if($pointSale['default']) { |
|
|
|
$idPointSaleDefault = $pointSale['id'] ; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$json['points_sale'] = $pointsSaleArray ; |
|
|
|
|
|
|
|
// order create |
|
|
|
$productOrderArray = [] ; |
|
|
|
foreach($productsArray as $product) { |
|
|
|
$productOrderArray[$product['id']] = 0 ; |
|
|
|
} |
|
|
|
$json['order_create'] = [ |
|
|
|
'id_point_sale' => $idPointSaleDefault, |
|
|
|
'id_user' => 0, |
|
|
|
'username' => '', |
|
|
|
'comment' => '', |
|
|
|
'productOrder' => $productOrderArray |
|
|
|
] ; |
|
|
|
|
|
|
|
// utilisateurs |
|
|
|
$usersArray = User::findBy()->all() ; |
|
|
|
$json['users'] = $usersArray ; |