crear carrito
This commit is contained in:
parent
eaff7068eb
commit
8631c3b1fe
@ -67,8 +67,11 @@ export default {
|
||||
localStorage.setItem('token', res.data.token)
|
||||
this.updateIsLoading(false)
|
||||
if (res.data.operador.tipoUsuario.id_tipo_usuario === 3)
|
||||
this.$router.push('/operador/prestamo_devolucion')
|
||||
else this.$router.push('/admin/configuracion/instituciones/buscar_institucion')
|
||||
this.$router.push('/prestamo_devolucion')
|
||||
else
|
||||
this.$router.push(
|
||||
'/admin/configuracion/instituciones/buscar_institucion'
|
||||
)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.error = 'is-danger'
|
||||
|
120
components/crear/CrearCarrito.vue
Normal file
120
components/crear/CrearCarrito.vue
Normal file
@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<section class="mb-6">
|
||||
<h3 class="is-size-4 mb-3">Crear carrito</h3>
|
||||
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
<SelectModulo
|
||||
:idInstitucion="idInstitucion"
|
||||
:moduloPadre="modulo"
|
||||
@modulo-seleccionado="(nuevoModulo) => (modulo = nuevoModulo)"
|
||||
/>
|
||||
|
||||
<SelectTipoCarrito
|
||||
tipo="c"
|
||||
:tipoCarritoPadre="tipoCarrito"
|
||||
@tipo-carrito-seleccionado="
|
||||
(nuevoTipoCarrito) => (tipoCarrito = nuevoTipoCarrito)
|
||||
"
|
||||
/>
|
||||
|
||||
<SelectMarca
|
||||
tipo="c"
|
||||
:marcaPadre="marca"
|
||||
@marca-seleccionada="(nuevaMarca) => (marca = nuevaMarca)"
|
||||
/>
|
||||
|
||||
<SelectModelo
|
||||
tipo="c"
|
||||
:modeloPadre="modelo"
|
||||
@modelo-seleccionado="(nuevoModelo) => (modelo = nuevoModelo)"
|
||||
/>
|
||||
|
||||
<BotonCrear
|
||||
columnSize="is-3"
|
||||
:disabled="
|
||||
!marca.id_marca ||
|
||||
!modelo.id_modelo ||
|
||||
!modulo.id_modulo ||
|
||||
!tipoCarrito.id_tipo_carrito
|
||||
"
|
||||
:crear="warning"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import BotonCrear from '@/components/botones/BotonCrear'
|
||||
import SelectMarca from '@/components/selects/SelectMarca'
|
||||
import SelectModulo from '@/components/selects/SelectModulo'
|
||||
import SelectModelo from '@/components/selects/SelectModelo'
|
||||
import SelectTipoCarrito from '@/components/selects/SelectTipoCarrito'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
BotonCrear,
|
||||
SelectMarca,
|
||||
SelectModelo,
|
||||
SelectModulo,
|
||||
SelectTipoCarrito,
|
||||
},
|
||||
props: {
|
||||
updateActualizarTabla: { type: Function, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
idInstitucion: { type: Number, required: true, default: 0 },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
marca: {},
|
||||
modelo: {},
|
||||
modulo: {},
|
||||
tipoCarrito: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
crearCarrito() {
|
||||
const data = {
|
||||
marca: this.marca.marca,
|
||||
modelo: this.modelo.modelo,
|
||||
// id_marca: this.marca.id_marca,
|
||||
// id_modulo: this.modulo.id_modulo,
|
||||
id_modulo: this.modulo.id_modulo,
|
||||
id_tipo_carrito: this.tipoCarrito.id_tipo_carrito,
|
||||
}
|
||||
|
||||
this.updateIsLoading(true)
|
||||
axios
|
||||
.post(`${process.env.api}/carrito`, data, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.marca = {}
|
||||
this.modelo = {}
|
||||
this.modulo = {}
|
||||
this.tipoCarrito = {}
|
||||
this.updateActualizarTabla(true)
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
||||
})
|
||||
.catch((err) => {
|
||||
this.updateIsLoading(false)
|
||||
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
||||
})
|
||||
},
|
||||
warning() {
|
||||
if (
|
||||
this.marca.id_marca ||
|
||||
this.modelo.id_modelo ||
|
||||
this.modulo.id_modulo ||
|
||||
this.tipoCarrito.id_tipo_carrito
|
||||
)
|
||||
this.$alertsGenericos.imprimirWarning(
|
||||
this.$buefy,
|
||||
'¿Esta segur@ de querer crear este carrito?',
|
||||
this.crearCarrito
|
||||
)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="mb-6">
|
||||
<h3 class="is-size-4 mb-3">Crear Módulo</h3>
|
||||
<h3 class="is-size-4 mb-3">Crear módulo</h3>
|
||||
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="mb-6">
|
||||
<h3 class="is-size-4 mb-3">Crear Operador</h3>
|
||||
<h3 class="is-size-4 mb-3">Crear operador</h3>
|
||||
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="mb-6">
|
||||
<h3 class="is-size-4 mb-3">Crear Software</h3>
|
||||
<h3 class="is-size-4 mb-3">Crear software</h3>
|
||||
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="mb-6">
|
||||
<h3 class="is-size-4 mb-3">Crear Tipo de Carrito</h3>
|
||||
<h3 class="is-size-4 mb-3">Crear tipo de carrito</h3>
|
||||
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="mb-6">
|
||||
<h3 class="is-size-4 mb-3">Crear Tipo de Conector</h3>
|
||||
<h3 class="is-size-4 mb-3">Crear tipo de conector</h3>
|
||||
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<section class="mb-6">
|
||||
<h3 class="is-size-4 mb-3">Crear Tipo de Usuario</h3>
|
||||
<h3 class="is-size-4 mb-3">Crear tipo de usuario</h3>
|
||||
|
||||
<div class="box">
|
||||
<div class="columns is-align-items-flex-end pl-0 pb-4">
|
||||
|
42
components/operador/Carritos.vue
Normal file
42
components/operador/Carritos.vue
Normal file
@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<div>
|
||||
<CrearCarrito
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:updateActualizarTabla="updateActualizarTabla"
|
||||
:idInstitucion="operador.institucion.id_institucion"
|
||||
/>
|
||||
|
||||
<!-- <TablaBuscadorModulo
|
||||
:actualizarTabla="actualizarTabla"
|
||||
:updateActualizarTabla="updateActualizarTabla"
|
||||
:updateIsLoading="updateIsLoading"
|
||||
:operador="operador"
|
||||
/> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CrearCarrito from '@/components/crear/CrearCarrito'
|
||||
import TablaBuscadorModulo from '@/components/tablaBuscador/TablaBuscadorModulo'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CrearCarrito,
|
||||
TablaBuscadorModulo,
|
||||
},
|
||||
props: {
|
||||
operador: { type: Object, required: true },
|
||||
updateIsLoading: { type: Function, required: true },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
actualizarTabla: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateActualizarTabla(valorBooleano) {
|
||||
this.actualizarTabla = valorBooleano
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
@ -50,7 +50,8 @@ export default {
|
||||
this.institucionCarreras = []
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/institucion-carrera?id_institucion=${this.idInstitucion}`
|
||||
`${process.env.api}/institucion-carrera?id_institucion=${this.idInstitucion}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.institucionCarreras = res.data
|
||||
|
@ -42,7 +42,8 @@ export default {
|
||||
this.infracciones = []
|
||||
axios
|
||||
.get(
|
||||
`${process.env.api}/institucion-infraccion/infracciones?id_institucion=${this.idInstitucion}`
|
||||
`${process.env.api}/institucion-infraccion/infracciones?id_institucion=${this.idInstitucion}`,
|
||||
// this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.infracciones = res.data
|
||||
@ -62,7 +63,8 @@ export default {
|
||||
this.$emit('infraccion-seleccionada', infraccionSeleccionada)
|
||||
},
|
||||
infraccionPadre(nuevaInfraccion) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevaInfraccion)) this.infraccion = this.objVacio
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevaInfraccion))
|
||||
this.infraccion = this.objVacio
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
@ -7,7 +7,7 @@
|
||||
expanded
|
||||
rounded
|
||||
>
|
||||
<option :disabled="deshabilitarOptVacia" :value="objVacio">
|
||||
<option :disabled="deshabilitarOptVacia" :value="null">
|
||||
Selecciona una opción
|
||||
</option>
|
||||
|
||||
@ -32,8 +32,7 @@ export default {
|
||||
return {
|
||||
marcas: [],
|
||||
isLoadingSelect: false,
|
||||
marca: {},
|
||||
objVacio: {},
|
||||
marca: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -41,7 +40,10 @@ export default {
|
||||
this.isLoadingSelect = true
|
||||
this.marcas = []
|
||||
axios
|
||||
.get(`${process.env.api}/marca?tipo=${this.tipo}`)
|
||||
.get(
|
||||
`${process.env.api}/marca?tipo=${this.tipo}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.marcas = res.data
|
||||
this.$emit('catalogo-marcas', this.marcas)
|
||||
@ -54,14 +56,13 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
marca(marcaSeleccionada) {
|
||||
this.$emit('marca-seleccionada', marcaSeleccionada)
|
||||
if (marcaSeleccionada) this.$emit('marca-seleccionada', marcaSeleccionada)
|
||||
},
|
||||
marcaPadre(nuevaMarca) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevaMarca)) this.marca = this.objVacio
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevaMarca)) this.marca = null
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.marca = this.objVacio
|
||||
this.obtenerMarcas()
|
||||
},
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
expanded
|
||||
rounded
|
||||
>
|
||||
<option :disabled="deshabilitarOptVacia" :value="objVacio">
|
||||
<option :disabled="deshabilitarOptVacia" :value="null">
|
||||
Selecciona una opción
|
||||
</option>
|
||||
|
||||
@ -32,8 +32,7 @@ export default {
|
||||
return {
|
||||
modelos: [],
|
||||
isLoadingSelect: false,
|
||||
modelo: {},
|
||||
objVacio: {},
|
||||
modelo: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -41,7 +40,10 @@ export default {
|
||||
this.isLoadingSelect = true
|
||||
this.modelos = []
|
||||
axios
|
||||
.get(`${process.env.api}/modelo?tipo=${this.tipo}`)
|
||||
.get(
|
||||
`${process.env.api}/modelo?tipo=${this.tipo}`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.modelos = res.data
|
||||
this.$emit('catalogo-modelos', this.modelos)
|
||||
@ -54,14 +56,14 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
modelo(modeloSeleccionado) {
|
||||
this.$emit('modelo-seleccionado', modeloSeleccionado)
|
||||
if (modeloSeleccionado)
|
||||
this.$emit('modelo-seleccionado', modeloSeleccionado)
|
||||
},
|
||||
modeloPadre(nuevoModelo) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoModelo)) this.modelo = this.objVacio
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoModelo)) this.modelo = null
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.modelo = this.objVacio
|
||||
this.obtenerModelos()
|
||||
},
|
||||
}
|
||||
|
@ -58,7 +58,8 @@ export default {
|
||||
if (nuevoIdInstitucion) this.obtenerModulos()
|
||||
},
|
||||
modulo(moduloSeleccionado) {
|
||||
this.$emit('modulo-seleccionado', moduloSeleccionado)
|
||||
if (moduloSeleccionado)
|
||||
this.$emit('modulo-seleccionado', moduloSeleccionado)
|
||||
},
|
||||
moduloPadre(nuevoModulo) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoModulo)) this.modulo = null
|
||||
|
@ -41,7 +41,7 @@ export default {
|
||||
this.isLoadingSelect = true
|
||||
this.catalogoStatus = []
|
||||
axios
|
||||
.get(`${process.env.api}/status`)
|
||||
.get(`${process.env.api}/status`, this.$getToken.token())
|
||||
.then((res) => {
|
||||
this.catalogoStatus = res.data
|
||||
this.$emit('catalogo-status', this.catalogoStatus)
|
||||
@ -57,7 +57,8 @@ export default {
|
||||
this.$emit('status-seleccionado', statusSeleccionado)
|
||||
},
|
||||
statusPadre(nuevoStatus) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoStatus)) this.status = this.objVacio
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoStatus))
|
||||
this.status = this.objVacio
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
@ -7,7 +7,7 @@
|
||||
expanded
|
||||
rounded
|
||||
>
|
||||
<option :disabled="deshabilitarOptVacia" :value="objVacio">
|
||||
<option :disabled="deshabilitarOptVacia" :value="null">
|
||||
Selecciona una opción
|
||||
</option>
|
||||
|
||||
@ -31,8 +31,7 @@ export default {
|
||||
return {
|
||||
tiposCarritos: [],
|
||||
isLoadingSelect: false,
|
||||
tipoCarrito: {},
|
||||
objVacio: {},
|
||||
tipoCarrito: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -40,7 +39,10 @@ export default {
|
||||
this.isLoadingSelect = true
|
||||
this.tiposCarritos = []
|
||||
axios
|
||||
.get(`${process.env.api}/institucion-tipo-carrito`)
|
||||
.get(
|
||||
`${process.env.api}/institucion-tipo-carrito`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.tiposCarritos = res.data
|
||||
this.$emit('catalogo-tipos-carritos', this.tiposCarritos)
|
||||
@ -53,14 +55,15 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
tipoCarrito(tipoCarritoSeleccionado) {
|
||||
this.$emit('tipo-carrito-seleccionado', tipoCarritoSeleccionado)
|
||||
if (tipoCarritoSeleccionado)
|
||||
this.$emit('tipo-carrito-seleccionado', tipoCarritoSeleccionado)
|
||||
},
|
||||
tipoCarritoPadre(nuevoTipoCarrito) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoTipoCarrito)) this.tipoCarrito = this.objVacio
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoTipoCarrito))
|
||||
this.tipoCarrito = null
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.tipoCarrito = this.objVacio
|
||||
this.obtenerTiposCarritos()
|
||||
},
|
||||
}
|
||||
|
@ -44,7 +44,10 @@ export default {
|
||||
this.isLoadingSelect = true
|
||||
this.tiposEntradas = []
|
||||
axios
|
||||
.get(`${process.env.api}/institucion-tipo-entrada`)
|
||||
.get(
|
||||
`${process.env.api}/institucion-tipo-entrada`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.tiposEntradas = res.data
|
||||
this.$emit('catalogo-tipos-entradas', this.tiposEntradas)
|
||||
@ -60,7 +63,8 @@ export default {
|
||||
this.$emit('tipo-entrada-seleccionada', tipoEntradaSeleccionada)
|
||||
},
|
||||
tipoEntradaPadre(nuevoTipoEntrada) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoTipoEntrada)) this.tipoEntrada = this.objVacio
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoTipoEntrada))
|
||||
this.tipoEntrada = this.objVacio
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
@ -40,10 +40,13 @@ export default {
|
||||
this.isLoadingSelect = true
|
||||
this.tiposUsuarios = []
|
||||
axios
|
||||
.get(`${process.env.api}/institucion-tipo-entrada`)
|
||||
.get(
|
||||
`${process.env.api}/institucion-tipo-entrada`,
|
||||
this.$getToken.token()
|
||||
)
|
||||
.then((res) => {
|
||||
this.tiposUsuarios = res.data
|
||||
this.$emit('catalogo-tipos-entradas', this.tiposUsuarios)
|
||||
this.$emit('catalogo-tipos-usuarios', this.tiposUsuarios)
|
||||
this.isLoadingSelect = false
|
||||
})
|
||||
.catch((err) => {
|
||||
@ -56,7 +59,8 @@ export default {
|
||||
this.$emit('tipo-usuario-seleccionado', tipoUsuarioSeleccionado)
|
||||
},
|
||||
tipoUsuarioPadre(nuevoTipoUsuario) {
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoTipoUsuario)) this.tipoUsuario = this.objVacio
|
||||
if (this.$funcionesGlobales.objIsEmpty(nuevoTipoUsuario))
|
||||
this.tipoUsuario = this.objVacio
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
@ -15,20 +15,21 @@
|
||||
:updateActualizarTabla="updateActualizarTabla"
|
||||
:actualizarTabla="actualizarTabla"
|
||||
/>
|
||||
|
||||
<Carritos :operador="operador" :updateIsLoading="updateIsLoading" />
|
||||
|
||||
<b-loading :is-full-page="true" v-model="isLoading" :can-cancel="false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Title from '@/components/layouts/Title'
|
||||
import Carritos from '@/components/operador/Carritos'
|
||||
import CrearCarrito from '@/components/operador/CrearCarrito'
|
||||
import InputsCarritos from '@/components/operador/InputsCarritos'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Title,
|
||||
CrearCarrito,
|
||||
InputsCarritos,
|
||||
},
|
||||
components: { Carritos, CrearCarrito, InputsCarritos, Title },
|
||||
data() {
|
||||
return {
|
||||
operador: {},
|
||||
|
Loading…
Reference in New Issue
Block a user