listo deactivar usuarios

This commit is contained in:
lemuel 2022-09-05 18:45:01 -05:00
parent be436f863c
commit 31f6dea54b
2 changed files with 36 additions and 21 deletions

View File

@ -25,7 +25,16 @@
</div>
<div class="column">
<div v-for="(iu, index) in usuario.instituciones" :key="index">
<div
v-for="(iu, index) in usuario.instituciones"
:key="index"
v-show="
(operador.institucion &&
iu.institucionCarrera.institucion.id_institucion ===
operador.institucion.id_institucion) ||
operador.tipoUsuario.id_tipo_usuario === 2
"
>
<b-field
label="Institución"
v-if="operador.tipoUsuario.id_tipo_usuario === 2"
@ -54,12 +63,14 @@
</template>
<script>
import axios from 'axios'
import BotonDesactivar from '@/components/botones/BotonDesactivar'
// import BotonMulta from '@/components/botones/BotonMulta'
export default {
components: { BotonDesactivar },
props: {
buscar: { type: Function, required: true, default: () => {} },
updateIsLoading: { type: Function, required: true, default: () => {} },
operador: { type: Object, required: true, default: () => ({}) },
usuario: { type: Object, required: true, default: () => ({}) },
@ -71,22 +82,26 @@ export default {
activo: !institucionUsuario.activo,
}
// this.updateIsLoading(true)
// axios
// .put(`${process.env.api}/usuario`, data, this.$getToken.token())
// .then((res) => {
// 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
// )
// })
this.updateIsLoading(true)
axios
.put(
`${process.env.api}/institucion-usuario`,
data,
this.$getToken.token()
)
.then((res) => {
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
)
})
},
},
}

View File

@ -30,11 +30,11 @@
v-slot="props"
centered
>
<p>{{ fechaHora(props.row.fecha_inicio) }}</p>
<p>{{ fecha(props.row.fecha_inicio) }}</p>
</b-table-column>
<b-table-column field="fechaFin" label="Fecha Fin" v-slot="props" centered>
<p>{{ fechaHora(props.row.fecha_fin) }}</p>
<p>{{ fecha(props.row.fecha_fin) }}</p>
</b-table-column>
<b-table-column field="operador" label="Operador" v-slot="props" centered>
@ -104,8 +104,8 @@ export default {
total: { type: Number, required: true, default: 0 },
},
methods: {
fechaHora(date) {
return moment(date).format('YYYY-MM-DD HH:MM')
fecha(date) {
return moment(date).format('YYYY-MM-DD')
},
},
}