:users="users" | :users="users" | ||||
:products="products" | :products="products" | ||||
:order="ordersUpdate[key]" | :order="ordersUpdate[key]" | ||||
:orders="ordersUpdate" | |||||
:producer="producer" | :producer="producer" | ||||
:loading-update-product-order="loadingUpdateProductOrder" | :loading-update-product-order="loadingUpdateProductOrder" | ||||
@close="showModalFormOrderUpdate = false" | @close="showModalFormOrderUpdate = false" | ||||
</div> | </div> | ||||
</td> | </td> | ||||
<td class="quantity-remaining infinite" v-if="product.quantity_remaining === null || order.productOrder[product.id].unit != product.unit">∞</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> | </tr> | ||||
</tbody> | </tbody> | ||||
</table> | </table> |
}); | }); | ||||
Vue.component('order-form', { | 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'], | emits: ['updateProductPrice', 'updateInvoicePrices'], | ||||
data: function () { | data: function () { | ||||
return { | return { | ||||
} else { | } else { | ||||
this.vatMode = 'all'; | 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; | |||||
} | } | ||||
} | } | ||||
}); | }); |