relojes corregidos y se agrego hora extra y tope
This commit is contained in:
parent
d3af90f93a
commit
ae973098d2
@ -3,17 +3,13 @@
|
||||
<div class="panel">
|
||||
<h6 class="panel-heading">Avisos</h6>
|
||||
|
||||
<p v-for="(a, i) in avisos" :key="i" class="panel-block">
|
||||
{{ a }}
|
||||
</p>
|
||||
<p v-for="(a, i) in avisos" :key="i" class="panel-block">{{ a }}</p>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<h6 class="panel-heading">Errores</h6>
|
||||
|
||||
<p v-for="(e, i) in errores" :key="i" class="panel-block">
|
||||
{{ e }}
|
||||
</p>
|
||||
<p v-for="(e, i) in errores" :key="i" class="panel-block">{{ e }}</p>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
@ -1,122 +0,0 @@
|
||||
<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>
|
||||
|
||||
<Reloj
|
||||
: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-column field="eliminar" label="Eliminar" centered v-slot="props">
|
||||
<b-button
|
||||
type="is-danger"
|
||||
@click="
|
||||
;(id_hora_excepcion = props.row.id_hora_excepcion),
|
||||
$alertsGenericos.imprimirWarning(
|
||||
$buefy,
|
||||
'¿Esta segur@ de querer eliminar esta hora excepció?',
|
||||
eliminarHoraExcepcion
|
||||
)
|
||||
"
|
||||
>
|
||||
Eliminar
|
||||
</b-button>
|
||||
</b-table-column>
|
||||
</b-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import Reloj from '@/components/admin/Reloj'
|
||||
|
||||
export default {
|
||||
components: { Reloj },
|
||||
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,
|
||||
|
||||
id_hora_excepcion: 0,
|
||||
}
|
||||
},
|
||||
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, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
this.updateActualizarTabla(true)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error = 'is-danger'
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
})
|
||||
},
|
||||
eliminarHoraExcepcion() {
|
||||
const data = {
|
||||
id_hora_excepcion: this.id_hora_excepcion,
|
||||
}
|
||||
|
||||
axios
|
||||
.delete(
|
||||
`${process.env.api}/hora-excepcion`,
|
||||
this.$getToken.tokenDelete(data)
|
||||
)
|
||||
.then((res) => {
|
||||
this.$alertsGenericos.imprimirMensaje(
|
||||
this.$buefy,
|
||||
'Se ah eliminado correctamente la hora excepción'
|
||||
)
|
||||
this.updateActualizarTabla(true)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error = 'is-danger'
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
@ -1,10 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2 class="column is-narrow is-size-3 is-size-4-mobile">Informe General</h2>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<p class="column is-2 has-text-centered mt-2" centered>
|
||||
<b>Perído de:</b>
|
||||
</p>
|
||||
|
||||
<b-field class="column is-3">
|
||||
<b-datepicker
|
||||
v-model="fechaInicio"
|
||||
@ -12,11 +14,11 @@
|
||||
:max-date="maxDate"
|
||||
icon="calendar-today"
|
||||
rounded
|
||||
>
|
||||
</b-datepicker>
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
<p class="column is-2 has-text-centered mt-2" centered><b>a:</b></p>
|
||||
|
||||
<b-field class="column is-3">
|
||||
<b-datepicker
|
||||
v-model="fechaFin"
|
||||
@ -47,7 +49,6 @@ export default {
|
||||
return {
|
||||
minDate: new Date('2022-01-01'),
|
||||
maxDate: new Date(),
|
||||
|
||||
fechaInicio: new Date(),
|
||||
fechaFin: new Date(),
|
||||
}
|
||||
|
@ -14,9 +14,9 @@
|
||||
<b-field label="Contraseña" :type="error">
|
||||
<b-input
|
||||
type="password"
|
||||
password-reveal
|
||||
v-model="password"
|
||||
@keyup.enter.native="login()"
|
||||
v-model="password"
|
||||
password-reveal
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
@ -54,13 +54,10 @@ export default {
|
||||
operador: this.usuario,
|
||||
password: this.password,
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.post(
|
||||
`${process.env.api}/auth/login-admin`,
|
||||
data,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.post(`${process.env.api}/auth/login-admin`, data)
|
||||
.then((res) => {
|
||||
const token = res.data.token
|
||||
const operador = JSON.stringify(res.data.operador)
|
||||
@ -68,12 +65,11 @@ export default {
|
||||
localStorage.setItem('operador', operador)
|
||||
localStorage.setItem('token', token)
|
||||
this.updateIsLoading(false)
|
||||
if (res.data.operador.tipoUsuario.id_tipo_usuario === 3)
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
else
|
||||
if (res.data.operador.tipoUsuario.id_tipo_usuario === 2)
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
else this.$router.push('/prestamo_devolucion')
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error = 'is-danger'
|
||||
@ -86,37 +82,6 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
obtenerCatalogoInstitucion() {
|
||||
axios
|
||||
.get(`${process.env.api}/institucion`, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.instituciones = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
})
|
||||
},
|
||||
obtenerCatalogoModulo() {
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/modulo/modulos?id_institucion=${this.idInstitucion}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.modulos = res.data
|
||||
})
|
||||
.catch((err) => {
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
password() {
|
||||
@ -125,9 +90,6 @@ export default {
|
||||
usuario() {
|
||||
if (this.error) this.error = ''
|
||||
},
|
||||
idInstitucion() {
|
||||
this.obtenerCatalogoModulo()
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -1,100 +1,40 @@
|
||||
<template>
|
||||
<div class="has-text-centered">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<b-field label="Selecciona la hora de inicio">
|
||||
<b-clockpicker
|
||||
type="is-info"
|
||||
v-model="horaInicio"
|
||||
inline
|
||||
:min-time="minTime"
|
||||
:max-time="maxTime"
|
||||
:locale="locale"
|
||||
:hour-format="hourFormat"
|
||||
/>
|
||||
</b-field>
|
||||
</div>
|
||||
|
||||
<div class="column">
|
||||
<b-field label="Selecciona la hora de fin">
|
||||
<b-clockpicker
|
||||
type="is-info"
|
||||
v-model="horaFin"
|
||||
inline
|
||||
:min-time="minTime"
|
||||
:max-time="maxTime"
|
||||
:locale="locale"
|
||||
:hour-format="hourFormat"
|
||||
/>
|
||||
</b-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="has-text-centered">
|
||||
<b-button
|
||||
class="my-5"
|
||||
type="is-success"
|
||||
@click="
|
||||
$alertsGenericos.imprimirWarning($buefy, mensajeWarning, funcionHora)
|
||||
"
|
||||
>
|
||||
Guardar
|
||||
</b-button>
|
||||
</div>
|
||||
</div>
|
||||
<b-field class="column" :label="`Selecciona la hora ${tipo}`">
|
||||
<b-clockpicker
|
||||
hour-format="24"
|
||||
locale="es-ES"
|
||||
type="is-info"
|
||||
:min-time="minTime"
|
||||
:max-time="maxTime"
|
||||
v-model="hora"
|
||||
inline
|
||||
/>
|
||||
</b-field>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
cambiarHora: { type: Function, require: false },
|
||||
crearHoraExcepcion: { type: Function, require: false },
|
||||
diaSeleccion: { type: Object, require: true },
|
||||
tipo: { type: String, require: true },
|
||||
horaStr: { type: String, required: true, default: '' },
|
||||
tipo: { type: String, required: true, default: '' },
|
||||
},
|
||||
data() {
|
||||
const min = new Date()
|
||||
min.setHours(7)
|
||||
min.setMinutes(0)
|
||||
const max = new Date()
|
||||
max.setHours(20)
|
||||
max.setMinutes(0)
|
||||
return {
|
||||
minTime: min,
|
||||
maxTime: max,
|
||||
horaInicio: new Date(`01-01-2022 09:00`),
|
||||
horaFin: new Date(`01-01-2022 17:45`),
|
||||
locale: 'es-ES', // Browser locale
|
||||
hourFormat: '24', // Browser locale
|
||||
|
||||
mensajeWarning: '',
|
||||
minTime: new Date(`${moment().format('DD-MM-YYYY')} 07:00`),
|
||||
maxTime: new Date(`${moment().format('DD-MM-YYYY')} 20:00`),
|
||||
hora: new Date(),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
funcionHora() {
|
||||
if (this.tipo === 'cambiarHora')
|
||||
this.cambiarHora(
|
||||
this.diaSeleccion,
|
||||
moment(this.horaInicio).format('HH:mm'),
|
||||
moment(this.horaFin).format('HH:mm')
|
||||
)
|
||||
else
|
||||
this.crearHoraExcepcion(
|
||||
this.diaSeleccion.id_institucion_dia,
|
||||
moment(this.horaInicio).format('HH:mm'),
|
||||
moment(this.horaFin).format('HH:mm')
|
||||
)
|
||||
watch: {
|
||||
hora(horaSeleccionada) {
|
||||
this.$emit('hora-seleccionada', horaSeleccionada)
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.horaInicio = new Date(`01-01-2022 ${this.diaSeleccion.hora_inicio}`)
|
||||
this.horaFin = new Date(`01-01-2022 ${this.diaSeleccion.hora_fin}`)
|
||||
if (this.tipo === 'cambiarHora')
|
||||
this.mensajeWarning =
|
||||
'¿Esta segur@ de querer actualizar el horario de este día?'
|
||||
else
|
||||
this.mensajeWarning = '¿Esta segur@ de querer crear esta hora excepción?'
|
||||
if (this.horaStr)
|
||||
this.hora = new Date(`${moment().format('DD-MM-YYYY')} ${this.horaStr}`)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
85
components/admin/RelojesHoraExcepcion.vue
Normal file
85
components/admin/RelojesHoraExcepcion.vue
Normal file
@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="columns">
|
||||
<Reloj
|
||||
horaStr="11:00"
|
||||
tipo="inicio"
|
||||
@hora-seleccionada="(nuevaHoraInicio) => (horaInicio = nuevaHoraInicio)"
|
||||
/>
|
||||
|
||||
<Reloj
|
||||
horaStr="12:00"
|
||||
tipo="fin"
|
||||
@hora-seleccionada="(nuevaHoraFind) => (horaFin = nuevaHoraFind)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<dir>
|
||||
<div class="columns is-centered">
|
||||
<BotonCrear columnSize="is-3" :disabled="false" :crear="warning" />
|
||||
</div>
|
||||
</dir>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import moment from 'moment'
|
||||
import BotonCrear from '@/components/botones/BotonCrear'
|
||||
import Reloj from '@/components/admin/Reloj'
|
||||
|
||||
export default {
|
||||
components: { BotonCrear, Reloj },
|
||||
props: {
|
||||
editar: { type: Function, required: true, default: () => {} },
|
||||
obtenerHorasExcepcion: {
|
||||
type: Function,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
updateIsLoading: { type: Function, required: true, default: () => {} },
|
||||
updateMostrar: { type: Function, required: true, default: () => {} },
|
||||
institucionDia: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
horaInicio: new Date(),
|
||||
horaFin: new Date(),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
crear() {
|
||||
const data = {
|
||||
id_institucion_dia: this.institucionDia.id_institucion_dia,
|
||||
hora_inicio: moment(this.horaInicio).format('HH:mm'),
|
||||
hora_fin: moment(this.horaFin).format('HH:mm'),
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.post(`${process.env.api}/hora-excepcion`, data, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.obtenerHorasExcepcion()
|
||||
this.updateIsLoading(false)
|
||||
this.updateMostrar(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
err.response.data
|
||||
)
|
||||
})
|
||||
},
|
||||
warning() {
|
||||
this.$alertsGenericos.imprimirWarning(
|
||||
this.$buefy,
|
||||
'¿Esta segur@ de querer crear este horario sin servicio?',
|
||||
this.crear
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
99
components/admin/RelojesInstitucionDia.vue
Normal file
99
components/admin/RelojesInstitucionDia.vue
Normal file
@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<div class="has-text-centered">
|
||||
<div class="columns">
|
||||
<Reloj
|
||||
tipo="inicio"
|
||||
:horaStr="institucionDia.hora_inicio"
|
||||
@hora-seleccionada="(nuevaHoraInicio) => (horaInicio = nuevaHoraInicio)"
|
||||
/>
|
||||
|
||||
<Reloj
|
||||
tipo="fin"
|
||||
:horaStr="institucionDia.hora_fin"
|
||||
@hora-seleccionada="(nuevaHoraFind) => (horaFin = nuevaHoraFind)"
|
||||
/>
|
||||
|
||||
<Reloj
|
||||
tipo="extra"
|
||||
:horaStr="institucionDia.hora_extra"
|
||||
@hora-seleccionada="(nuevaHoraExtra) => (horaExtra = nuevaHoraExtra)"
|
||||
/>
|
||||
|
||||
<Reloj
|
||||
tipo="tope"
|
||||
:horaStr="institucionDia.hora_tope"
|
||||
@hora-seleccionada="(nuevaHoraTope) => (horaTope = nuevaHoraTope)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="columns is-centered">
|
||||
<BotonGuardar
|
||||
columnSize="is-3"
|
||||
msjWarning="¿Estás segur@ de querer guardar estos cambios?"
|
||||
:guardar="guardar"
|
||||
:disabled="false"
|
||||
:column="true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import moment from 'moment'
|
||||
import BotonGuardar from '@/components/botones/BotonGuardar'
|
||||
import Reloj from '@/components/admin/Reloj'
|
||||
|
||||
export default {
|
||||
components: { BotonGuardar, Reloj },
|
||||
props: {
|
||||
editar: { type: Function, required: true, default: () => {} },
|
||||
obtenerDias: { type: Function, required: true, default: () => {} },
|
||||
updateIsLoading: { type: Function, required: true, default: () => {} },
|
||||
institucionDia: { type: Object, required: true, default: () => ({}) },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
horaInicio: new Date(),
|
||||
horaFin: new Date(),
|
||||
horaExtra: new Date(),
|
||||
horaTope: new Date(),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
guardar() {
|
||||
const data = {
|
||||
id_institucion_dia: this.institucionDia.id_institucion_dia,
|
||||
hora_inicio: moment(this.horaInicio).format('HH:mm'),
|
||||
hora_fin: moment(this.horaFin).format('HH:mm'),
|
||||
hora_extra: moment(this.horaExtra).format('HH:mm'),
|
||||
hora_tope: moment(this.horaTope).format('HH:mm'),
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.put(`${process.env.api}/institucion-dia`, data, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.obtenerDias()
|
||||
this.editar(this.institucionDia)
|
||||
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
|
||||
)
|
||||
})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.horaInicio = new Date(`01-01-2022 ${this.institucionDia.hora_inicio}`)
|
||||
this.horaFin = new Date(`01-01-2022 ${this.institucionDia.hora_fin}`)
|
||||
this.horaExtra = new Date(`01-01-2022 ${this.institucionDia.hora_extra}`)
|
||||
this.horaTope = new Date(`01-01-2022 ${this.institucionDia.hora_tope}`)
|
||||
},
|
||||
}
|
||||
</script>
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<b-field :class="column ? 'column' : ''">
|
||||
<b-field :class="column ? `column ${columnSize}` : ''">
|
||||
<b-button
|
||||
type="is-link"
|
||||
:disabled="disabled"
|
||||
|
@ -4,15 +4,17 @@
|
||||
<h5 class="subtitle is-3">Horario sin servicio</h5>
|
||||
|
||||
<b-field class="mb-5">
|
||||
<b-button type="is-info" @click="mostrar = !mostrar">
|
||||
<b-button type="is-info" @click="updateMostrar()">
|
||||
{{ mostrar ? 'Ocutar' : 'Agregar' }}
|
||||
</b-button>
|
||||
</b-field>
|
||||
|
||||
<Reloj
|
||||
:diaSeleccion="institucionDia"
|
||||
:crearHoraExcepcion="crearHoraExcepcion"
|
||||
tipo="crearHoraExcepcion"
|
||||
<RelojesHoraExcepcion
|
||||
:editar="editar"
|
||||
:obtenerHorasExcepcion="obtenerHorasExcepcion"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:updateMostrar="updateMostrar"
|
||||
:institucionDia="institucionDia"
|
||||
v-if="mostrar"
|
||||
/>
|
||||
</div>
|
||||
@ -20,7 +22,7 @@
|
||||
<TablaHoraExcepcion
|
||||
:horasExcepcion="horasExcepcion"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
:obtenerDias="obtenerDias"
|
||||
:obtenerHorasExcepcion="obtenerHorasExcepcion"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
/>
|
||||
</div>
|
||||
@ -29,64 +31,36 @@
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import TablaHoraExcepcion from '@/components/tablas/TablaHoraExcepcion'
|
||||
import Reloj from '@/components/admin/Reloj'
|
||||
import RelojesHoraExcepcion from '@/components/admin/RelojesHoraExcepcion'
|
||||
|
||||
export default {
|
||||
components: { Reloj, TablaHoraExcepcion },
|
||||
components: { RelojesHoraExcepcion, 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: () => {} },
|
||||
editar: { type: Function, required: true, default: () => {} },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// horasExcepcion: [],
|
||||
// isLoadingTable: false,
|
||||
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, this.$router, 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)
|
||||
obtenerHorasExcepcion() {
|
||||
this.isLoadingTable = true
|
||||
axios
|
||||
.post(`${process.env.api}/hora-excepcion`, data, this.$getToken.token())
|
||||
.get(
|
||||
`${process.env.api}/hora-excepcion?id_institucion_dia=${this.institucionDia.id_institucion_dia}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.mostrar = false
|
||||
this.obtenerDias()
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
this.horasExcepcion = res.data
|
||||
this.isLoadingTable = false
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.isLoadingTable = false
|
||||
this.$alertsGenericos.imprimirError(
|
||||
this.$buefy,
|
||||
this.$router,
|
||||
@ -94,9 +68,16 @@ export default {
|
||||
)
|
||||
})
|
||||
},
|
||||
onPageChange(page) {
|
||||
this.page = page
|
||||
this.obtenerHorasExcepcion()
|
||||
},
|
||||
updateMostrar() {
|
||||
this.mostrar = !this.mostrar
|
||||
},
|
||||
},
|
||||
created() {
|
||||
// this.obtenerHorasExcepcion()
|
||||
this.obtenerHorasExcepcion()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -37,6 +37,24 @@
|
||||
<p>{{ props.row.hora_fin }}</p>
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column
|
||||
field="hora_extra"
|
||||
label="Hora extra del servicio"
|
||||
v-slot="props"
|
||||
centered
|
||||
>
|
||||
<p>{{ props.row.hora_extra }}</p>
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column
|
||||
field="hora_tope"
|
||||
label="Hora tope del servicio"
|
||||
v-slot="props"
|
||||
centered
|
||||
>
|
||||
<p>{{ props.row.hora_tope }}</p>
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="editar" label="Editar horas" v-slot="props" centered>
|
||||
<BotonEditar :editar="editar" :row="props.row" />
|
||||
</b-table-column>
|
||||
@ -53,18 +71,18 @@
|
||||
|
||||
<template #detail="props">
|
||||
<HorasExcepcionDia
|
||||
:institucionDia="props.row"
|
||||
:horasExcepcion="props.row.horasExcepcion"
|
||||
:isLoadingTable="isLoadingTable"
|
||||
:obtenerDias="obtenerDias"
|
||||
:editar="editar"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:institucionDia="props.row"
|
||||
v-if="!mostrar"
|
||||
/>
|
||||
|
||||
<Reloj
|
||||
:diaSeleccion="props.row"
|
||||
:cambiarHora="cambiarHora"
|
||||
tipo="cambiarHora"
|
||||
<RelojesInstitucionDia
|
||||
:editar="editar"
|
||||
:obtenerDias="obtenerDias"
|
||||
:institucionDia="props.row"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
v-if="mostrar"
|
||||
/>
|
||||
</template>
|
||||
@ -76,10 +94,15 @@ import axios from 'axios'
|
||||
import BotonDesactivar from '@/components/botones/BotonDesactivar'
|
||||
import BotonEditar from '@/components/botones/BotonEditar'
|
||||
import HorasExcepcionDia from '@/components/tablas/HorasExcepcionDia'
|
||||
import Reloj from '@/components/admin/Reloj'
|
||||
import RelojesInstitucionDia from '@/components/admin/RelojesInstitucionDia'
|
||||
|
||||
export default {
|
||||
components: { BotonEditar, BotonDesactivar, HorasExcepcionDia, Reloj },
|
||||
components: {
|
||||
BotonEditar,
|
||||
BotonDesactivar,
|
||||
HorasExcepcionDia,
|
||||
RelojesInstitucionDia,
|
||||
},
|
||||
props: {
|
||||
dias: { type: Array, required: true, default: () => [] },
|
||||
isLoadingTable: { type: Boolean, required: true, default: false },
|
||||
@ -133,33 +156,6 @@ export default {
|
||||
if (this.openAux.length > 0) this.mostrar = true
|
||||
else this.mostrar = false
|
||||
},
|
||||
cambiarHora(institucionDia, hora_inicio, hora_fin) {
|
||||
const data = {
|
||||
id_institucion_dia: institucionDia.id_institucion_dia,
|
||||
hora_inicio,
|
||||
hora_fin,
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.put(`${process.env.api}/institucion-dia`, data, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.obtenerDias()
|
||||
this.editar(institucionDia)
|
||||
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
|
||||
)
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {},
|
||||
created() {},
|
||||
}
|
||||
</script>
|
||||
|
@ -37,16 +37,11 @@ export default {
|
||||
components: { BotonEliminar },
|
||||
props: {
|
||||
horasExcepcion: { type: Array, required: true, default: () => [] },
|
||||
obtenerDias: {
|
||||
obtenerHorasExcepcion: {
|
||||
type: Function,
|
||||
required: true,
|
||||
default: () => {},
|
||||
},
|
||||
// obtenerHorasExcepcion: {
|
||||
// type: Function,
|
||||
// required: true,
|
||||
// default: () => {},
|
||||
// },
|
||||
isLoadingTable: { type: Boolean, required: true, default: false },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
},
|
||||
@ -63,8 +58,7 @@ export default {
|
||||
this.$getToken.tokenDelete(data)
|
||||
)
|
||||
.then((res) => {
|
||||
this.obtenerDias()
|
||||
// this.obtenerHorasExcepcion()
|
||||
this.obtenerHorasExcepcion()
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
})
|
||||
|
@ -55,7 +55,6 @@ export default {
|
||||
// },
|
||||
localStorageData() {
|
||||
const operador = JSON.parse(localStorage.getItem('operador'))
|
||||
console.log(operador)
|
||||
this.admin.idOperador = operador.id_operador
|
||||
this.admin.operador = operador
|
||||
this.admin.tipoUsuario = operador.tipoUsuario.tipo_usuario
|
||||
|
@ -21,7 +21,6 @@ const alertsGenericos = {
|
||||
type: 'is-danger',
|
||||
})
|
||||
localStorage.clear()
|
||||
console.log('hola')
|
||||
router.push('/')
|
||||
} else {
|
||||
buefy.dialog.alert({
|
||||
|
Loading…
Reference in New Issue
Block a user