2022-07-04 19:45:28 +00:00
|
|
|
<template>
|
2022-07-06 22:41:38 +00:00
|
|
|
<div>
|
|
|
|
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
2022-07-07 04:17:11 +00:00
|
|
|
<b-field class="column mb-0 pb-0" field="carrito" label="Carrito">
|
2022-07-06 22:41:38 +00:00
|
|
|
<b-input
|
2022-07-07 04:17:11 +00:00
|
|
|
placeholder="Carrito"
|
2022-07-06 22:41:38 +00:00
|
|
|
v-model="carrito"
|
|
|
|
rounded
|
|
|
|
@keyup.enter.native="obtenerCarritos"
|
|
|
|
/>
|
|
|
|
</b-field>
|
2022-07-04 19:45:28 +00:00
|
|
|
|
2022-07-06 22:41:38 +00:00
|
|
|
<b-field
|
2022-07-07 04:17:11 +00:00
|
|
|
class="column mb-0 pb-0"
|
2022-07-06 22:41:38 +00:00
|
|
|
field="tipoCarrito"
|
|
|
|
label="Tipo Carrito"
|
|
|
|
>
|
|
|
|
<b-select v-model="idTipoCarrito" rounded expanded>
|
|
|
|
<option disabled>Tipo carrito</option>
|
|
|
|
<option
|
|
|
|
v-for="tipo_carrito in tipoCarrito"
|
|
|
|
:value="tipo_carrito.id_tipo_carrito"
|
|
|
|
:key="tipo_carrito.id_tipo_carrito"
|
|
|
|
>
|
|
|
|
{{ tipo_carrito.tipo_carrito }}
|
|
|
|
</option>
|
|
|
|
</b-select>
|
|
|
|
</b-field>
|
2022-07-04 19:45:28 +00:00
|
|
|
|
2022-07-06 22:41:38 +00:00
|
|
|
<b-button
|
2022-07-07 04:17:11 +00:00
|
|
|
class="column mb-0"
|
2022-07-06 22:41:38 +00:00
|
|
|
type="is-info"
|
|
|
|
@click="obtenerCarritos"
|
|
|
|
rounded
|
|
|
|
expanded
|
|
|
|
>Buscar</b-button
|
|
|
|
>
|
|
|
|
</div>
|
2022-07-04 19:45:28 +00:00
|
|
|
|
2022-07-06 22:41:38 +00:00
|
|
|
<b-table
|
|
|
|
:data="data"
|
|
|
|
:loading="isLoadingTable"
|
|
|
|
:selected.sync="selectedCarrito"
|
|
|
|
:row-class="(row, index) => 'pointer'"
|
|
|
|
class="mb-6"
|
|
|
|
show-detail-icon
|
|
|
|
paginated
|
|
|
|
detailed
|
|
|
|
>
|
|
|
|
<b-table-column field="carrito" label="Carrito" v-slot="props" centered>
|
|
|
|
<span>{{ props.row.carrito }}</span>
|
|
|
|
</b-table-column>
|
2022-07-04 19:45:28 +00:00
|
|
|
|
2022-07-06 22:41:38 +00:00
|
|
|
<b-table-column field="modulo" label="Módulo" v-slot="props" centered>
|
|
|
|
<span>{{ props.row.modulo.modulo }}</span>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column field="tipo" label="Tipo" v-slot="props" centered>
|
|
|
|
<span>{{ props.row.tipoCarrito.tipo_carrito }}</span>
|
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<b-table-column field="tipo" label="Tipo" v-slot="props" centered>
|
2022-07-06 22:55:49 +00:00
|
|
|
<span class="is-size-6 tag" :class="choooseTag(props.row.activo)">{{
|
|
|
|
props.row.activo ? 'Activo' : 'Inactivo'
|
|
|
|
}}</span>
|
2022-07-06 22:41:38 +00:00
|
|
|
</b-table-column>
|
|
|
|
|
|
|
|
<template #detail="props">
|
|
|
|
<TablaEquiCarritos :equipo="props.row" />
|
|
|
|
</template>
|
|
|
|
</b-table>
|
|
|
|
</div>
|
2022-07-04 19:45:28 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2022-07-05 01:03:26 +00:00
|
|
|
import TablaEquiCarritos from '@/components/operador/TablaEquiCarritos'
|
2022-07-04 19:45:28 +00:00
|
|
|
|
|
|
|
export default {
|
2022-07-06 22:41:38 +00:00
|
|
|
components: { TablaEquiCarritos },
|
2022-07-04 19:45:28 +00:00
|
|
|
props: {
|
|
|
|
operador: { type: Object, required: true },
|
|
|
|
imprimirError: { type: Function, required: true },
|
|
|
|
imprimirMensaje: { type: Function, required: true },
|
|
|
|
imprimirWarning: { type: Function, required: true },
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2022-07-06 22:41:38 +00:00
|
|
|
tipoCarrito: [
|
|
|
|
{ id_tipo_carrito: 1, tipo_carrito: 'Chromebook' },
|
|
|
|
{ id_tipo_carrito: 2, tipo_carrito: 'iPad' },
|
|
|
|
{ id_tipo_carrito: 3, tipo_carrito: 'Laptop' },
|
|
|
|
],
|
|
|
|
carrito: '',
|
|
|
|
idTipoCarrito: 0,
|
2022-07-04 19:45:28 +00:00
|
|
|
isLoadingTable: false,
|
2022-07-05 06:03:20 +00:00
|
|
|
selectedCarrito: {},
|
2022-07-04 19:45:28 +00:00
|
|
|
data: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2022-07-06 22:55:49 +00:00
|
|
|
choooseTag(activo) {
|
|
|
|
const style = {
|
|
|
|
false: 'is-danger',
|
|
|
|
true: 'is-success',
|
|
|
|
}
|
|
|
|
return style[activo]
|
|
|
|
},
|
2022-07-04 19:45:28 +00:00
|
|
|
obtenerCarritos() {
|
2022-07-06 22:41:38 +00:00
|
|
|
let id_tipo_carrito = ''
|
|
|
|
if (this.idTipoCarrito != 0)
|
|
|
|
id_tipo_carrito = '&id_tipo_carrito=' + this.idTipoCarrito
|
|
|
|
|
2022-07-04 19:45:28 +00:00
|
|
|
this.isLoadingTable = true
|
|
|
|
axios
|
2022-07-06 22:41:38 +00:00
|
|
|
.get(
|
|
|
|
`${process.env.api}/carrito/carritos?pagina=1&id_institucion=${this.operador.institucion.id_institucion}&carrito=${this.carrito}${id_tipo_carrito}`
|
|
|
|
)
|
2022-07-04 19:45:28 +00:00
|
|
|
.then(async (res) => {
|
|
|
|
this.data = res.data[0]
|
|
|
|
this.isLoadingTable = false
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.isLoadingTable = false
|
|
|
|
this.imprimirError(err.response.data)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
2022-07-05 06:03:20 +00:00
|
|
|
watch: {
|
|
|
|
selectedCarrito() {
|
|
|
|
localStorage.setItem('carrito', this.selectedCarrito.id_carrito)
|
|
|
|
this.$router.push('buscar_carrito')
|
|
|
|
},
|
|
|
|
},
|
2022-07-04 19:45:28 +00:00
|
|
|
created() {
|
|
|
|
this.obtenerCarritos()
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.pointer {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
</style>
|