Files
servicio_social_front/components/responsable/inputTable.vue
T

257 lines
7.7 KiB
Vue
Raw Normal View History

2020-11-10 22:38:34 -06:00
<template>
<div class="container">
<div class="columns">
2020-11-16 13:48:12 -06:00
2020-11-25 15:16:10 -06:00
<div class="column is-3 mb-0 ">
2020-11-16 13:48:12 -06:00
<b-field >
<b-input
placeholder="No.Cuenta"
icon="school"
rounded
v-model="numeroCuenta"
maxlength="9"
></b-input>
</b-field>
</div>
2020-11-18 19:02:13 -06:00
<div class="column is-3 mb-4 pb-4">
2020-11-16 13:48:12 -06:00
<b-field>
<b-input
type="name"
placeholder="Nombre"
icon="account"
rounded
v-model="nombre"
></b-input>
</b-field>
</div>
2020-11-18 19:02:13 -06:00
<div class="column is-3" >
2020-11-16 13:48:12 -06:00
<b-field>
2020-11-25 15:16:10 -06:00
<b-select placeholder="Status" icon="information" value="1" expanded rounded v-model="idStatus">
2020-11-16 13:48:12 -06:00
<optgroup label="Status">
<option value="1">Pre-registro</option>
<option value="2">Pre-validado</option>
<option value="3">Registro</option>
<option value="4">Pre-término</option>
<option value="5">Término</option>
<option value="6">Liberado</option>
<option value="7">Rechazado</option>
</optgroup>
</b-select>
</b-field>
</div>
2020-11-26 16:19:34 -06:00
<div class="buttons section pt-3 pl-5">
<b-button type="is-info" @click="obtenerDatos()">
2020-11-25 15:16:10 -06:00
Buscar
</b-button>
</div>
2020-11-18 19:02:13 -06:00
</div>
2020-11-16 13:48:12 -06:00
2020-11-18 19:02:13 -06:00
<div>
<BotonesCarga v-if="id == 1"/>
2020-11-10 22:38:34 -06:00
</div>
<div class="columns">
2020-11-12 22:40:56 -06:00
<section class="column is-12">
<b-table
2020-11-26 16:19:34 -06:00
:data="data"
2020-11-27 19:49:26 -06:00
:loading="loading"
2020-11-26 16:19:34 -06:00
paginated
backend-pagination
2020-11-27 19:49:26 -06:00
:total="total"
2020-11-26 16:19:34 -06:00
:per-page="perPage"
2020-11-27 19:49:26 -06:00
@page-change="onPageChange"
2020-11-26 16:19:34 -06:00
>
<b-table-column field="nombre" label="Nombre" v-slot="props" centered>
{{ props.row.nombre}}
2020-11-12 22:40:56 -06:00
</b-table-column>
2020-11-26 16:19:34 -06:00
<b-table-column field="numeroCuenta" label="Numero de Cuenta" v-slot="props" centered>
{{ props.row.numeroCuenta}}
2020-11-12 22:40:56 -06:00
</b-table-column>
2020-11-26 16:19:34 -06:00
<b-table-column field="carrera" label="Carrera" v-slot="props" centered>
{{ props.row.carrera}}
2020-11-12 22:40:56 -06:00
</b-table-column>
2020-11-26 16:19:34 -06:00
<b-table-column field="fechaInicio" label="fecha Inicio" v-slot="props" centered>
{{ props.row.fechaInicio}}
2020-11-12 22:40:56 -06:00
</b-table-column>
2020-11-26 16:19:34 -06:00
<b-table-column field="fechaFin" label="Fecha fin" v-slot="props" centered>
{{ props.row.fechaFin}}
</b-table-column>
<b-table-column field="status" label="Status" v-slot="props" centered>
<span class="tag" :class="types(props.row.status)">{{ props.row.status}}</span>
2020-11-18 19:02:13 -06:00
</b-table-column>
2020-11-25 15:16:10 -06:00
<!--
2020-11-18 19:02:13 -06:00
<b-table-column field="cartaTermino" label="Carta Término" v-slot="props" centered v-if="id == 2">
2020-11-25 15:16:10 -06:00
<div v-if="props.row.idStatus === 'Pre-Termino'">
2020-11-18 19:02:13 -06:00
<span
v-if="props.row.cartaTermino === true"
>
<b-icon :icon="iconoCarta(props.row.cartaTermino)"
class="tag is-success"></b-icon>
</span>
<b-button
v-if="props.row.cartaTermino === false"
size="is-small"
:class="botonCarta(props.row.cartaTermino)"
:icon="iconoCarta(props.row.cartaTermino)">
Carta Término
</b-button>
</div>
</b-table-column>
2020-11-26 16:19:34 -06:00
-->
2020-11-18 19:02:13 -06:00
<b-table-column field="cuestionario" label="Cuestionario" v-slot="props" centered v-if="id == 2">
<div
2020-11-26 16:19:34 -06:00
v-if="props.row.status === 'Pre-Termino'">
2020-11-18 19:02:13 -06:00
<span
2020-11-26 16:19:34 -06:00
v-if="props.row.cuestionario === 1"
2020-11-18 19:02:13 -06:00
>
<b-icon :icon="iconoCuestionario(props.row.cuestionario)"
class="tag is-success"></b-icon>
</span>
<b-button
2020-11-26 16:19:34 -06:00
v-if="props.row.cuestionario === 2"
2020-11-18 19:02:13 -06:00
size="is-small"
:class="botonCuestionario(props.row.cuestionario)"
:icon="iconoCuestionario(props.row.cuestionario)">
Cuestionario
</b-button>
</div>
2020-11-12 22:40:56 -06:00
</b-table-column>
2020-11-26 16:19:34 -06:00
2020-11-12 22:40:56 -06:00
</b-table>
2020-11-10 22:38:34 -06:00
</section>
</div>
</div>
</template>
<script>
2020-11-16 13:48:12 -06:00
// import validator from 'validator'
2020-11-18 19:02:13 -06:00
import BotonesCarga from './botonesCarga.vue'
2020-11-23 15:35:03 -06:00
import axios from 'axios'
2020-11-18 19:02:13 -06:00
2020-11-10 22:38:34 -06:00
export default {
2020-11-18 19:02:13 -06:00
components: {
BotonesCarga
},
2020-11-10 22:38:34 -06:00
data () {
return {
2020-11-27 19:49:26 -06:00
data: [],
total: '',
loading: true,
2020-11-23 18:48:37 -06:00
page: 1,
2020-11-27 19:49:26 -06:00
perPage: 25,
2020-11-16 13:48:12 -06:00
numeroCuenta: '',
nombre: '',
2020-11-25 15:16:10 -06:00
idStatus: '',
tipoUsuario: 1
2020-11-10 22:38:34 -06:00
}
2020-11-12 22:40:56 -06:00
},
2020-11-18 19:02:13 -06:00
props: {
id: {
type: Number,
required: false
}
},
2020-11-12 22:40:56 -06:00
methods: {
2020-11-27 19:49:26 -06:00
onPageChange (page) {
this.page = page
this.obtenerDatos()
console.log(this.page)
},
2020-11-18 19:02:13 -06:00
types (status) {
2020-11-12 22:40:56 -06:00
/* const Status = parseFloat(status) Investigar para que sirve :) */
2020-11-23 18:48:37 -06:00
if (status === 'Pre-Registro') {
2020-11-12 22:40:56 -06:00
return 'is-dark'
2020-11-23 18:48:37 -06:00
} else if (status === 'Pre-Validado') {
2020-11-12 22:40:56 -06:00
return 'is-warning'
2020-11-23 18:48:37 -06:00
} else if (status === 'Registro') {
2020-11-12 22:40:56 -06:00
return 'is-info'
2020-11-23 18:48:37 -06:00
} else if (status === 'Pre-Termino') {
2020-11-12 22:40:56 -06:00
return 'is-link'
2020-11-23 18:48:37 -06:00
} else if (status === 'Termino') {
2020-11-12 22:40:56 -06:00
return 'is-success'
2020-11-23 18:48:37 -06:00
} else if (status === 'Liberado') {
2020-11-12 22:40:56 -06:00
return 'is-success'
2020-11-23 18:48:37 -06:00
} else if (status === 'Rechazado') {
2020-11-12 22:40:56 -06:00
return 'is-danger'
}
},
2020-11-18 19:02:13 -06:00
botonCarta (cartaTermino) {
if (cartaTermino === true) {
2020-11-16 13:48:12 -06:00
return 'is-success'
} else {
return 'is-danger'
}
},
2020-11-18 19:02:13 -06:00
botonCuestionario (cuestionario) {
if (cuestionario === true) {
2020-11-16 13:48:12 -06:00
return 'is-success'
} else {
return 'is-danger'
}
},
2020-11-18 19:02:13 -06:00
iconoCarta (cartaTermino) {
if (cartaTermino === true) {
2020-11-16 13:48:12 -06:00
return 'check'
} else {
return 'close'
}
},
2020-11-18 19:02:13 -06:00
iconoCuestionario (cuestionario) {
2020-11-26 16:19:34 -06:00
if (cuestionario === 1) {
2020-11-16 13:48:12 -06:00
return 'check'
} else {
return 'close'
}
},
2020-11-23 15:35:03 -06:00
obtenerDatos () {
2020-11-27 19:49:26 -06:00
// this.loading = true
this.data = []
if (this.idStatus || this.nombre || this.numeroCuenta) {
this.page = 1
}
axios.get(`${process.env.api}/servicio/servicios_responsable?idUsuario=2&pagina=${this.page}&idStatus&nombre=${this.nombre}&numeroCuenta=${this.numeroCuenta}`)
2020-11-23 15:35:03 -06:00
.then(res => {
2020-11-26 16:19:34 -06:00
const servicios = res.data.servicios
2020-11-27 19:49:26 -06:00
// this.page = 1
2020-11-26 16:19:34 -06:00
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,
cuestionario: servicios[i].idCuestionarioAlumno
})
}
}
2020-11-27 19:49:26 -06:00
let currentTotal = servicios.length
let contador
2020-11-26 16:19:34 -06:00
2020-11-27 19:49:26 -06:00
for (let i = 0; i < ((res.data.faltantes + res.data.registros) / 25) + 1; i++) {
contador = i
2020-11-26 16:19:34 -06:00
}
2020-11-27 19:49:26 -06:00
currentTotal = this.perPage * contador
this.total = currentTotal
this.loading = false
2020-11-23 15:35:03 -06:00
})
}
2020-11-25 15:16:10 -06:00
},
created () {
this.obtenerDatos()
2020-11-10 22:38:34 -06:00
}
}
</script>
2020-11-16 13:48:12 -06:00
<style>
</style>