pcpuma_unam_operador/components/tablas/TablaHoraExcepcion.vue

77 lines
1.9 KiB
Vue
Raw Normal View History

2022-07-25 22:59:36 +00:00
<template>
<b-table
2022-07-29 01:04:17 +00:00
class="pb-6"
2022-07-26 16:49:26 +00:00
:data="horasExcepcion"
2022-07-25 22:59:36 +00:00
:loading="isLoadingTable"
hoverable
striped
>
<b-table-column
field="horaInicio"
label="Hora inicio"
v-slot="props"
centered
>
<p>{{ props.row.hora_inicio }}</p>
</b-table-column>
<b-table-column field="horaFin" label="Hora fin" v-slot="props" centered>
<p>{{ props.row.hora_fin }}</p>
</b-table-column>
<b-table-column field="eliminar" label="Eliminar" v-slot="props" centered>
<BotonEliminar
:eliminar="eliminarHoraExcepcion"
:row="props.row"
:msjWarning="`¿Estás segur@ de querer eliminar esta hora excepción?`"
/>
</b-table-column>
</b-table>
</template>
<script>
2022-07-26 16:49:26 +00:00
import axios from 'axios'
2022-07-25 22:59:36 +00:00
import BotonEliminar from '@/components/botones/BotonEliminar'
export default {
components: { BotonEliminar },
props: {
2022-07-26 16:49:26 +00:00
horasExcepcion: { type: Array, required: true, default: () => [] },
2023-01-09 17:29:31 +00:00
isLoadingTable: { type: Boolean, required: true, default: false },
obtenerHorasExcepcion: {
2022-07-25 22:59:36 +00:00
type: Function,
required: true,
default: () => {},
},
2023-01-09 17:29:31 +00:00
updateIsLoading: { type: Function, required: true, default: () => {} },
2022-07-25 22:59:36 +00:00
},
methods: {
2022-07-26 16:49:26 +00:00
eliminarHoraExcepcion(horaExcepcion) {
2022-07-25 22:59:36 +00:00
const data = {
2022-07-26 16:49:26 +00:00
id_hora_excepcion: horaExcepcion.id_hora_excepcion,
2022-07-25 22:59:36 +00:00
}
2022-07-26 16:49:26 +00:00
this.updateIsLoading(true)
2022-12-05 15:36:30 +00:00
return axios
2022-07-25 22:59:36 +00:00
.delete(
`${process.env.api}/hora-excepcion`,
this.$getToken.tokenDelete(data)
)
.then((res) => {
this.obtenerHorasExcepcion()
2022-07-26 16:49:26 +00:00
this.updateIsLoading(false)
2022-07-25 22:59:36 +00:00
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
})
.catch((err) => {
2022-07-26 16:49:26 +00:00
this.updateIsLoading(false)
2022-08-05 23:41:37 +00:00
this.$alertsGenericos.imprimirError(
this.$buefy,
this.$router,
err.response.data
)
2022-07-25 22:59:36 +00:00
})
},
},
}
</script>