2022-06-18 03:27:06 +00:00
< template >
< b -field >
< b -button
2022-06-21 03:59:55 +00:00
: type = "data.activo ? 'is-success' : 'is-danger'"
2022-06-18 03:27:06 +00:00
@ click = "
imprimirWarning (
2022-06-21 03:59:55 +00:00
mensajeWarning ,
2022-06-18 03:27:06 +00:00
llamarCambiarStatus
)
"
>
2022-06-21 03:59:55 +00:00
{ { data . activo ? 'Activo' : 'Inactivo' } }
2022-06-18 03:27:06 +00:00
< / b - b u t t o n >
< / b - f i e l d >
< / 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 ( ) {
2022-06-21 03:59:55 +00:00
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 )
} ,
} ,
2022-06-21 03:59:55 +00:00
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 >