69 lines
1.6 KiB
Vue
69 lines
1.6 KiB
Vue
<template>
|
|
<b-tab-item label="Historial">
|
|
<TablaPrestamo
|
|
:prestamos="prestamos"
|
|
:isLoadingTable="isLoadingTable"
|
|
:page="page"
|
|
:total="total"
|
|
:onPageChange="onPageChange"
|
|
:operador="operador"
|
|
columnaNumeroInventario
|
|
columnaTipo
|
|
columnaEquipo
|
|
columnaCarrito
|
|
columnaModulo
|
|
columnaHoraRegreso
|
|
columnaIdPrestamo
|
|
columnaOperadores
|
|
columnaCanceladoUsuario
|
|
columnaCanceladoOperador
|
|
filaActivo
|
|
/>
|
|
</b-tab-item>
|
|
</template>
|
|
|
|
<script>
|
|
import axios from 'axios'
|
|
import TablaPrestamo from '@/components/tablas/TablaPrestamos'
|
|
|
|
export default {
|
|
components: { TablaPrestamo },
|
|
props: {
|
|
operador: { type: Object, required: true, default: () => ({}) },
|
|
usuario: { type: Object, required: true, default: () => ({}) },
|
|
},
|
|
data() {
|
|
return { prestamos: [], page: 1, total: 0, isLoadingTable: false }
|
|
},
|
|
methods: {
|
|
onPageChange(page) {
|
|
this.page = page
|
|
this.obtenerPrestamos()
|
|
},
|
|
obtenerPrestamos() {
|
|
this.isLoadingTable = true
|
|
return axios
|
|
.get(
|
|
`${process.env.api}/prestamo/historial-usuario?pagina=${this.page}&id_usuario=${this.usuario.id_usuario}`,
|
|
this.$getToken.token()
|
|
)
|
|
.then((res) => {
|
|
this.prestamos = res.data[0]
|
|
this.total = res.data[1]
|
|
this.isLoadingTable = false
|
|
})
|
|
.catch((err) => {
|
|
this.isLoadingTable = false
|
|
})
|
|
},
|
|
},
|
|
watch: {
|
|
usuario() {
|
|
this.obtenerPrestamos()
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|