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

@@ -906,7 +906,7 @@ class OrderController extends BackendController
* @param string $comment
*/
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;

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

@@ -234,7 +234,7 @@ $this->setPageTitle('Distributions') ;
</div>
<table class="table table-condensed table-bordered table-hover" v-if="countOrdersByPointSale[idActivePointSale] > 0 || (idActivePointSale == 0 && orders.length > 0)">
<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>
<td>
<label class="label label-success" v-if="order.origin == 'user'">client</label>
@@ -302,7 +302,7 @@ $this->setPageTitle('Distributions') ;
:points-sale="pointsSale"
:users="users"
:products="products"
:order="order.clone"
:order="ordersUpdate[key]"
@close="showModalFormOrderUpdate = false"
@ordercreatedupdated="orderCreatedUpdated"
></order-form>

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

@@ -19,6 +19,7 @@ var app = new Vue({
countActivePointsSale: 0,
countOrdersByPointSale: [],
orders: [],
ordersUpdate: [],
countOrders: 0,
users: [],
showModalProducts: false,
@@ -120,17 +121,14 @@ var app = new Vue({
app.countOrders = 0 ;
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++) {
app.orders[i].clone = app.cloneOrder(app.orders[i]) ;
if(!app.orders[i].date_delete) {
app.countOrders ++ ;
}
}
}
}
else {
app.orders = [] ;
@@ -357,7 +355,7 @@ var app = new Vue({
for(var key in order.productOrder) {
clone.productOrder[key] = order.productOrder[key] ;
}
return clone ;
}
},
@@ -460,7 +458,8 @@ Vue.component('order-form',{
},
productQuantityClick: function(id_product, quantity) {
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