2022-06-18 03:27:06 +00:00
|
|
|
<template>
|
|
|
|
<b-field>
|
|
|
|
<b-button
|
2022-07-04 06:06:28 +00:00
|
|
|
:type="data.activo || data.mostrar ? 'is-success' : 'is-danger'"
|
2022-07-11 14:15:10 +00:00
|
|
|
@click="
|
|
|
|
$alertsGenericos.imprimirWarning(
|
|
|
|
$buefy,
|
|
|
|
mensajeWarning,
|
|
|
|
llamarCambiarStatus
|
|
|
|
)
|
|
|
|
"
|
2022-07-11 05:48:06 +00:00
|
|
|
expanded
|
2022-06-18 03:27:06 +00:00
|
|
|
>
|
2022-07-04 06:06:28 +00:00
|
|
|
{{ data.activo || data.mostrar ? 'Activo' : 'Inactivo' }}
|
2022-06-18 03:27:06 +00:00
|
|
|
</b-button>
|
|
|
|
</b-field>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
admin: { type: Object, required: true },
|
|
|
|
data: { type: Object, required: true },
|
2022-07-11 05:48:06 +00:00
|
|
|
tipo: { type: String, required: true },
|
2022-06-18 03:27:06 +00:00
|
|
|
cambiarStatus: { type: Function, required: true },
|
|
|
|
},
|
|
|
|
deta() {
|
2022-06-21 03:59:55 +00:00
|
|
|
return {
|
2022-06-21 17:51:13 +00:00
|
|
|
mensajeWarning: '',
|
2022-06-21 03:59:55 +00:00
|
|
|
}
|
2022-06-18 03:27:06 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2022-07-12 19:55:44 +00:00
|
|
|
//Al tener un componente global, la data hace referencia ya sea al módulo, carrito o equipo"
|
2022-06-18 03:27:06 +00:00
|
|
|
llamarCambiarStatus() {
|
2022-07-04 06:06:28 +00:00
|
|
|
if (this.data.activo || this.data.mostrar)
|
|
|
|
this.cambiarStatus(this.data, false)
|
2022-06-18 03:27:06 +00:00
|
|
|
else this.cambiarStatus(this.data, true)
|
|
|
|
},
|
2022-07-04 06:06:28 +00:00
|
|
|
crearMensajeWarning() {
|
|
|
|
this.data.activo || this.data.mostrar
|
|
|
|
? (this.mensajeWarning = `¿Estás segur@ de querer desactivar este ${this.tipo}?`)
|
|
|
|
: (this.mensajeWarning = `¿Estás segur@ de querer activar este ${this.tipo}?`)
|
|
|
|
},
|
2022-06-21 17:51:13 +00:00
|
|
|
},
|
2022-07-04 06:15:12 +00:00
|
|
|
watch: {
|
|
|
|
data() {
|
|
|
|
this.crearMensajeWarning()
|
|
|
|
},
|
|
|
|
},
|
2022-06-21 17:51:13 +00:00
|
|
|
created() {
|
2022-07-04 06:06:28 +00:00
|
|
|
this.crearMensajeWarning()
|
2022-06-18 03:27:06 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|