Kaynağa Gözat

Compatibilité IE : syntaxe function en argument

refactoring
Guillaume Bourgeois 5 yıl önce
ebeveyn
işleme
a6bddf0210
1 değiştirilmiş dosya ile 29 ekleme ve 27 silme
  1. +29
    -27
      producer/web/js/vuejs/order-order.js

+ 29
- 27
producer/web/js/vuejs/order-order.js Dosyayı Görüntüle

@@ -97,20 +97,21 @@ var app = new Vue({
}
},
init: function() {
var app = this ;
this.loading = true ;
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 ;
if(distributions.length) {
this.distributions = distributions ;
app.distributions = distributions ;
var arrayDate ;
for(var i= 0; i < distributions.length; i++) {
this.calendar.attrs.push({
app.calendar.attrs.push({
highlight: {
backgroundColor: '#5cb85c',
},
@@ -121,7 +122,7 @@ var app = new Vue({
}) ;
arrayDate = distributions[i].date.split('-') ;
this.calendar.availableDates.push({
app.calendar.availableDates.push({
start: new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2]),
end: new Date(arrayDate[0], arrayDate[1] - 1, arrayDate[2])
}) ;
@@ -134,7 +135,7 @@ var app = new Vue({
if(orders.length) {
for(var i= 0; i < orders.length; i++) {
this.calendar.attrs.push({
app.calendar.attrs.push({
highlight: {
backgroundColor: '#FF7F00'
},
@@ -142,7 +143,7 @@ var app = new Vue({
color: 'white'
},
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
},
dates: orders[i].date_distribution,
@@ -151,33 +152,33 @@ var app = new Vue({
}
if(response.data.distribution) {
this.distribution = response.data.distribution ;
app.distribution = response.data.distribution ;
}
if(response.data.points_sale) {
this.pointsSale = [] ;
app.pointsSale = [] ;
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) {
this.products = response.data.products ;
app.products = response.data.products ;
}
this.order = null ;
app.order = null ;
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 {
this.pointSaleActive = null ;
app.pointSaleActive = null ;
}
this.loading = false ;
app.loading = false ;
});
},
changeStep: function(step) {
@@ -215,6 +216,7 @@ var app = new Vue({
return false ;
},
pointSaleClick: function(event) {
var app = this ;
var idPointSale = event.currentTarget.getAttribute('data-id-point-sale') ;
var hasCode = event.currentTarget.getAttribute('data-code') ;
@@ -222,14 +224,14 @@ var app = new Vue({
axios.get('ajax-validate-code-point-sale',{params: {
idPointSale: idPointSale,
code: this.pointsSaleCodes[idPointSale]
}}).then(response => {
}}).then(function(response) {
if(response.data) {
this.pointsSale[idPointSale].invalid_code = false ;
this.validatePointSale(idPointSale) ;
app.pointsSale[idPointSale].invalid_code = false ;
app.validatePointSale(idPointSale) ;
}
else {
this.pointsSale[idPointSale].invalid_code = true ;
Vue.set(this.pointsSaleCodes, idPointSale, '');
app.pointsSale[idPointSale].invalid_code = true ;
Vue.set(app.pointsSaleCodes, idPointSale, '');
}
}) ;
}
@@ -300,7 +302,7 @@ var app = new Vue({
},
code_point_sale: this.pointsSaleCodes[this.pointSaleActive.id],
products: productsArray
}).then(response => {
}).then(function(response) {
if(response.data.status == 'success') {
window.location.href = chat_base_url(true)+'order/confirm?idOrder='+response.data.idOrder ;
}

Yükleniyor…
İptal
Kaydet