forked from nathalie/pedi2
Cambio de logica de obtener sesion + variable para habilitar devoluciones
This commit is contained in:
parent
388beba5cc
commit
716d1ca6fa
|
@ -24,14 +24,14 @@ files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
Vue.prototype.$rootMiga = {
|
Vue.prototype.$rootMiga = {
|
||||||
nombre: "Categorías",
|
nombre: "Categorías",
|
||||||
href: "/productos"
|
href: "/productos"
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Global methods
|
* Global methods
|
||||||
*/
|
*/
|
||||||
Vue.prototype.$settearProducto = function(cantidad, id) {
|
Vue.prototype.$settearProducto = function(cantidad, id) {
|
||||||
Event.$emit("sync-subpedido", this.cant, this.producto.id)
|
Event.$emit("sync-subpedido", this.cant, this.producto.id)
|
||||||
}
|
}
|
||||||
Vue.prototype.$toast = function(mensaje, duration = 1000) {
|
Vue.prototype.$toast = function(mensaje, duration = 1000) {
|
||||||
return window.bulmaToast.toast({
|
return window.bulmaToast.toast({
|
||||||
|
@ -59,7 +59,8 @@ const app = new Vue({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
gdc: null,
|
gdc: null,
|
||||||
pedido: null
|
pedido: null,
|
||||||
|
devoluciones: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -77,12 +78,18 @@ const app = new Vue({
|
||||||
Event.$on('obtener-sesion', () => {
|
Event.$on('obtener-sesion', () => {
|
||||||
axios.get('/subpedidos/obtener_sesion')
|
axios.get('/subpedidos/obtener_sesion')
|
||||||
.then(response => {
|
.then(response => {
|
||||||
this.pedido = response.data.subpedido.id
|
if (response.data.subpedido.id) {
|
||||||
axios.get('/api/subpedidos/' + this.pedido)
|
this.pedido = response.data.subpedido.id
|
||||||
.then(response => {
|
axios.get('/api/subpedidos/' + this.pedido)
|
||||||
this.pedido = response.data.data
|
.then(response => {
|
||||||
this.gdc = this.pedido.grupo_de_compra.id
|
this.pedido = response.data.data
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
axios.get('/admin/obtener_sesion')
|
||||||
|
.then(response => {
|
||||||
|
this.gdc = response.data.gdc
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Event.$on('sync-subpedido', (cantidad, id) => {
|
Event.$on('sync-subpedido', (cantidad, id) => {
|
||||||
|
@ -104,7 +111,7 @@ const app = new Vue({
|
||||||
this.$toast('No se puede modificar un pedido ya aprobado', 2000);
|
this.$toast('No se puede modificar un pedido ya aprobado', 2000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
axios.post("api/subpedidos/" + this.pedido.id + "/sync_devoluciones", {
|
axios.post("api/subpedidos/" + this.pedido.id + "/sync_devoluciones", {
|
||||||
total: total,
|
total: total,
|
||||||
notas: notas,
|
notas: notas,
|
||||||
|
|
Loading…
Reference in New Issue