pcpuma_unam_operador/components/admin/HorasExcepcion.vue
2022-07-11 09:15:10 -05:00

75 lines
1.8 KiB
Vue

<template>
<div>
<div class="has-text-centered">
<p class="subtitle is-3">Hora Excepción</p>
<b-button type="is-primary" @click="mostrar = true" v-if="!mostrar"
>Agregar</b-button
>
</div>
<Relog
:diaSeleccion="horasExcepcion"
:crearHoraExcepcion="crearHoraExcepcion"
tipo="crearHoraExcepcion"
v-if="mostrar"
/>
<b-table :data="horasExcepcion.horasExcepcion">
<b-table-column
field="horaInicio"
label="Hora Inicio"
centered
v-slot="props"
>
{{ props.row.hora_inicio }}
</b-table-column>
<b-table-column field="horaFin" label="Hora Fin" centered v-slot="props">
{{ props.row.hora_fin }}
</b-table-column>
</b-table>
</div>
</template>
<script>
import axios from 'axios'
import Relog from '@/components/admin/Relog'
export default {
components: { Relog },
props: {
horasExcepcion: { type: Object, require: true },
updateIsLoading: { type: Function, required: true },
actualizarTabla: { type: Boolean, required: true },
updateActualizarTabla: { type: Function, required: true },
},
data() {
return {
hora_inicio: new Date(),
hora_fin: new Date(),
mostrar: false,
}
},
methods: {
crearHoraExcepcion(id_institucion_dia, hora_inicio, hora_fin) {
const data = {
id_institucion_dia,
hora_inicio,
hora_fin,
}
// this.updateIsLoading(true)
axios
.post(`${process.env.api}/hora-excepcion`, data)
.then((res) => {
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
this.updateActualizarTabla(true)
})
.catch((err) => {
this.error = 'is-danger'
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
},
}
</script>