99 lines
2.8 KiB
Vue
99 lines
2.8 KiB
Vue
<template>
|
|
<div>
|
|
<div class="has-text-centered">
|
|
<h5 class="subtitle is-3">Horario sin servicio</h5>
|
|
|
|
<b-field class="mb-5">
|
|
<b-button type="is-info" @click="mostrar = !mostrar">
|
|
{{ mostrar ? 'Ocutar' : 'Agregar' }}
|
|
</b-button>
|
|
</b-field>
|
|
|
|
<Reloj
|
|
:diaSeleccion="institucionDia"
|
|
:crearHoraExcepcion="crearHoraExcepcion"
|
|
tipo="crearHoraExcepcion"
|
|
v-if="mostrar"
|
|
/>
|
|
</div>
|
|
|
|
<TablaHoraExcepcion
|
|
:horasExcepcion="horasExcepcion"
|
|
:isLoadingTable="isLoadingTable"
|
|
:obtenerDias="obtenerDias"
|
|
:updateIsLoading="updateIsLoading"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import TablaHoraExcepcion from '@/components/tablas/TablaHoraExcepcion'
|
|
import Reloj from '@/components/admin/Reloj'
|
|
|
|
export default {
|
|
components: { Reloj, TablaHoraExcepcion },
|
|
props: {
|
|
horasExcepcion: { type: Array, required: true, default: () => [] },
|
|
isLoadingTable: { type: Boolean, required: true, default: false },
|
|
institucionDia: { type: Object, required: true, default: () => ({}) },
|
|
obtenerDias: { type: Function, required: true, default: () => {} },
|
|
updateIsLoading: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
// horasExcepcion: [],
|
|
// isLoadingTable: false,
|
|
mostrar: false,
|
|
}
|
|
},
|
|
methods: {
|
|
// obtenerHorasExcepcion() {
|
|
// this.isLoadingTable = true
|
|
// axios
|
|
// .get(
|
|
// `${process.env.api}/hora-excepcion/horas-excepcion?id_dia_institucion=${this.institucionDia.id_institucion_dia}`,
|
|
// this.$getToken.token()
|
|
// )
|
|
// .then(async (res) => {
|
|
// this.horasExcepcion = res.data
|
|
// this.isLoadingTable = false
|
|
// })
|
|
// .catch((err) => {
|
|
// this.isLoadingTable = false
|
|
// this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
// })
|
|
// },
|
|
// onPageChange(page) {
|
|
// this.page = page
|
|
// this.obtenerHorasExcepcion()
|
|
// },
|
|
crearHoraExcepcion(id_institucion_dia, hora_inicio, hora_fin) {
|
|
const data = {
|
|
id_institucion_dia,
|
|
// id_institucion_dia: this.institucionDia.id_institucion_dia,
|
|
hora_inicio,
|
|
hora_fin,
|
|
}
|
|
|
|
this.updateIsLoading(true)
|
|
axios
|
|
.post(`${process.env.api}/hora-excepcion`, data, this.$getToken.token())
|
|
.then((res) => {
|
|
this.mostrar = false
|
|
this.obtenerDias()
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
})
|
|
.catch((err) => {
|
|
this.updateIsLoading(false)
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
|
})
|
|
},
|
|
},
|
|
created() {
|
|
// this.obtenerHorasExcepcion()
|
|
},
|
|
}
|
|
</script>
|