carritos
This commit is contained in:
parent
1cd26513e5
commit
b760af97af
@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-table :data="data">
|
||||
<b-table-column field="programa" label="Programa" v-slot="props">
|
||||
<b-table-column field="programa" label="Programa" centered v-slot="props">
|
||||
{{ props.row.programa.programa }}
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="activo" label="Activo" v-slot="props">
|
||||
<b-table-column field="activo" label="Activo" centered v-slot="props">
|
||||
<BotonDesactivar
|
||||
:admin="admin"
|
||||
:data="props.row"
|
||||
|
@ -1,4 +1,41 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
<b-field class="column column mb-0 pb-0" field="carrito" label="Carrito">
|
||||
<b-input
|
||||
v-model="carrito"
|
||||
rounded
|
||||
@keyup.enter.native="obtenerCarritos"
|
||||
/>
|
||||
</b-field>
|
||||
|
||||
<b-field
|
||||
class="column column mb-0 pb-0 pl-0"
|
||||
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>
|
||||
|
||||
<b-button
|
||||
class="column column mb-0"
|
||||
type="is-info"
|
||||
@click="obtenerCarritos"
|
||||
rounded
|
||||
expanded
|
||||
>Buscar</b-button
|
||||
>
|
||||
</div>
|
||||
|
||||
<b-table
|
||||
:data="data"
|
||||
:loading="isLoadingTable"
|
||||
@ -21,29 +58,23 @@
|
||||
<span>{{ props.row.tipoCarrito.tipo_carrito }}</span>
|
||||
</b-table-column>
|
||||
|
||||
<b-table-column field="activo" label="Activo" v-slot="props" centered>
|
||||
<BotonDesactivar
|
||||
:admin="operador"
|
||||
:data="props.row"
|
||||
tipo="carrito"
|
||||
:cambiarStatus="cambiarStatus"
|
||||
:imprimirWarning="imprimirWarning"
|
||||
/>
|
||||
<b-table-column field="tipo" label="Tipo" v-slot="props" centered>
|
||||
<span>{{ props.row.activo }}</span>
|
||||
</b-table-column>
|
||||
|
||||
<template #detail="props">
|
||||
<TablaEquiCarritos :equipo="props.row" />
|
||||
</template>
|
||||
</b-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BotonDesactivar from '@/components/operador/BotonDesactivar'
|
||||
import TablaEquiCarritos from '@/components/operador/TablaEquiCarritos'
|
||||
|
||||
export default {
|
||||
components: { BotonDesactivar, TablaEquiCarritos },
|
||||
components: { TablaEquiCarritos },
|
||||
props: {
|
||||
operador: { type: Object, required: true },
|
||||
imprimirError: { type: Function, required: true },
|
||||
@ -52,32 +83,29 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
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,
|
||||
isLoadingTable: false,
|
||||
selectedCarrito: {},
|
||||
data: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cambiarStatus(dataSelect, status) {
|
||||
const data = { id_modulo: dataSelect.id_modulo, activo: status }
|
||||
this.updateIsLoading(true)
|
||||
|
||||
axios
|
||||
.put(`${process.env.api}/modulo`, data)
|
||||
.then((res) => {
|
||||
this.obtenerCatalogoModulo(this.data[0].institucion.id_institucion)
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirMensaje(res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.imprimirError(err.response.data)
|
||||
})
|
||||
},
|
||||
obtenerCarritos() {
|
||||
let id_tipo_carrito = ''
|
||||
if (this.idTipoCarrito != 0)
|
||||
id_tipo_carrito = '&id_tipo_carrito=' + this.idTipoCarrito
|
||||
|
||||
this.isLoadingTable = true
|
||||
axios
|
||||
.get(`${process.env.api}/carrito/carritos?pagina=1&id_institucion=200`)
|
||||
.get(
|
||||
`${process.env.api}/carrito/carritos?pagina=1&id_institucion=${this.operador.institucion.id_institucion}&carrito=${this.carrito}${id_tipo_carrito}`
|
||||
)
|
||||
.then(async (res) => {
|
||||
this.data = res.data[0]
|
||||
this.isLoadingTable = false
|
||||
|
Loading…
Reference in New Issue
Block a user