This commit is contained in:
Lemuel Marquez
2020-12-09 15:40:43 -06:00
5 changed files with 301 additions and 397 deletions
@@ -1,225 +1,129 @@
<template>
<!--<div class="container">
<div class="table-responsive-md">
<table class="table mt-3 table-hover">
<thead>
<tr>
<th>Nombre de responsable</th>
<th>Correo</th>
</tr>
</thead>
<tbody class="renglon">
<tr
v-for="responsable in responsables"
:key="responsable.idResponsable"
@click="verRegistro(responsable.idResponsable)"
<div class="container mt-5">
<div class="columns">
<div class="column is-3 mb-4 pb-4">
<b-field>
<b-input
type="name"
placeholder="Nombre"
icon="account"
rounded
v-model="nombre"
></b-input>
</b-field>
</div>
<div class="column is-3 mb-0">
<b-field>
<b-input
placeholder="Correo electrónico"
icon="school"
rounded
v-model="correo"
maxlength="9"
>
<td>{{ responsable.nombre }}</td>
<td>{{ responsable.correo }}</td>
</tr>
</tbody>
</table>
</b-input>
</b-field>
</div>
<div class="buttons section pt-3 pl-5">
<b-button type="is-info" @click="obtenerDatos(idStatus)">
Buscar
</b-button>
</div>
</div>
</div>-->
<section>
<b-table
class="tabla"
hoverable
:data="responsables"
striped
paginated
:total="total"
:per-page="perPage"
@page-change="onPageChange"
aria-next-label="Next page"
aria-previous-label="Previous page"
aria-page-label="Page"
aria-current-label="Current page"
>
<template v-for="column in columns">
<b-table-column :key="column.id" v-bind="column">
<template
v-if="column.searchable && !column.numeric"
slot="searchable"
slot-scope="props"
>
<b-input
v-model="props.filters[props.column.field]"
placeholder="Buscar por..."
icon="magnify"
class="busqueda"
/>
</template>
<template v-slot="props">
<span @click="verRegistro(props.row.idResponsable)">{{
props.row[column.field]
<div class="columns mb-5">
<section class="column is-12">
<b-table
:data="data"
:loading="loading"
hoverable
striped
paginated
backend-pagination
:total="total"
:per-page="perPage"
@page-change="onPageChange"
>
<b-table-column field="nombre" label="Nombre" v-slot="props" centered>
<span @click="verRegistro(props.row.usuario)">{{
props.row.nombre
}}</span>
</template>
</b-table-column>
</template>
</b-table>
</section>
</b-table-column>
<b-table-column
field="correo"
label="Correo electrónico"
v-slot="props"
centered
>
<span @click="verRegistro(props.row.usuario)">{{
props.row.usuario
}}</span>
</b-table-column>
</b-table>
</section>
</div>
</div>
</template>
<script>
import axios from "axios";
export default {
data() {
return {
idUsuario: "",
data: [],
total: "",
loading: false,
page: 1,
perPage: 20,
total: 0,
responsables: [
{
idResponsable: 1,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 2,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 3,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 4,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 5,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 6,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 7,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 8,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 9,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 10,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 11,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 12,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 13,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 14,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 15,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 16,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 17,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 18,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 19,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 20,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 21,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 22,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 23,
nombre: "Marco",
correo: "correo1",
},
{
idResponsable: 24,
nombre: "Lemuel",
correo: "correo2",
},
],
columns: [
{
field: "idResponsable",
visible: false,
},
{
field: "nombre",
label: "Nombre responsable",
searchable: true,
centered: true,
},
{
field: "correo",
label: "Correo electrónico",
searchable: true,
centered: true,
},
],
perPage: 25,
correo: "",
nombre: "",
idStatus: 1,
};
},
methods: {
verRegistro(idResponsable) {
localStorage.setItem("idResponsable", idResponsable);
this.$router.push("/programa/responsableinfo");
console.log(idResponsable);
},
onPageChange(page) {
this.page = page;
this.loadAsyncData();
this.obtenerDatos();
console.log(this.page);
},
obtenerDatos(idStatus) {
this.loading = true;
this.data = [];
axios
.get(
`${process.env.api}/usuario/responsable?idUsuario=${this.idUsuario}&pagina=${this.page}&nombre=${this.nombre}&correo=${this.correo}`
)
.then((res) => {
const servicios = res.data.servicios;
if (servicios.length !== 0) {
for (let i = 0; i < servicios.length; i++) {
this.data.push({
nombre: servicios[i].nombre,
usuario: servicios[i].usuario,
idUsuario: servicios[i].idUsuario,
});
}
}
let currentTotal = servicios.length;
let contador;
for (let i = 0; i < res.data.registros / this.perPage + 1; i++) {
contador = i;
}
currentTotal = this.perPage * contador;
this.total = currentTotal;
this.loading = false;
})
.catch((err) => {
console.log(err.response.data.message);
this.loading = false;
});
},
insertIdLocal() {
this.idUsuario = localStorage.getItem("idUsuario");
},
verRegistro(correoResponsable) {
localStorage.setItem("correo", correoResponsable);
this.$router.push("./infoResponsable");
},
},
computed: {
@@ -229,30 +133,30 @@ export default {
);
},
},
watch: {
busquedaCorreoResponsable() {
this.obtenerResponsables();
},
} /* ,
async created () {
await this.obtenerResponsables()
} */,
async created() {
await this.obtenerDatos();
this.insertIdLocal();
},
};
</script>
<style scoped>
.renglon:hover {
cursor: pointer !important;
.b-table {
cursor: pointer;
}
.busqueda {
width: 200%;
margin-left: 50%;
.input:focus {
border: #1b3d70;
box-shadow: 0 0 8px 0 #1b3d70;
}
.tabla {
margin-top: 50px;
margin-bottom: 100px;
border: 3px solid #1b3d70;
border-radius: 10px;
padding: 20px;
.select select:focus {
border-color: #1b3d70;
box-shadow: 0 0 8px 0 #1b3d70;
}
.select:not(.is-multiple):not(.is-loading)::after {
border-color: #1b3d70;
}
.pagination-link.is-current {
background-color: #1b3d70;
border-color: #1b3d70;
}
</style>
+158 -158
View File
@@ -258,276 +258,276 @@
</template>
<script>
import axios from "axios";
import moment from "moment";
import axios from 'axios'
import moment from 'moment'
export default {
data() {
data () {
return {
alumno: {
Programa: {},
Usuario: {},
Carrera: {},
Status: {},
Status: {}
},
idServicio: localStorage.getItem("idServicio"),
idServicio: localStorage.getItem('idServicio'),
token: {
headers: {
token: localStorage.getItem("token"),
},
token: localStorage.getItem('token')
}
},
linkCartaAceptacion: "",
linkCartaTermino: "",
linkInformeGlobal: "",
linkCartaAceptacion: '',
linkCartaTermino: '',
linkInformeGlobal: '',
enviarMensaje: false,
enviarCancel: false,
mensaje: "",
mensajeCancel: "",
mensaje: '',
mensajeCancel: '',
isLoading: false,
mensajeRech1: "",
mensajeRech2: "",
mensajeRech3: "",
mensajeRech1: '',
mensajeRech2: '',
mensajeRech3: '',
mensajeRechBoolean1: false,
mensajeRechBoolean2: false,
mensajeRechBoolean3: false,
};
mensajeRechBoolean3: false
}
},
methods: {
mostrarConfirmar1() {
if (this.alumno.Status.idStatus === 1) return true;
return false;
mostrarConfirmar1 () {
if (this.alumno.Status.idStatus === 1) return true
return false
},
mostrarConfirmar2() {
mostrarConfirmar2 () {
if (this.alumno.Status.idStatus === 5) {
if (!this.alumno.acatlanContigo) return true;
else if (this.alumno.vistoBueno) return true;
if (!this.alumno.acatlanContigo) return true
else if (this.alumno.vistoBueno) return true
}
return false;
return false
},
obtenerRegistro() {
this.isLoading = true;
obtenerRegistro () {
this.isLoading = true
return axios
.get(
`${process.env.api}/servicio/admin?idServicio=${this.idServicio}` //,
// this.token
)
.then((res) => {
this.isLoading = false;
this.alumno = res.data;
this.isLoading = false
this.alumno = res.data
if (this.alumno.cartaAceptacion) {
this.linkCartaAceptacion = `https://drive.google.com/file/d/${this.alumno.cartaAceptacion}/view?usp=sharing`;
this.linkCartaAceptacion = `https://drive.google.com/file/d/${this.alumno.cartaAceptacion}/view?usp=sharing`
}
if (this.alumno.cartaTermino) {
this.linkCartaTermino = `https://drive.google.com/file/d/${this.alumno.cartaTermino}/view?usp=sharing`;
this.linkCartaTermino = `https://drive.google.com/file/d/${this.alumno.cartaTermino}/view?usp=sharing`
}
if (this.alumno.informeGlobal) {
this.linkInformeGlobal = `https://drive.google.com/file/d/${this.alumno.informeGlobal}/view?usp=sharing`;
this.linkInformeGlobal = `https://drive.google.com/file/d/${this.alumno.informeGlobal}/view?usp=sharing`
}
})
.catch((err) => {
this.isLoading = false;
console.log(err.response);
});
this.isLoading = false
console.log(err.response)
})
},
cancelarDialog() {
cancelarDialog () {
this.$buefy.dialog.confirm({
title: "Cancelar sevicio",
message: "¿Seguro(a) que quiere cancelar este servicio?",
confirmText: "Cancelar servicio",
cancelText: "No",
type: "is-danger",
title: 'Cancelar sevicio',
message: '¿Seguro(a) que quiere cancelar este servicio?',
confirmText: 'Cancelar servicio',
cancelText: 'No',
type: 'is-danger',
hasIcon: true,
onConfirm: () => this.cancelar(),
});
onConfirm: () => this.cancelar()
})
},
confirmarDialog(a) {
confirmarDialog (a) {
this.$buefy.dialog.confirm({
title: "Confimar servicio",
message: "¿Seguro(a) que quiere confirmar este servicio?",
confirmText: "Confirmar",
cancelText: "Cancelar",
type: "is-success",
title: 'Confimar servicio',
message: '¿Seguro(a) que quiere confirmar este servicio?',
confirmText: 'Confirmar',
cancelText: 'Cancelar',
type: 'is-success',
hasIcon: true,
onConfirm: () => {
switch (a) {
case 1:
this.confirmarRegistro();
break;
this.confirmarRegistro()
break
case 2:
this.confirmarTermino();
break;
this.confirmarTermino()
break
}
},
});
}
})
},
rechazarDialog(num) {
const doc = num;
rechazarDialog (num) {
const doc = num
this.$buefy.dialog.confirm({
title: "Confimar servicio",
message: "¿Seguro(a) que quiere rechazar este documento?",
confirmText: "Confirmar",
cancelText: "Cancelar",
type: "is-dnager",
title: 'Confimar servicio',
message: '¿Seguro(a) que quiere rechazar este documento?',
confirmText: 'Confirmar',
cancelText: 'Cancelar',
type: 'is-dnager',
hasIcon: true,
onConfirm: () => {
switch (doc) {
case 1:
this.rechazarCartaAceptacion();
break;
this.rechazarCartaAceptacion()
break
case 2:
this.rechazarCartaTermino();
break;
this.rechazarCartaTermino()
break
case 3:
this.rechazarInformeGlobal();
this.rechazarInformeGlobal()
}
},
});
}
})
},
rechazarCartaAceptacion() {
this.isLoading = true;
rechazarCartaAceptacion () {
this.isLoading = true
const data = {
mensaje: this.mensajeRech1,
idServicio: this.idServicio,
};
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("./");
this.isLoading = false
this.$buefy.dialog.alert('Se ha rechazado el documento')
this.$router.push('./')
})
.catch((err) => {
this.isLoading = false;
this.error();
console.log(err);
});
this.isLoading = false
this.error()
console.log(err)
})
},
rechazarCartaTermino() {
this.isLoading = true;
rechazarCartaTermino () {
this.isLoading = true
const data = {
mensaje: this.mensajeRech2,
idServicio: this.idServicio,
};
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("./");
this.isLoading = false
this.$buefy.dialog.alert('Se ha rechazado el documento')
this.$router.push('./')
})
.catch((err) => {
this.isLoading = false;
this.error();
console.log(err);
});
this.isLoading = false
this.error()
console.log(err)
})
},
rechazarInformeGlobal() {
this.isLoading = true;
rechazarInformeGlobal () {
this.isLoading = true
const data = {
mensaje: this.mensajeRech3,
idServicio: this.idServicio,
};
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("./");
this.isLoading = false
this.$buefy.dialog.alert('Se ha rechazado el documento')
this.$router.push('./')
})
.catch((err) => {
this.isLoading = false;
this.error();
console.log(err);
});
this.isLoading = false
this.error()
console.log(err)
})
},
cancelar() {
this.isLoading = true;
cancelar () {
this.isLoading = true
const data = {
idServicio: this.idServicio,
mensaje: this.mensajeCancel,
};
mensaje: this.mensajeCancel
}
axios
.put(`${process.env.api}/servicio/cancelar`, data)
.then((res) => {
this.isLoading = false;
this.$buefy.dialog.alert("El servicio ha sido cancelado con éxito");
localStorage.removeItem("idServicio");
this.$router.push("./");
this.isLoading = false
this.$buefy.dialog.alert('El servicio ha sido cancelado con éxito')
localStorage.removeItem('idServicio')
this.$router.push('./')
})
.catch((err) => {
this.isLoading = false;
this.error();
console.log(err);
});
this.isLoading = false
this.error()
console.log(err)
})
},
fecha(date) {
const fecha = moment(date.substr(0, 10));
return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}`;
fecha (date) {
const fecha = moment(date.substr(0, 10))
return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}`
},
confirmarRegistro() {
this.isLoading = true;
confirmarRegistro () {
this.isLoading = true
const data = {
idServicio: this.idServicio,
};
idServicio: this.idServicio
}
axios
.put(`${process.env.api}/servicio/registro`, data)
.then((res) => {
this.isLoading = false;
this.$buefy.dialog.alert("El servicio ha sido aprovado");
localStorage.removeItem("idServicio");
this.$router.push("/admin");
this.isLoading = false
this.$buefy.dialog.alert('El servicio ha sido aprovado')
localStorage.removeItem('idServicio')
this.$router.push('/admin')
})
.catch((e) => {
this.isLoading = false;
console.log(e);
this.error();
});
this.isLoading = false
console.log(e)
this.error()
})
},
confirmarLiberacion() {
this.isLoading = true;
confirmarLiberacion () {
this.isLoading = true
const data = {
idServicio: this.idServicio,
};
idServicio: this.idServicio
}
if (this.alumno.vistoBueno) {
data.vistoBueno = this.alumno.vistoBueno;
data.vistoBueno = this.alumno.vistoBueno
}
axios
.put(`${process.env.api}/servicio/liberacion`, data)
.then((res) => {
this.isLoading = false;
this.$buefy.dialog.alert("El servicio ha sido liberado");
localStorage.removeItem("idServicio");
this.$router.push("/admin");
this.isLoading = false
this.$buefy.dialog.alert('El servicio ha sido liberado')
localStorage.removeItem('idServicio')
this.$router.push('/admin')
})
.catch((e) => {
this.isLoading = false;
console.log(e);
this.error();
});
this.isLoading = false
console.log(e)
this.error()
})
},
error() {
error () {
this.$buefy.dialog.alert({
title: "Error",
message: "Ha ocurrido un <b>error</b>, inténtalo de nuevo más tarde",
type: "is-danger",
title: 'Error',
message: 'Ha ocurrido un <b>error</b>, inténtalo de nuevo más tarde',
type: 'is-danger',
hasIcon: true,
icon: "times-circle",
iconPack: "fa",
ariaRole: "alertdialog",
ariaModal: true,
});
},
regresar() {
this.$router.push("./");
localStorage.removeItem("idServicio");
icon: 'times-circle',
iconPack: 'fa',
ariaRole: 'alertdialog',
ariaModal: true
})
},
regresar () {
this.$router.push('./')
localStorage.removeItem('idServicio')
}
},
async created() {
await this.obtenerRegistro();
async created () {
await this.obtenerRegistro()
} /* ,
beforeCreate () {
if (!localStorage.getItem('idServicio')) { this.$router.push('./admin') }
} */,
};
} */
}
</script>
<style scoped>
+4 -4
View File
@@ -47,8 +47,8 @@ export default {
build: {},
env: {
// api: 'http://localhost:3000'
api: "https://venus.acatlan.unam.mx/ss-pruebas",
// api: "https://03a9bde77357.ngrok.io",
// api: "https://venus.acatlan.unam.mx/ss-pruebas",
api: "https://03a9bde77357.ngrok.io",
// api: 'https//venus.acatlan.unam.mx/pruebas_pcpuma'
},
};
}
}
@@ -19,16 +19,16 @@
<script>
export default {
data() {
data () {
return {
viejo: {
nombre: "Marco",
correo: "correo1@gmail.com",
nombre: 'Marco',
correo: 'correo1@gmail.com'
},
nuevo: {},
idServicio: localStorage.getItem("idServicio"),
isLoading: false,
};
},
};
idServicio: localStorage.getItem('idServicio'),
isLoading: false
}
}
}
</script>
@@ -1,6 +1,6 @@
<template>
<div class="container">
<b-button class="boton is-info my-5" @click="$router.push('./')">
<b-button class="boton is-info my-5" @click="regresar()">
Regresar
</b-button>
<p class="is-size-2 mb-4">Información del responsable</p>
@@ -84,7 +84,7 @@ export default {
console.log(err.response);
});
},
error() {
error () {
this.$buefy.dialog.alert({
title: "Error",
message: "Ha ocurrido un <b>error</b>, inténtalo de nuevo más tarde",