Browse Source

[backend] Correction bug modification de commande impossible

refactoring
Guillaume Bourgeois 5 years ago
parent
commit
0b6bae1c3c
3 changed files with 11 additions and 12 deletions
  1. +1
    -1
      backend/controllers/OrderController.php
  2. +2
    -2
      backend/views/distribution/index.php
  3. +8
    -9
      backend/web/js/vuejs/distribution-index.js

+ 1
- 1
backend/controllers/OrderController.php View File

* @param string $comment * @param string $comment
*/ */
public function actionAjaxUpdate( public function actionAjaxUpdate(
$date, $idOrder, $idPointSale, $idUser, $username, $products, $comment, $processCredit = 0)
$date, $idOrder, $idPointSale, $idUser, $username, $products, $comment = '', $processCredit = 0)
{ {
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

+ 2
- 2
backend/views/distribution/index.php View File

</div> </div>
<table class="table table-condensed table-bordered table-hover" v-if="countOrdersByPointSale[idActivePointSale] > 0 || (idActivePointSale == 0 && orders.length > 0)"> <table class="table table-condensed table-bordered table-hover" v-if="countOrdersByPointSale[idActivePointSale] > 0 || (idActivePointSale == 0 && orders.length > 0)">
<tbody> <tbody>
<template v-for="order in orders" v-if="idActivePointSale == 0 || idActivePointSale == order.id_point_sale">
<template v-for="(order, key, index) in orders" v-if="idActivePointSale == 0 || idActivePointSale == order.id_point_sale">
<tr> <tr>
<td> <td>
<label class="label label-success" v-if="order.origin == 'user'">client</label> <label class="label label-success" v-if="order.origin == 'user'">client</label>
:points-sale="pointsSale" :points-sale="pointsSale"
:users="users" :users="users"
:products="products" :products="products"
:order="order.clone"
:order="ordersUpdate[key]"
@close="showModalFormOrderUpdate = false" @close="showModalFormOrderUpdate = false"
@ordercreatedupdated="orderCreatedUpdated" @ordercreatedupdated="orderCreatedUpdated"
></order-form> ></order-form>

+ 8
- 9
backend/web/js/vuejs/distribution-index.js View File

countActivePointsSale: 0, countActivePointsSale: 0,
countOrdersByPointSale: [], countOrdersByPointSale: [],
orders: [], orders: [],
ordersUpdate: [],
countOrders: 0, countOrders: 0,
users: [], users: [],
showModalProducts: false, showModalProducts: false,
app.countOrders = 0 ; app.countOrders = 0 ;
if(response.data.orders) { if(response.data.orders) {
app.orders = response.data.orders ;
app.orders = JSON.parse(JSON.stringify(response.data.orders)) ;
app.ordersUpdate = JSON.parse(JSON.stringify(response.data.orders)) ;

for(i=0 ; i < app.orders.length ; i++) { for(i=0 ; i < app.orders.length ; i++) {
app.orders[i].clone = app.cloneOrder(app.orders[i]) ;
if(!app.orders[i].date_delete) { if(!app.orders[i].date_delete) {
app.countOrders ++ ; app.countOrders ++ ;
} }
}
}
} }
else { else {
app.orders = [] ; app.orders = [] ;
for(var key in order.productOrder) { for(var key in order.productOrder) {
clone.productOrder[key] = order.productOrder[key] ; clone.productOrder[key] = order.productOrder[key] ;
} }
return clone ; return clone ;
} }
}, },
}, },
productQuantityClick: function(id_product, quantity) { productQuantityClick: function(id_product, quantity) {
if(this.order.productOrder[id_product] + quantity >= 0) { if(this.order.productOrder[id_product] + quantity >= 0) {
this.order.productOrder[id_product] += quantity ;
var theQuantity = this.order.productOrder[id_product] + quantity ;
Vue.set(this.order.productOrder, id_product, theQuantity);
} }
} }
} }

Loading…
Cancel
Save