|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
Vue.component('order-form', { |
|
|
Vue.component('order-form', { |
|
|
props: ['date', 'dateFormat', 'pointsSale', 'idActivePointSale', 'meansPayment', 'users', 'products', 'order', 'orders', 'producer', 'loadingUpdateProductOrder'], |
|
|
|
|
|
|
|
|
props: ['date', 'dateFormat', 'pointsSale', 'idActivePointSale', 'meansPayment', 'users', 'products', 'order', 'orders', 'producer', 'loadingUpdateProductOrder', 'create'], |
|
|
emits: ['updateProductPrice', 'updateInvoicePrices'], |
|
|
emits: ['updateProductPrice', 'updateInvoicePrices'], |
|
|
data: function () { |
|
|
data: function () { |
|
|
return { |
|
|
return { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
getProductQuantityRemaining: function(product) { |
|
|
getProductQuantityRemaining: function(product) { |
|
|
|
|
|
var order = null; |
|
|
var app = this; |
|
|
var app = this; |
|
|
var productQuantityOrder = 0; |
|
|
var productQuantityOrder = 0; |
|
|
|
|
|
|
|
|
for(key in app.orders) { |
|
|
for(key in app.orders) { |
|
|
var order = app.orders[key]; |
|
|
|
|
|
|
|
|
order = app.orders[key]; |
|
|
productQuantityOrder += order.productOrder[product.id].quantity; |
|
|
productQuantityOrder += order.productOrder[product.id].quantity; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(app.create == 1) { |
|
|
|
|
|
productQuantityOrder += app.order.productOrder[product.id].quantity; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return product.productDistribution[0].quantity_max - productQuantityOrder; |
|
|
return product.productDistribution[0].quantity_max - productQuantityOrder; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |