Browse Source

Compatibilité IE : syntaxe function en argument

dev
Guillaume Bourgeois 5 years ago
parent
commit
a6bddf0210
1 changed files with 29 additions and 27 deletions
  1. +29
    -27
      producer/web/js/vuejs/order-order.js

+ 29
- 27
producer/web/js/vuejs/order-order.js View File

} }
}, },
init: function() { init: function() {
var app = this ;
this.loading = true ; this.loading = true ;
axios.get("ajax-infos",{params: {date : this.getDate()}}) axios.get("ajax-infos",{params: {date : this.getDate()}})
.then(response => {
this.producer = response.data.producer ;
this.credit = response.data.credit ;
.then(function(response) {
app.producer = response.data.producer ;
app.credit = response.data.credit ;
this.calendar.attrs = [] ;
this.calendar.availableDates = [] ;
app.calendar.attrs = [] ;
app.calendar.availableDates = [] ;
var distributions = response.data.distributions ; var distributions = response.data.distributions ;
if(distributions.length) { if(distributions.length) {
this.distributions = distributions ;
app.distributions = distributions ;
var arrayDate ; var arrayDate ;
for(var i= 0; i < distributions.length; i++) { for(var i= 0; i < distributions.length; i++) {
this.calendar.attrs.push({
app.calendar.attrs.push({
highlight: { highlight: {
backgroundColor: '#5cb85c', backgroundColor: '#5cb85c',
}, },
}) ; }) ;
arrayDate = distributions[i].date.split('-') ; arrayDate = distributions[i].date.split('-') ;
this.calendar.availableDates.push({
app.calendar.availableDates.push({
start: new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2]), start: new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2]),
end: new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2]) end: new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2])
}) ; }) ;
if(orders.length) { if(orders.length) {
for(var i= 0; i < orders.length; i++) { for(var i= 0; i < orders.length; i++) {
this.calendar.attrs.push({
app.calendar.attrs.push({
highlight: { highlight: {
backgroundColor: '#FF7F00' backgroundColor: '#FF7F00'
}, },
color: 'white' color: 'white'
}, },
popover: { popover: {
label: orders[i].pointSale.name + ' / '+this.formatPrice(orders[i].amount_total),
label: orders[i].pointSale.name + ' / '+app.formatPrice(orders[i].amount_total),
hideIndicator: true hideIndicator: true
}, },
dates: orders[i].date_distribution, dates: orders[i].date_distribution,
} }
if(response.data.distribution) { if(response.data.distribution) {
this.distribution = response.data.distribution ;
app.distribution = response.data.distribution ;
} }
if(response.data.points_sale) { if(response.data.points_sale) {
this.pointsSale = [] ;
app.pointsSale = [] ;
for(var key in response.data.points_sale) { for(var key in response.data.points_sale) {
this.pointsSale[response.data.points_sale[key].id] = response.data.points_sale[key] ;
this.pointsSaleCodes[response.data.points_sale[key].id] = '' ;
Vue.set(this.pointsSaleCodes, response.data.points_sale[key].id, '');
app.pointsSale[response.data.points_sale[key].id] = response.data.points_sale[key] ;
app.pointsSaleCodes[response.data.points_sale[key].id] = '' ;
Vue.set(app.pointsSaleCodes, response.data.points_sale[key].id, '');
} }
} }
if(response.data.products) { if(response.data.products) {
this.products = response.data.products ;
app.products = response.data.products ;
} }
this.order = null ;
app.order = null ;
if(response.data.order) { if(response.data.order) {
this.order = response.data.order ;
this.pointSaleActive = this.getPointSale(response.data.order.id_point_sale) ;
app.order = response.data.order ;
app.pointSaleActive = app.getPointSale(response.data.order.id_point_sale) ;
} }
else { else {
this.pointSaleActive = null ;
app.pointSaleActive = null ;
} }
this.loading = false ;
app.loading = false ;
}); });
}, },
changeStep: function(step) { changeStep: function(step) {
return false ; return false ;
}, },
pointSaleClick: function(event) { pointSaleClick: function(event) {
var app = this ;
var idPointSale = event.currentTarget.getAttribute('data-id-point-sale') ; var idPointSale = event.currentTarget.getAttribute('data-id-point-sale') ;
var hasCode = event.currentTarget.getAttribute('data-code') ; var hasCode = event.currentTarget.getAttribute('data-code') ;
axios.get('ajax-validate-code-point-sale',{params: { axios.get('ajax-validate-code-point-sale',{params: {
idPointSale: idPointSale, idPointSale: idPointSale,
code: this.pointsSaleCodes[idPointSale] code: this.pointsSaleCodes[idPointSale]
}}).then(response => {
}}).then(function(response) {
if(response.data) { if(response.data) {
this.pointsSale[idPointSale].invalid_code = false ;
this.validatePointSale(idPointSale) ;
app.pointsSale[idPointSale].invalid_code = false ;
app.validatePointSale(idPointSale) ;
} }
else { else {
this.pointsSale[idPointSale].invalid_code = true ;
Vue.set(this.pointsSaleCodes, idPointSale, '');
app.pointsSale[idPointSale].invalid_code = true ;
Vue.set(app.pointsSaleCodes, idPointSale, '');
} }
}) ; }) ;
} }
}, },
code_point_sale: this.pointsSaleCodes[this.pointSaleActive.id], code_point_sale: this.pointsSaleCodes[this.pointSaleActive.id],
products: productsArray products: productsArray
}).then(response => {
}).then(function(response) {
if(response.data.status == 'success') { if(response.data.status == 'success') {
window.location.href = chat_base_url(true)+'order/confirm?idOrder='+response.data.idOrder ; window.location.href = chat_base_url(true)+'order/confirm?idOrder='+response.data.idOrder ;
} }

Loading…
Cancel
Save