2022-07-11 08:23:33 +00:00
|
|
|
<template>
|
|
|
|
<div class="column is-4">
|
2022-07-28 23:32:41 +00:00
|
|
|
<h3 class="is-size-4 mb-4">Configuración</h3>
|
2022-07-11 08:23:33 +00:00
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<b-field label="Días de multa por retraso">
|
|
|
|
<b-input
|
|
|
|
type="number"
|
|
|
|
:placeholder="institucion.dias_multa_retraso"
|
|
|
|
:disabled="!institucion.id_institucion"
|
|
|
|
v-model="diasMultaRetraso"
|
|
|
|
/>
|
|
|
|
</b-field>
|
2022-07-13 19:10:31 +00:00
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<b-field label="Tiempo para recoger equipo">
|
|
|
|
<b-input
|
|
|
|
type="number"
|
|
|
|
:placeholder="institucion.tiempo_recoger"
|
|
|
|
:disabled="!institucion.id_institucion"
|
|
|
|
v-model="tiempoRecoger"
|
|
|
|
/>
|
|
|
|
</b-field>
|
2022-07-13 19:10:31 +00:00
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<b-field label="Tiempo para entregar equipo">
|
|
|
|
<b-input
|
|
|
|
type="number"
|
|
|
|
:placeholder="institucion.tiempo_entrega"
|
|
|
|
:disabled="!institucion.id_institucion"
|
|
|
|
v-model="tiempoEntrega"
|
|
|
|
/>
|
|
|
|
</b-field>
|
2022-07-13 23:30:48 +00:00
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<b-field label="Tiempo de préstamo">
|
|
|
|
<b-input
|
|
|
|
type="number"
|
|
|
|
:placeholder="institucion.tiempo_prestamo"
|
|
|
|
:disabled="!institucion.id_institucion"
|
|
|
|
v-model="tiempoPrestamo"
|
|
|
|
/>
|
|
|
|
</b-field>
|
2022-07-13 19:10:31 +00:00
|
|
|
|
2023-01-08 23:50:17 +00:00
|
|
|
<b-field>
|
|
|
|
<b-upload
|
|
|
|
accept=".png,.jpeg,.jpg"
|
|
|
|
class="button is-primary"
|
|
|
|
v-model="logo"
|
|
|
|
expanded
|
|
|
|
>
|
|
|
|
<b-icon icon="upload" />
|
2022-07-28 23:32:41 +00:00
|
|
|
|
2023-01-08 23:50:17 +00:00
|
|
|
<span>{{ logo.name || 'Cargar logo' }}</span>
|
2022-07-29 03:54:06 +00:00
|
|
|
</b-upload>
|
2023-01-08 23:50:17 +00:00
|
|
|
</b-field>
|
2022-07-26 03:21:42 +00:00
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<BotonGuardar
|
|
|
|
:disabled="
|
2022-08-14 22:23:01 +00:00
|
|
|
!diasMultaRetraso &&
|
|
|
|
!tiempoPrestamo &&
|
|
|
|
!tiempoRecoger &&
|
|
|
|
!tiempoEntrega &&
|
|
|
|
!logo.name
|
2022-07-29 03:54:06 +00:00
|
|
|
"
|
|
|
|
:guardar="actualizarDatos"
|
|
|
|
msjWarning="¿Estas segur@ de querer guardar estos cambios?"
|
|
|
|
/>
|
2022-07-26 19:51:33 +00:00
|
|
|
|
2023-01-08 23:50:17 +00:00
|
|
|
<BotonFinSemestre :updateIsLoading="updateIsLoading" :admin="admin" />
|
2022-07-11 08:23:33 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2022-07-26 19:51:33 +00:00
|
|
|
import BotonFinSemestre from '@/components/botones/BotonFinSemestre'
|
2022-07-28 23:32:41 +00:00
|
|
|
import BotonGuardar from '@/components/botones/BotonGuardar'
|
2022-07-11 08:23:33 +00:00
|
|
|
|
|
|
|
export default {
|
2023-01-09 17:29:31 +00:00
|
|
|
components: { BotonGuardar, BotonFinSemestre },
|
2022-07-11 08:23:33 +00:00
|
|
|
props: {
|
2023-01-09 17:29:31 +00:00
|
|
|
buscar: { type: Function, required: true, default: () => {} },
|
|
|
|
updateIsLoading: { type: Function, required: true, default: () => {} },
|
|
|
|
admin: { type: Object, required: true, default: () => ({}) },
|
|
|
|
institucion: { type: Object, required: true, default: () => ({}) },
|
2022-07-11 08:23:33 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-07-13 23:30:48 +00:00
|
|
|
diasMultaRetraso: '',
|
|
|
|
tiempoRecoger: '',
|
|
|
|
tiempoEntrega: '',
|
|
|
|
tiempoPrestamo: '',
|
2022-07-26 03:21:42 +00:00
|
|
|
logo: {},
|
2022-07-11 08:23:33 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
actualizarDatos() {
|
|
|
|
const data = { id_institucion: this.institucion.id_institucion }
|
|
|
|
|
|
|
|
this.updateIsLoading(true)
|
2023-01-08 23:50:17 +00:00
|
|
|
if (this.logo.name) this.subirLogo()
|
2022-08-14 22:23:01 +00:00
|
|
|
if (
|
|
|
|
this.diasMultaRetraso ||
|
|
|
|
this.tiempoRecoger ||
|
|
|
|
this.tiempoEntrega ||
|
|
|
|
this.tiempoPrestamo
|
|
|
|
) {
|
|
|
|
if (this.diasMultaRetraso)
|
|
|
|
data.dias_multa_retraso = Number(this.diasMultaRetraso)
|
|
|
|
if (this.tiempoRecoger) data.tiempo_recoger = Number(this.tiempoRecoger)
|
|
|
|
if (this.tiempoEntrega) data.tiempo_entrega = Number(this.tiempoEntrega)
|
|
|
|
if (this.tiempoPrestamo)
|
|
|
|
data.tiempo_prestamo = Number(this.tiempoPrestamo)
|
2022-12-05 15:36:30 +00:00
|
|
|
return axios
|
2022-08-14 22:23:01 +00:00
|
|
|
.put(`${process.env.api}/institucion`, data, this.$getToken.token())
|
|
|
|
.then((res) => {
|
|
|
|
this.diasMultaRetraso = ''
|
|
|
|
this.tiempoRecoger = ''
|
|
|
|
this.tiempoEntrega = ''
|
|
|
|
this.tiempoPrestamo = ''
|
|
|
|
this.buscar()
|
|
|
|
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
|
|
|
|
)
|
|
|
|
})
|
2022-07-13 19:10:31 +00:00
|
|
|
}
|
2022-07-11 08:23:33 +00:00
|
|
|
},
|
2022-07-26 03:21:42 +00:00
|
|
|
subirLogo() {
|
|
|
|
const formData = new FormData()
|
|
|
|
|
|
|
|
this.updateIsLoading(true)
|
|
|
|
formData.append('logo', this.logo)
|
2022-12-05 15:36:30 +00:00
|
|
|
return axios
|
2022-07-26 03:21:42 +00:00
|
|
|
.post(
|
|
|
|
`${process.env.api}/upload-file/upload-logo?id_institucion=${this.admin.institucion.id_institucion}`,
|
|
|
|
formData,
|
|
|
|
this.$getToken.token()
|
|
|
|
)
|
|
|
|
.then((res) => {
|
|
|
|
this.logo = {}
|
|
|
|
this.updateIsLoading(false)
|
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.updateIsLoading(false)
|
2022-08-05 23:41:37 +00:00
|
|
|
this.$alertsGenericos.imprimirError(
|
|
|
|
this.$buefy,
|
|
|
|
this.$router,
|
|
|
|
err.response.data
|
|
|
|
)
|
2022-07-26 03:21:42 +00:00
|
|
|
})
|
|
|
|
},
|
2022-07-11 08:23:33 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|