|
|
|
|
|
|
|
|
|
|
|
|
|
|
$json['orders'] = $ordersArray ; |
|
|
$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 |
|
|
// points de vente |
|
|
$pointsSaleArray = PointSale::find() |
|
|
$pointsSaleArray = PointSale::find() |
|
|
->joinWith(['pointSaleDistribution' => function($q) use ($distribution) { |
|
|
->joinWith(['pointSaleDistribution' => function($q) use ($distribution) { |
|
|
|
|
|
|
|
|
->asArray() |
|
|
->asArray() |
|
|
->all(); |
|
|
->all(); |
|
|
|
|
|
|
|
|
|
|
|
$idPointSaleDefault = 0 ; |
|
|
|
|
|
foreach($pointsSaleArray as $pointSale) { |
|
|
|
|
|
if($pointSale['default']) { |
|
|
|
|
|
$idPointSaleDefault = $pointSale['id'] ; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$json['points_sale'] = $pointsSaleArray ; |
|
|
$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 |
|
|
// utilisateurs |
|
|
$usersArray = User::findBy()->all() ; |
|
|
$usersArray = User::findBy()->all() ; |
|
|
$json['users'] = $usersArray ; |
|
|
$json['users'] = $usersArray ; |