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="Dominio">
|
|
|
|
<b-input
|
|
|
|
type="text"
|
|
|
|
:placeholder="institucion.dominio"
|
|
|
|
:disabled="!institucion.id_institucion"
|
|
|
|
v-model="dominio"
|
|
|
|
/>
|
|
|
|
</b-field>
|
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
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<b-field class="file">
|
|
|
|
<b-upload v-model="logo" expanded accept=".png,.jpeg,.jpg">
|
|
|
|
<a class="button is-primary is-fullwidth">
|
|
|
|
<b-icon icon="upload" />
|
2022-07-28 23:32:41 +00:00
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<span>{{ logo.name || 'Click para subir el logo' }}</span>
|
|
|
|
</a>
|
|
|
|
</b-upload>
|
|
|
|
</b-field>
|
2022-07-26 03:21:42 +00:00
|
|
|
|
2022-07-29 03:54:06 +00:00
|
|
|
<BotonGuardar
|
|
|
|
:disabled="
|
|
|
|
dominio ||
|
|
|
|
diasMultaRetraso ||
|
|
|
|
tiempoPrestamo ||
|
|
|
|
tiempoRecoger ||
|
|
|
|
tiempoEntrega ||
|
|
|
|
logo.name
|
|
|
|
? false
|
|
|
|
: true
|
|
|
|
"
|
|
|
|
:guardar="actualizarDatos"
|
|
|
|
msjWarning="¿Estas segur@ de querer guardar estos cambios?"
|
|
|
|
/>
|
2022-07-26 19:51:33 +00:00
|
|
|
|
2022-07-29 03:54:06 +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 {
|
2022-07-26 19:51:33 +00:00
|
|
|
components: {
|
2022-07-28 23:32:41 +00:00
|
|
|
BotonGuardar,
|
2022-07-26 19:51:33 +00:00
|
|
|
BotonFinSemestre,
|
|
|
|
},
|
2022-07-11 08:23:33 +00:00
|
|
|
props: {
|
|
|
|
buscar: { type: Function, required: true },
|
|
|
|
updateIsLoading: { type: Function, required: true },
|
|
|
|
admin: { type: Object, required: true },
|
|
|
|
institucion: { type: Object, required: true },
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-07-11 20:58:10 +00:00
|
|
|
dominio: '',
|
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)
|
2022-07-26 04:07:26 +00:00
|
|
|
if (Object.entries(this.logo).length != 0) return this.subirLogo()
|
2022-07-13 19:10:31 +00:00
|
|
|
if (this.dominio) {
|
|
|
|
data.email_institucional = true
|
|
|
|
data.dominio = this.dominio
|
|
|
|
}
|
2022-07-13 23:30:48 +00:00
|
|
|
if (this.diasMultaRetraso)
|
2022-07-26 22:45:53 +00:00
|
|
|
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-07-11 08:23:33 +00:00
|
|
|
axios
|
2022-07-19 16:41:33 +00:00
|
|
|
.put(`${process.env.api}/institucion`, data, this.$getToken.token())
|
2022-07-11 08:23:33 +00:00
|
|
|
.then((res) => {
|
2022-07-28 23:32:41 +00:00
|
|
|
this.dominio = ''
|
|
|
|
this.diasMultaRetraso = ''
|
|
|
|
this.tiempoRecoger = ''
|
|
|
|
this.tiempoEntrega = ''
|
|
|
|
this.tiempoPrestamo = ''
|
2022-07-11 08:23:33 +00:00
|
|
|
this.buscar()
|
2022-07-28 23:32:41 +00:00
|
|
|
this.updateIsLoading(false)
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
2022-07-11 08:23:33 +00:00
|
|
|
})
|
|
|
|
.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-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)
|
|
|
|
axios
|
|
|
|
.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>
|