2022-07-11 05:48:06 +00:00
|
|
|
<template>
|
|
|
|
<div class="column is-4">
|
|
|
|
<h3 class="is-size-4 mb-4">Administrador</h3>
|
|
|
|
|
2022-07-29 20:40:03 +00:00
|
|
|
<BotonDesactivar
|
|
|
|
:disabled="
|
|
|
|
!carrito.id_carrito || operador.tipoUsuario.id_tipo_usuario === 2
|
|
|
|
"
|
|
|
|
:activarDesactivar="activarDesactivar"
|
|
|
|
:row="carrito"
|
|
|
|
:msjWarning="`¿Estas segur@ de querer ${
|
|
|
|
carrito.activo ? 'desactivar' : 'activar'
|
|
|
|
} este carrito?`"
|
|
|
|
labelDisabled
|
|
|
|
/>
|
2022-07-11 05:48:06 +00:00
|
|
|
|
2022-07-29 20:40:03 +00:00
|
|
|
<!-- <b-field
|
2022-07-11 05:48:06 +00:00
|
|
|
label="Cambiar nombre del carrito"
|
|
|
|
v-if="carrito.tipoCarrito.id_tipo_carrito"
|
|
|
|
>
|
|
|
|
<b-input
|
|
|
|
icon="list-status"
|
|
|
|
v-model="nuevoNombreCarrito"
|
2022-07-22 21:56:10 +00:00
|
|
|
placeholder="Nuevo nombre del carrito"
|
2022-07-11 05:48:06 +00:00
|
|
|
rounded
|
|
|
|
/>
|
|
|
|
</b-field>
|
|
|
|
|
2022-07-29 20:40:03 +00:00
|
|
|
<BotonGuardar
|
|
|
|
:disabled="dominio || diasMultaRetraso || tiempoPrestamo ? false : true"
|
|
|
|
:guardar="actualizarDatos"
|
|
|
|
msjWarning="¿Estas segur@ de querer guardar estos cambios?"
|
|
|
|
/> -->
|
2022-07-11 05:48:06 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import axios from 'axios'
|
2022-07-29 20:40:03 +00:00
|
|
|
import BotonDesactivar from '@/components/botones/BotonDesactivar'
|
|
|
|
import BotonGuardar from '@/components/botones/BotonGuardar'
|
2022-07-11 05:48:06 +00:00
|
|
|
|
|
|
|
export default {
|
2022-07-29 20:40:03 +00:00
|
|
|
components: { BotonDesactivar, BotonGuardar },
|
2022-07-11 05:48:06 +00:00
|
|
|
props: {
|
|
|
|
buscar: { type: Function, required: true },
|
2022-07-29 20:40:03 +00:00
|
|
|
updateIsLoading: { type: Function, required: true },
|
|
|
|
carrito: { type: Object, required: true },
|
|
|
|
operador: { type: Object, required: true },
|
2022-07-11 05:48:06 +00:00
|
|
|
},
|
|
|
|
data() {
|
2022-07-29 20:40:03 +00:00
|
|
|
return { nuevoNombreCarrito: '' }
|
2022-07-11 05:48:06 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2022-07-29 20:40:03 +00:00
|
|
|
activarDesactivar() {
|
|
|
|
const data = {
|
|
|
|
id_carrito: this.carrito.id_carrito,
|
|
|
|
activo: !this.carrito.activo,
|
|
|
|
}
|
2022-07-11 05:48:06 +00:00
|
|
|
|
2022-07-29 20:40:03 +00:00
|
|
|
this.updateIsLoading(true)
|
2022-07-11 05:48:06 +00:00
|
|
|
axios
|
2022-07-19 16:41:33 +00:00
|
|
|
.put(`${process.env.api}/carrito`, data, this.$getToken.token())
|
2022-07-11 05:48:06 +00:00
|
|
|
.then((res) => {
|
|
|
|
this.buscar()
|
|
|
|
this.updateIsLoading(false)
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
2022-07-11 05:48:06 +00:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.updateIsLoading(false)
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
2022-07-11 05:48:06 +00:00
|
|
|
})
|
|
|
|
},
|
2022-07-29 20:40:03 +00:00
|
|
|
guradar() {
|
2022-07-11 05:48:06 +00:00
|
|
|
const data = {
|
2022-07-11 06:30:45 +00:00
|
|
|
id_carrito: this.carrito.id_carrito,
|
2022-07-11 05:48:06 +00:00
|
|
|
}
|
2022-07-29 20:40:03 +00:00
|
|
|
|
2022-07-11 05:48:06 +00:00
|
|
|
this.updateIsLoading(true)
|
2022-07-29 20:40:03 +00:00
|
|
|
if (this.nuevoNombreCarrito) data.carrito = this.this.nuevoNombreCarrito
|
2022-07-11 05:48:06 +00:00
|
|
|
axios
|
2022-07-19 16:41:33 +00:00
|
|
|
.put(`${process.env.api}/carrito`, data, this.$getToken.token())
|
2022-07-11 05:48:06 +00:00
|
|
|
.then((res) => {
|
2022-07-29 20:40:03 +00:00
|
|
|
this.this.nuevoNombreCarrito = ''
|
2022-07-11 05:48:06 +00:00
|
|
|
this.buscar()
|
|
|
|
this.updateIsLoading(false)
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirMensaje(this.$buefy, res.data.message)
|
2022-07-11 05:48:06 +00:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
this.updateIsLoading(false)
|
2022-07-11 14:15:10 +00:00
|
|
|
this.$alertsGenericos.imprimirError(this.$buefy, err.response.data)
|
2022-07-11 05:48:06 +00:00
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|