72 lines
1.7 KiB
Vue
72 lines
1.7 KiB
Vue
<template>
|
|
<div class="column has-text-centered pb-5">
|
|
<b-field>
|
|
<b-upload v-model="logo" drag-drop expanded accept=".png,.jpeg,.jpg">
|
|
<section
|
|
class="section is-flex is-align-items-center is-justify-content-center drag-drop"
|
|
>
|
|
<div class="content has-text-centered">
|
|
<p>
|
|
<b-icon icon="upload" size="is-large"> </b-icon>
|
|
</p>
|
|
|
|
<p>{{ logo.name || 'Adjunta el logo de la Institución' }}</p>
|
|
</div>
|
|
</section>
|
|
</b-upload>
|
|
</b-field>
|
|
|
|
<b-button
|
|
type="is-success"
|
|
:disabled="!logo.name"
|
|
@click="
|
|
$alertsGenericos.imprimirWarning(
|
|
$buefy,
|
|
'¿Esta segur@ de querer subir este archivo?',
|
|
subirLogo
|
|
)
|
|
"
|
|
>
|
|
Subir
|
|
</b-button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
export default {
|
|
props: {
|
|
admin: { type: Object, require: true },
|
|
updateIsLoading: { type: Function, required: true },
|
|
},
|
|
data() {
|
|
return {
|
|
logo: {},
|
|
}
|
|
},
|
|
methods: {
|
|
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.dropFiles = []
|
|
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>
|