eliminando componentes
This commit is contained in:
parent
8dd4121d5c
commit
56f40c1008
@ -1,86 +0,0 @@
|
||||
<template>
|
||||
<b-field>
|
||||
<b-button
|
||||
type="is-success"
|
||||
@click="
|
||||
imprimirWarning(
|
||||
'Estas a punto de actualizar el status de este carrito. ¿Estas segur@ de querer hacerlo?',
|
||||
llamarCambiarStatus
|
||||
)
|
||||
"
|
||||
v-if="carrito.activo"
|
||||
>
|
||||
Activo
|
||||
</b-button>
|
||||
|
||||
<b-button
|
||||
type="is-danger"
|
||||
@click="
|
||||
imprimirWarning(
|
||||
'Estas a punto de actualizar el status de este carrito. ¿Estas segur@ de querer hacerlo?',
|
||||
llamarCambiarStatus
|
||||
)
|
||||
"
|
||||
v-else
|
||||
>
|
||||
Inactivo
|
||||
</b-button>
|
||||
</b-field>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
carrito: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
operador: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
imprimirError: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
imprimirMensaje: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
imprimirWarning: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
obtenerCarritos: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
llamarCambiarStatus() {
|
||||
if (this.carrito.activo) this.cambiarStatus('desactivar')
|
||||
else this.cambiarStatus('activar')
|
||||
},
|
||||
cambiarStatus(status) {
|
||||
const data = { idCarrito: this.carrito.idCarrito, activo: status }
|
||||
|
||||
axios
|
||||
.put(`${process.env.api}/carrito/update`, data, this.operador.token)
|
||||
.then((res) => {
|
||||
this.obtenerCarritos()
|
||||
this.imprimirMensaje(res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style></style>
|
Loading…
Reference in New Issue
Block a user