@@ -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">∞</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> |
@@ -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; | |||
} | |||
} | |||
}); |