Преглед изворни кода

Sélection du point de vente par défaut lors de l'ajout d'une commande dans le backend

dev
Guillaume Bourgeois пре 5 година
родитељ
комит
8fe2df42c5
2 измењених фајлова са 28 додато и 14 уклоњено
  1. +20
    -13
      backend/controllers/DistributionController.php
  2. +8
    -1
      backend/web/js/vuejs/distribution-index.js

+ 20
- 13
backend/controllers/DistributionController.php Прегледај датотеку

@@ -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 ;

+ 8
- 1
backend/web/js/vuejs/distribution-index.js Прегледај датотеку

@@ -15,6 +15,7 @@ var app = new Vue({
countActiveProducts: 0,
pointsSale: [],
idActivePointSale: 0,
idDefaultPointSale: 0,
countActivePointsSale: 0,
countOrdersByPointSale: [],
orders: [],
@@ -134,6 +135,7 @@ var app = new Vue({
if(response.data.order_create) {
app.orderCreate = response.data.order_create ;
app.idDefaultPointSale = app.orderCreate.id_point_sale ;
}
if(response.data.points_sale) {
@@ -283,7 +285,12 @@ var app = new Vue({
},
setIdActivePointSale: function(id) {
this.idActivePointSale = id ;
this.orderCreate.id_point_sale = id ;
if(!id) {
this.orderCreate.id_point_sale = this.idDefaultPointSale ;
}
else {
this.orderCreate.id_point_sale = id ;
}
},
orderCreatedUpdated: function() {
this.showModalFormOrderCreate = false ;

Loading…
Откажи
Сачувај