pcpuma_unam_operador/components/tablas/TablaHoraExcepcion.vue

79 lines
2.0 KiB
Vue
Raw Normal View History

2022-07-25 22:59:36 +00:00
<template>
<b-table
class="mb-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: () => [] },
obtenerDias: {
2022-07-25 22:59:36 +00:00
type: Function,
required: true,
default: () => {},
},
2022-07-26 16:49:26 +00:00
// obtenerHorasExcepcion: {
// type: Function,
// required: true,
// default: () => {},
// },
2022-07-25 22:59:36 +00:00
isLoadingTable: { type: Boolean, required: true, default: false },
2022-07-26 16:49:26 +00:00
updateIsLoading: { type: Function, required: true },
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-07-25 22:59:36 +00:00
axios
.delete(
`${process.env.api}/hora-excepcion`,
this.$getToken.tokenDelete(data)
)
.then((res) => {
2022-07-26 16:49:26 +00:00
this.obtenerDias()
// this.obtenerHorasExcepcion()
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-07-25 22:59:36 +00:00
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
},
}
</script>