Browse Source

[Administration] Distributions : mise en avant des dépassements de quantités #1186

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
dbcb472c83
2 changed files with 17 additions and 3 deletions
  1. +6
    -2
      backend/views/distribution/index.php
  2. +11
    -1
      backend/web/js/vuejs/distribution-index.js

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

@@ -432,6 +432,7 @@ $this->setPageTitle('Distributions') ;
:users="users"
:products="products"
:order="ordersUpdate[key]"
:orders="ordersUpdate"
:producer="producer"
:loading-update-product-order="loadingUpdateProductOrder"
@close="showModalFormOrderUpdate = false"
@@ -691,8 +692,11 @@ $this->setPageTitle('Distributions') ;
</div>
</td>
<td class="quantity-remaining infinite" v-if="product.quantity_remaining === null || order.productOrder[product.id].unit != product.unit">&infin;</td>
<td class="quantity-remaining negative" v-else-if="product.quantity_remaining <= 0">{{ product.quantity_remaining }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</td>
<td class="quantity-remaining has-quantity" v-else>{{ product.quantity_remaining }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</td>
<td class="quantity-remaining negative" v-else-if="getProductQuantityRemaining(product) <= 0">
{{ getProductQuantityRemaining(product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}
<span class="glyphicon glyphicon-alert" v-if="getProductQuantityRemaining(product) < 0"></span>
</td>
<td class="quantity-remaining has-quantity" v-else>{{ getProductQuantityRemaining(product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</td>
</tr>
</tbody>
</table>

+ 11
- 1
backend/web/js/vuejs/distribution-index.js View File

@@ -871,7 +871,7 @@ Vue.component('modal', {
});

Vue.component('order-form', {
props: ['date', 'dateFormat', 'pointsSale', 'idActivePointSale', 'meansPayment', 'users', 'products', 'order', 'producer', 'loadingUpdateProductOrder'],
props: ['date', 'dateFormat', 'pointsSale', 'idActivePointSale', 'meansPayment', 'users', 'products', 'order', 'orders', 'producer', 'loadingUpdateProductOrder'],
emits: ['updateProductPrice', 'updateInvoicePrices'],
data: function () {
return {
@@ -1078,6 +1078,16 @@ Vue.component('order-form', {
} else {
this.vatMode = 'all';
}
},
getProductQuantityRemaining: function(product) {
var app = this;
var productQuantityOrder = 0;

for(key in app.orders) {
var order = app.orders[key];
productQuantityOrder += order.productOrder[product.id].quantity;
}
return product.productDistribution[0].quantity_max - productQuantityOrder;
}
}
});

Loading…
Cancel
Save