|
|
@@ -105,53 +105,54 @@ var app = new Vue({ |
|
|
|
return false ; |
|
|
|
}, |
|
|
|
init: function(idActivePointSale) { |
|
|
|
var app = this ; |
|
|
|
this.showLoading = true ; |
|
|
|
|
|
|
|
axios.get("ajax-infos",{params: {date : this.getDate()}}) |
|
|
|
.then(response => { |
|
|
|
this.distribution = response.data.distribution ; |
|
|
|
.then(function(response) { |
|
|
|
app.distribution = response.data.distribution ; |
|
|
|
|
|
|
|
this.products = response.data.products ; |
|
|
|
this.initCountActiveProducts() ; |
|
|
|
app.products = response.data.products ; |
|
|
|
app.initCountActiveProducts() ; |
|
|
|
|
|
|
|
this.oneDistributionWeekActive = response.data.one_distribution_week_active ; |
|
|
|
app.oneDistributionWeekActive = response.data.one_distribution_week_active ; |
|
|
|
|
|
|
|
this.countOrders = 0 ; |
|
|
|
app.countOrders = 0 ; |
|
|
|
if(response.data.orders) { |
|
|
|
this.orders = response.data.orders ; |
|
|
|
app.orders = response.data.orders ; |
|
|
|
|
|
|
|
for(i=0 ; i < this.orders.length ; i++) { |
|
|
|
if(!this.orders[i].date_delete) { |
|
|
|
this.countOrders ++ ; |
|
|
|
for(i=0 ; i < app.orders.length ; i++) { |
|
|
|
if(!app.orders[i].date_delete) { |
|
|
|
app.countOrders ++ ; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
this.orders = [] ; |
|
|
|
app.orders = [] ; |
|
|
|
} |
|
|
|
|
|
|
|
if(response.data.order_create) { |
|
|
|
this.orderCreate = response.data.order_create ; |
|
|
|
app.orderCreate = response.data.order_create ; |
|
|
|
} |
|
|
|
|
|
|
|
if(response.data.points_sale) { |
|
|
|
this.pointsSale = response.data.points_sale ; |
|
|
|
this.initPointsSale(idActivePointSale) ; |
|
|
|
app.pointsSale = response.data.points_sale ; |
|
|
|
app.initPointsSale(idActivePointSale) ; |
|
|
|
} |
|
|
|
else { |
|
|
|
this.pointsSale = [] ; |
|
|
|
app.pointsSale = [] ; |
|
|
|
} |
|
|
|
|
|
|
|
if(response.data.users) { |
|
|
|
this.users = response.data.users ; |
|
|
|
app.users = response.data.users ; |
|
|
|
} |
|
|
|
|
|
|
|
this.calendar.attrs = [] ; |
|
|
|
app.calendar.attrs = [] ; |
|
|
|
var distributions = response.data.distributions ; |
|
|
|
if(distributions.length) { |
|
|
|
for(var i= 0; i < distributions.length; i++) { |
|
|
|
this.calendar.attrs.push({ |
|
|
|
app.calendar.attrs.push({ |
|
|
|
highlight: { |
|
|
|
backgroundColor: '#5cb85c', |
|
|
|
}, |
|
|
@@ -163,7 +164,7 @@ var app = new Vue({ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.showLoading = false ; |
|
|
|
app.showLoading = false ; |
|
|
|
}) ; |
|
|
|
}, |
|
|
|
initCountActiveProducts: function() { |
|
|
@@ -211,7 +212,7 @@ var app = new Vue({ |
|
|
|
idProduct: event.currentTarget.getAttribute('data-id-product'), |
|
|
|
quantityMax: event.currentTarget.value |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
.then(function(response) { |
|
|
|
|
|
|
|
}) ; |
|
|
|
}, |
|
|
@@ -223,7 +224,7 @@ var app = new Vue({ |
|
|
|
idProduct: idProduct, |
|
|
|
active: activeProduct |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
.then(function(response) { |
|
|
|
|
|
|
|
}) ; |
|
|
|
|
|
|
@@ -243,7 +244,7 @@ var app = new Vue({ |
|
|
|
idPointSale: idPointSale, |
|
|
|
delivery: deliveryPointSale |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
.then(function(response) { |
|
|
|
|
|
|
|
}) ; |
|
|
|
|
|
|
@@ -256,23 +257,25 @@ var app = new Vue({ |
|
|
|
this.initPointsSale() ; |
|
|
|
}, |
|
|
|
activeDistribution: function(event) { |
|
|
|
var app = this ; |
|
|
|
axios.get("ajax-process-active-distribution",{params: { |
|
|
|
idDistribution: this.distribution.id, |
|
|
|
active: event.currentTarget.getAttribute('data-active') |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
this.init() ; |
|
|
|
.then(function(response) { |
|
|
|
app.init() ; |
|
|
|
}) ; |
|
|
|
}, |
|
|
|
activeWeekDistribution: function(event) { |
|
|
|
var app = this ; |
|
|
|
axios.get("ajax-process-active-week-distribution",{params: { |
|
|
|
date: this.date.getFullYear() + '-' |
|
|
|
+ ('0' + (this.date.getMonth() +1)).slice(-2) + '-' |
|
|
|
+ ('0' + this.date.getDate()).slice(-2), |
|
|
|
active: event.currentTarget.getAttribute('data-active') |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
this.init() ; |
|
|
|
.then(function(response) { |
|
|
|
app.init() ; |
|
|
|
}) ; |
|
|
|
}, |
|
|
|
pointSaleClick: function(event) { |
|
|
@@ -288,12 +291,13 @@ var app = new Vue({ |
|
|
|
this.init(this.idActivePointSale) ; |
|
|
|
}, |
|
|
|
deleteOrderClick: function(event) { |
|
|
|
var app = this ; |
|
|
|
var idOrder = event.currentTarget.getAttribute('data-id-order') ; |
|
|
|
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-delete",{params: { |
|
|
|
idOrder: idOrder |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
this.init(this.idActivePointSale) ; |
|
|
|
.then(function(response) { |
|
|
|
app.init(app.idActivePointSale) ; |
|
|
|
}) ; |
|
|
|
}, |
|
|
|
updateOrderClick: function(event) { |
|
|
@@ -307,14 +311,15 @@ var app = new Vue({ |
|
|
|
this.showModalPayment = true ; |
|
|
|
}, |
|
|
|
orderPaymentClick: function(event) { |
|
|
|
var app = this ; |
|
|
|
var idOrder = event.currentTarget.getAttribute('data-id-order') ; |
|
|
|
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-payment",{params: { |
|
|
|
idOrder: this.idOrderPayment, |
|
|
|
type: event.currentTarget.getAttribute('data-type'), |
|
|
|
amount: event.currentTarget.getAttribute('data-amount') |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
this.init(this.idActivePointSale) ; |
|
|
|
.then(function(response) { |
|
|
|
app.init(app.idActivePointSale) ; |
|
|
|
}) ; |
|
|
|
}, |
|
|
|
orderViewClick: function(event) { |
|
|
@@ -378,6 +383,7 @@ Vue.component('order-form',{ |
|
|
|
|
|
|
|
}, |
|
|
|
submitFormCreate: function() { |
|
|
|
var app = this ; |
|
|
|
if(this.checkForm()) { |
|
|
|
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-create",{params: { |
|
|
|
date: this.date.getFullYear() + '-' |
|
|
@@ -389,20 +395,21 @@ Vue.component('order-form',{ |
|
|
|
products: JSON.stringify(this.order.productOrder), |
|
|
|
comment: this.order.comment |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
this.order.id_point_sale = 0 ; |
|
|
|
this.order.id_user = 0 ; |
|
|
|
this.order.username = '' ; |
|
|
|
this.order.comment = '' ; |
|
|
|
for(i=0 ; i<this.order.productOrder.length ; i++) { |
|
|
|
this.order.productOrder[i] = 0 ; |
|
|
|
.then(function(response) { |
|
|
|
app.order.id_point_sale = 0 ; |
|
|
|
app.order.id_user = 0 ; |
|
|
|
app.order.username = '' ; |
|
|
|
app.order.comment = '' ; |
|
|
|
for(i=0 ; i<app.order.productOrder.length ; i++) { |
|
|
|
app.order.productOrder[i] = 0 ; |
|
|
|
} |
|
|
|
|
|
|
|
this.$emit('ordercreatedupdated') ; |
|
|
|
app.$emit('ordercreatedupdated') ; |
|
|
|
}) ; |
|
|
|
} |
|
|
|
}, |
|
|
|
submitFormUpdate: function() { |
|
|
|
var app = this ; |
|
|
|
if(this.checkForm()) { |
|
|
|
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-update",{params: { |
|
|
|
date: this.date.getFullYear() + '-' |
|
|
@@ -415,8 +422,8 @@ Vue.component('order-form',{ |
|
|
|
products: JSON.stringify(this.order.productOrder), |
|
|
|
comment: this.comment |
|
|
|
}}) |
|
|
|
.then(response => { |
|
|
|
this.$emit('ordercreatedupdated') ; |
|
|
|
.then(function(response) { |
|
|
|
app.$emit('ordercreatedupdated') ; |
|
|
|
}) ; |
|
|
|
} |
|
|
|
}, |