tabla de multas en el usuario

This commit is contained in:
Andres2908 2022-07-13 23:55:49 -05:00
parent 561bb12bed
commit 0eef64e321
3 changed files with 60 additions and 31 deletions

View File

@ -48,6 +48,7 @@
:page="page"
:total="total"
:onPageChange="onPageChange"
:columnaUsuario="true"
/>
</div>
</template>

View File

@ -14,6 +14,7 @@
field="usuario"
label="Número de cuenta/trabajador"
v-slot="props"
v-if="columnaUsuario"
centered
>
<span>{{ props.row.prestamo.usuario.usuario }}</span>
@ -86,20 +87,12 @@ export default {
components: { TablaEquiCarritos },
props: {
operador: { type: Object, required: true },
multas: { type: Array, require: true },
isLoadingTable: { type: Boolean, require: true },
page: {
type: Number,
required: true,
},
onPageChange: {
type: Function,
require: true,
},
total: {
type: Number,
required: true,
},
multas: { type: Array, required: true },
page: { type: Number, required: true },
total: { type: Number, required: true },
onPageChange: { type: Function, required: true },
isLoadingTable: { type: Boolean, required: true },
columnaUsuario: { type: Boolean, required: true },
},
data() {
return {

View File

@ -6,21 +6,36 @@
:updateUsuario="updateUsuario"
:usuario="usuario"
/>
<b-tabs>
<b-tab-item label="Prestamos">
<TablaPrestamo
:isLoadingTable="isLoading"
:data="data"
:page="page"
:total="totalP"
:onPageChange="onPageChange"
:columnaNumeroInventario="true"
:columnaTipo="true"
:columnaEquipo="true"
:columnaCarrito="true"
:columnaModulo="true"
:columnaHoraRegreso="true"
:columnaIdPrestamo="true"
/>
</b-tab-item>
<TablaPrestamo
:isLoadingTable="isLoading"
:data="data"
:page="page"
:onPageChange="onPageChange"
:total="total"
:columnaNumeroInventario="true"
:columnaTipo="true"
:columnaEquipo="true"
:columnaCarrito="true"
:columnaModulo="true"
:columnaHoraRegreso="true"
:columnaIdPrestamo="true"
/>
<b-tab-item label="Multas">
<TablaMultas
:operador="operador"
:multas="multas"
:page="page"
:total="totalM"
:onPageChange="onPageChange"
:isLoadingTable="isLoading"
:columnaUsuario="false"
/>
</b-tab-item>
</b-tabs>
</section>
</template>
@ -28,9 +43,10 @@
import axios from 'axios'
import BuscarUsuario from '@/components/operador/usuarios/BuscarUsuario'
import TablaPrestamo from '@/components/operador/TablaPrestamo'
import TablaMultas from '@/components/operador/usuarios/TablaMultas'
export default {
components: { BuscarUsuario, TablaPrestamo },
components: { BuscarUsuario, TablaPrestamo, TablaMultas },
props: {
operador: { type: Object, required: true },
updateIsLoading: { type: Function, required: true },
@ -38,8 +54,10 @@ export default {
data() {
return {
data: [],
multas: [],
page: 1,
total: 0,
totalP: 0,
totalM: 0,
isLoading: false,
usuario: { instituciones: [], tipoUsuario: {} },
}
@ -62,7 +80,7 @@ export default {
)
.then((res) => {
this.data = res.data[0]
this.total = res.data[1]
this.totalP = res.data[1]
this.isLoading = false
})
.catch((err) => {
@ -70,10 +88,27 @@ export default {
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
obtenerMultas() {
this.isLoadingTable = true
axios
.get(
`${process.env.api}/multa/multas-usuario?pagina=${this.page}&id_usuario=${this.usuario.id_usuario}`
)
.then(async (res) => {
this.multas = res.data[0]
this.totalM = res.data[1]
this.isLoadingTable = false
})
.catch((err) => {
this.isLoadingTable = false
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
})
},
},
watch: {
usuario() {
this.obtenerPrestamos()
this.obtenerMultas()
},
},
}