This commit is contained in:
Andres2908 2022-07-25 22:21:42 -05:00
parent afd0d46cb0
commit ddf0e3fc5c
2 changed files with 34 additions and 4 deletions

View File

@ -121,6 +121,15 @@
/>
</b-field>
<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"></b-icon>
<span>{{ logo.name || 'Click para subir el logo' }}</span>
</a>
</b-upload>
</b-field>
<b-field>
<b-button
type="is-info"
@ -133,7 +142,8 @@
diasMultaRetraso ||
tiempoPrestamo ||
tiempoRecoger ||
tiempoEntrega
tiempoEntrega ||
logo
? false
: true
"
@ -169,6 +179,7 @@ export default {
tiempoRecoger: '',
tiempoEntrega: '',
tiempoPrestamo: '',
logo: {},
}
},
methods: {
@ -176,6 +187,7 @@ export default {
const data = { id_institucion: this.institucion.id_institucion }
this.updateIsLoading(true)
if (this.logo) return this.subirLogo()
if (this.correo) data.correo = this.correo
if (this.responsable) data.responsable = this.responsable
if (this.telefono) data.telefono = this.telefono
@ -210,6 +222,27 @@ export default {
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
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)
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
},
}
</script>

View File

@ -45,9 +45,6 @@ export default {
}
},
methods: {
deleteDropFile(index) {
this.logo.splice(index, 1)
},
subirLogo() {
const formData = new FormData()