pcpuma_unam_operador/components/operador/BotonDesactivar.vue

42 lines
1.1 KiB
Vue
Raw Normal View History

2022-06-18 03:27:06 +00:00
<template>
<b-field>
<b-button
:type="data.activo ? 'is-success' : 'is-danger'"
2022-06-18 03:27:06 +00:00
@click="
imprimirWarning(
mensajeWarning,
2022-06-18 03:27:06 +00:00
llamarCambiarStatus
)
"
>
{{ data.activo ? '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 },
cambiarStatus: { type: Function, required: true },
2022-06-20 00:35:50 +00:00
imprimirWarning: { type: Function, require: true },
2022-06-18 03:27:06 +00:00
},
deta() {
return {
mensajeWarning:''
}
2022-06-18 03:27:06 +00:00
},
methods: {
2022-06-18 03:31:45 +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() {
if (this.data.activo) this.cambiarStatus(this.data, false)
else this.cambiarStatus(this.data, true)
},
},
created(){
this.data.activo === true ? this.mensajeWarning = "¿Estás segur@ de querer desactivar a este operador?" : this.mensajeWarning = "¿Estás segur@ de querer activar a este operador?"
}
2022-06-18 03:27:06 +00:00
}
</script>