75 lines
1.8 KiB
Vue
75 lines
1.8 KiB
Vue
<template>
|
|
<div class="column is-4">
|
|
<h3 class="is-size-4 mb-4">Administrador</h3>
|
|
|
|
<b-field
|
|
:label="`Motivo de ${carrito.activo ? 'desactivación' : 'activación'}:`"
|
|
>
|
|
<b-input
|
|
icon="list-status"
|
|
maxlength="200"
|
|
type="textarea"
|
|
:disabled="!carrito.id_carrito"
|
|
v-model="motivo"
|
|
rounded
|
|
/>
|
|
</b-field>
|
|
|
|
<BotonDesactivar
|
|
:disabled="!motivo"
|
|
:activarDesactivar="activarDesactivar"
|
|
:row="carrito"
|
|
:msjWarning="`¿Estas segur@ de querer ${
|
|
carrito.activo ? 'desactivar' : 'activar'
|
|
} este carrito?`"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import BotonDesactivar from '@/components/botones/BotonDesactivar'
|
|
|
|
export default {
|
|
components: { BotonDesactivar },
|
|
props: {
|
|
buscar: { type: Function, required: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
carrito: { type: Object, required: true },
|
|
operador: { type: Object, required: true },
|
|
},
|
|
data() {
|
|
return { motivo: '' }
|
|
},
|
|
methods: {
|
|
activarDesactivar() {
|
|
const data = {
|
|
id_carrito: this.carrito.id_carrito,
|
|
activo: !this.carrito.activo,
|
|
motivo: this.motivo,
|
|
}
|
|
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.put(`${process.env.api}/carrito`, data, this.$getToken.token())
|
|
.then((res) => {
|
|
this.motivo = ''
|
|
this.buscar()
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(
|
|
this.$buefy,
|
|
this.$router,
|
|
err.response.data
|
|
)
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|