diff --git a/components/admin/especial/tablaCasosEspeciales.vue b/components/admin/especial/tablaCasosEspeciales.vue index cf3a051..bb2d9b4 100644 --- a/components/admin/especial/tablaCasosEspeciales.vue +++ b/components/admin/especial/tablaCasosEspeciales.vue @@ -49,6 +49,10 @@ + + + + @@ -75,7 +79,7 @@ striped > - {{ + {{ props.row.nombre }} @@ -87,7 +91,7 @@ centered width="100" > - {{ + {{ props.row.numeroCuenta }} @@ -98,13 +102,13 @@ v-slot="props" centered > - {{ + {{ props.row.carrera }} {{ props.row.status }} - {{ + {{ fecha(props.row.diaCreado) }} @@ -137,18 +141,7 @@ export default { idUsuario: "", idTipoUsuario: "", tipoUsuario: "", - data: [ - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:1 , diaCreado: "01/01/2021" }, - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:2 , diaCreado: "01/01/2021" }, - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:3 , diaCreado: "01/01/2021" }, - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:4 , diaCreado: "01/01/2021" }, - { nombre: "Tomy", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:5 , diaCreado: "01/01/2021"}, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:6, diaCreado: "01/01/2021" }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:7, diaCreado: "01/01/2021" }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:8, diaCreado: "01/01/2021" }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:9, diaCreado: "01/01/2021" }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:10, diaCreado: "01/01/2021" }, - ], + data: [], total: "", isLoading: false, page: 1, @@ -184,59 +177,63 @@ export default { return "is-link"; } else if (idStatus === 7 || idStatus === 8 || idStatus === 9 || idStatus === 10) { return "is-danger"; + } else if (idStatus === 11) { + return "is-link is-light"; + } else if (idStatus === 12) { + return "is-danger is-light"; + } else if (idStatus === 13 || idStatus === 14) { + return "is-success is-light"; } }, fecha(date) { const fecha = moment(date.substr(0, 10)); return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}`; }, - // obtenerDatos(idStatus) { - // this.isLoading = true; - // this.data = []; + obtenerDatos(idStatus) { + this.isLoading = true; + this.data = []; - // axios - // .get( - // `${process.env.api}/servicio/servicios_admin?pagina=${this.page}&idStatus=${this.idStatus}&nombre=${this.nombre}&numeroCuenta=${this.numeroCuenta}`, - // this.token - // ) - // .then((res) => { - // const servicios = res.data.servicios; + axios + .get( + `${process.env.api}/caso_especial/servicios_especiales?pagina=${this.page}&idStatus=${this.idStatus}&nombre=${this.nombre}&numeroCuenta=${this.numeroCuenta}`, + this.token + ) + .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].Usuario.nombre, - // numeroCuenta: servicios[i].Usuario.usuario, - // carrera: servicios[i].Carrera.carrera, - // fechaInicio: servicios[i].fechaInicio, - // fechaFin: servicios[i].fechaFin, - // status: servicios[i].Status.status, - // diaCreado: servicios[i].createdAt, - // idStatus: servicios[i].Status.idStatus, - // idServicio: servicios[i].idServicio, - // }); - // } - // } - // let currentTotal = servicios.length; - // let contador; + if (servicios.length !== 0) { + for (let i = 0; i < servicios.length; i++) { + this.data.push({ + nombre: servicios[i].Usuario.nombre, + numeroCuenta: servicios[i].Usuario.usuario, + carrera: servicios[i].Carrera.carrera, + status: servicios[i].Status.status, + diaCreado: servicios[i].createdAt, + idStatus: servicios[i].Status.idStatus, + idCasoEspecial: servicios[i].idCasoEspecial, + }); + } + } + let currentTotal = servicios.length; + let contador; - // for (let i = 0; i < res.data.registros / 25 + 1; i++) { - // contador = i; - // } - // currentTotal = this.perPage * contador; - // this.total = currentTotal; - // }) + for (let i = 0; i < res.data.registros / 25 + 1; i++) { + contador = i; + } + currentTotal = this.perPage * contador; + this.total = currentTotal; + }) - // .catch((error) => { - // this.error(error.response.data.message); - // }) + .catch((error) => { + this.error(error.response.data.message); + }) - // .finally(() => { - // this.isLoading = false; - // }); - // }, - servicios(idServicio) { - // window.localStorage.setItem("idServicio", idServicio); + .finally(() => { + this.isLoading = false; + }); + }, + servicios(idCasoEspecial) { + window.localStorage.setItem("idCasoEspecial", idCasoEspecial); this.$router.push("/admin/especial/casoEspecial"); }, getIdLocal() { @@ -288,7 +285,7 @@ export default { }, created() { this.getIdLocal(); - //this.obtenerDatos(0); + this.obtenerDatos(0); }, }; diff --git a/components/casoEspecial/tablaServicios.vue b/components/casoEspecial/tablaServicios.vue index a084698..b40ae57 100644 --- a/components/casoEspecial/tablaServicios.vue +++ b/components/casoEspecial/tablaServicios.vue @@ -42,6 +42,10 @@ + + + + @@ -133,18 +137,7 @@ export default { idTipoUsuario: "", idUsuario: "", tipoUsuario: "", - data: [ - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:1 }, - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:2 }, - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:3 }, - { nombre: "Marco", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:4 }, - { nombre: "Tomy", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:5 }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:6 }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:7 }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:8 }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:9 }, - { nombre: "Lemuel", numeroCuenta: "316019251", carrera: "Matemáticas Aplicadas y Computación", status: "status", idStatus:1 }, - ], + data: [], total: "", isLoading: false, page: 1, @@ -180,55 +173,55 @@ export default { return "is-link"; } else if (idStatus === 7 || idStatus === 8 || idStatus === 9) { return "is-danger"; + } else if (idStatus === 11) { + return "is-link is-light"; + } else if (idStatus === 12) { + return "is-danger is-light"; + } else if (idStatus === 13 || idStatus === 14) { + return "is-success is-light"; } }, fecha(date) { const fecha = moment(date.substr(0, 10)); return `${fecha.date()}/${fecha.month() + 1}/${fecha.year()}`; }, - // obtenerDatos(idStatus) { - // this.isLoading = true; - // this.data = []; - // axios - // .get( - // `${process.env.api}/servicio/servicios_responsable?idUsuario=${this.idUsuario}&pagina=${this.page}&idStatus=${this.idStatus}&nombre=${this.nombre}&numeroCuenta=${this.numeroCuenta}`, - // this.token - // ) - // .then((res) => { - // const servicios = res.data.servicios; + obtenerDatos(idStatus) { + this.isLoading = true; + this.data = []; + axios + .get( + `${process.env.api}/caso_especial/servicios_especiales?pagina=${this.page}&idStatus=${this.idStatus}&nombre=${this.nombre}&numeroCuenta=${this.numeroCuenta}`, + this.token + ) + .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].Usuario.nombre, + numeroCuenta: servicios[i].Usuario.usuario, + carrera: servicios[i].Carrera.carrera, + status: servicios[i].Status.status, + idStatus: servicios[i].Status.idStatus, + }); + } + } + let currentTotal = servicios.length; + let contador; - // if (servicios.length !== 0) { - // for (let i = 0; i < servicios.length; i++) { - // this.data.push({ - // nombre: servicios[i].Usuario.nombre, - // numeroCuenta: servicios[i].Usuario.usuario, - // carrera: servicios[i].Carrera.carrera, - // fechaInicio: servicios[i].fechaInicio, - // fechaFin: servicios[i].fechaFin, - // status: servicios[i].Status.status, - // idStatus: servicios[i].Status.idStatus, - // cuestionario: servicios[i].idCuestionarioPrograma, - // cartaTermino: servicios[i].cartaTermino, - // idServicio: servicios[i].idServicio, - // }); - // } - // } - // let currentTotal = servicios.length; - // let contador; - - // for (let i = 0; i < res.data.registros / 25 + 1; i++) { - // contador = i; - // } - // currentTotal = this.perPage * contador; - // this.total = currentTotal; - // }) - // .catch((error) => { - // this.error(error.response.data.message); - // }) - // .finally(() => { - // this.isLoading = false; - // }); - // }, + for (let i = 0; i < res.data.registros / 25 + 1; i++) { + contador = i; + } + currentTotal = this.perPage * contador; + this.total = currentTotal; + }) + .catch((error) => { + this.error(error.response.data.message); + }) + .finally(() => { + this.isLoading = false; + }); + }, getIdLocal() { this.idUsuario = 1//localStorage.getItem("idUsuario"); this.idTipoUsuario = 2//localStorage.getItem("idTipoUsuario"); @@ -277,7 +270,7 @@ export default { }, created() { this.getIdLocal(); - // this.obtenerDatos(0); + this.obtenerDatos(0); }, };