Componente documento
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div>
|
||||
<span class="spanDoc"
|
||||
><strong>{{ title }}</strong></span
|
||||
>
|
||||
<a :href="link" target="_blank">
|
||||
<b-button class="is-info">
|
||||
Ver
|
||||
</b-button>
|
||||
</a>
|
||||
<b-button
|
||||
class="is-danger"
|
||||
v-if="esRechazable()"
|
||||
@click="mensajeBool = !mensajeBool"
|
||||
>
|
||||
Rechazar
|
||||
</b-button>
|
||||
<b-field label="Razón del rechazo: " v-if="mensajeBool">
|
||||
<b-input maxlength="500" type="textarea" v-model="mensajeRech"></b-input>
|
||||
</b-field>
|
||||
<b-button
|
||||
v-if="mensajeRech && mensajeBool"
|
||||
class="is-danger"
|
||||
@click="rechazarDialog()"
|
||||
>
|
||||
Rechazar documento
|
||||
</b-button>
|
||||
<b-button v-else-if="mensajeBool" disabled>
|
||||
Rechazar documento
|
||||
</b-button>
|
||||
<b-loading
|
||||
:is-full-page="true"
|
||||
v-model="isLoading"
|
||||
:can-cancel="false"
|
||||
></b-loading>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
export default {
|
||||
props: {
|
||||
title: String,
|
||||
link: String,
|
||||
idDoc: Number,
|
||||
doc: Object,
|
||||
status: Number,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
mensajeRech: "",
|
||||
mensajeBool: false,
|
||||
idServicio: localStorage.getItem("idServicio"),
|
||||
isLoading: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
esRechazable() {
|
||||
switch (this.idDoc) {
|
||||
case 1:
|
||||
if (this.status == 1) return true;
|
||||
else return false;
|
||||
case 2:
|
||||
if (this.status == 5) return true;
|
||||
else return false;
|
||||
case 3:
|
||||
if (this.status == 5) return true;
|
||||
else return false;
|
||||
}
|
||||
},
|
||||
rechazarDialog() {
|
||||
this.$buefy.dialog.confirm({
|
||||
title: "Confimar servicio",
|
||||
message: "¿Seguro(a) que quiere rechazar este documento?",
|
||||
confirmText: "Confirmar",
|
||||
cancelText: "Cancelar",
|
||||
type: "is-danger",
|
||||
hasIcon: true,
|
||||
onConfirm: () => {
|
||||
switch (this.idDoc) {
|
||||
case 1:
|
||||
this.rechazarCartaAceptacion();
|
||||
break;
|
||||
case 2:
|
||||
this.rechazarCartaTermino();
|
||||
break;
|
||||
case 3:
|
||||
this.rechazarInformeGlobal();
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
rechazarCartaAceptacion() {
|
||||
this.isLoading = true;
|
||||
const data = {
|
||||
mensaje: this.mensajeRech,
|
||||
idServicio: this.idServicio,
|
||||
};
|
||||
axios
|
||||
.put(`${process.env.api}/servicio/rechazar_aceptacion`, data)
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
this.$buefy.dialog.alert("Se ha rechazado el documento");
|
||||
this.$router.push("/admin");
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false;
|
||||
this.error();
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
rechazarCartaTermino() {
|
||||
this.isLoading = true;
|
||||
const data = {
|
||||
mensaje: this.mensajeRech,
|
||||
idServicio: this.idServicio,
|
||||
};
|
||||
axios
|
||||
.put(`${process.env.api}/servicio/rechazar_termino`, data)
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
this.$buefy.dialog.alert("Se ha rechazado el documento");
|
||||
this.$router.push("/admin");
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false;
|
||||
this.error();
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
rechazarInformeGlobal() {
|
||||
this.isLoading = true;
|
||||
const data = {
|
||||
mensaje: this.mensajeRech,
|
||||
idServicio: this.idServicio,
|
||||
};
|
||||
axios
|
||||
.put(`${process.env.api}/servicio/rechazar_informe`, data)
|
||||
.then((res) => {
|
||||
this.isLoading = false;
|
||||
this.$buefy.dialog.alert("Se ha rechazado el documento");
|
||||
this.$router.push("/admin");
|
||||
})
|
||||
.catch((err) => {
|
||||
this.isLoading = false;
|
||||
this.error();
|
||||
console.log(err);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user