113 lines
2.6 KiB
Vue
113 lines
2.6 KiB
Vue
![]() |
<template>
|
||
|
<b-field>
|
||
|
<b-button
|
||
|
type="is-link"
|
||
|
@click="
|
||
|
imprimirWarning(
|
||
|
'Esta a punto de confirmar el regreso de un equipo de cómputo. ¿Esta segur@ de querer realizar esta acción?',
|
||
|
revisionMultaRegresoInmediato
|
||
|
)
|
||
|
"
|
||
|
>
|
||
|
Liberar
|
||
|
</b-button>
|
||
|
</b-field>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import axios from 'axios'
|
||
|
import ModalMultaIdPrestamo from './ModalMultaIdPrestamo'
|
||
|
|
||
|
export default {
|
||
|
props: {
|
||
|
operador: {
|
||
|
type: Object,
|
||
|
required: true,
|
||
|
},
|
||
|
prestamo: {
|
||
|
type: Object,
|
||
|
required: true,
|
||
|
},
|
||
|
imprimirError: {
|
||
|
type: Function,
|
||
|
required: true,
|
||
|
},
|
||
|
imprimirWarning: {
|
||
|
type: Function,
|
||
|
required: true,
|
||
|
},
|
||
|
imprimirMensaje: {
|
||
|
type: Function,
|
||
|
required: true,
|
||
|
},
|
||
|
updateIsLoadingPage: {
|
||
|
type: Function,
|
||
|
required: true,
|
||
|
},
|
||
|
},
|
||
|
methods: {
|
||
|
multa(idPrestamo, idInfraccion, descripcion) {
|
||
|
const data = {
|
||
|
idOperadorMulta: this.operador.idOperador,
|
||
|
idPrestamo,
|
||
|
idInfraccion,
|
||
|
descripcion,
|
||
|
}
|
||
|
|
||
|
this.updateIsLoadingPage(true)
|
||
|
return axios
|
||
|
.post(`${process.env.api}/multa/multar`, data, this.operador.token)
|
||
|
.then((res) => {
|
||
|
this.updateIsLoadingPage(false)
|
||
|
return res.data.message
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
this.updateIsLoadingPage(false)
|
||
|
this.imprimirError(err.response.data)
|
||
|
})
|
||
|
},
|
||
|
regresar() {
|
||
|
const data = {
|
||
|
idOperadorRegreso: this.operador.idOperador,
|
||
|
idPrestamo: this.prestamo.idPrestamo,
|
||
|
}
|
||
|
|
||
|
this.updateIsLoadingPage(true)
|
||
|
return axios
|
||
|
.put(`${process.env.api}/prestamo/regresar`, data, this.operador.token)
|
||
|
.then((res) => {
|
||
|
this.imprimirMensaje(res.data.message)
|
||
|
this.updateIsLoadingPage(false)
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
this.updateIsLoadingPage(false)
|
||
|
this.imprimirError(err.response.data)
|
||
|
})
|
||
|
},
|
||
|
revisionMultaRegresoInmediato() {
|
||
|
const modalProps = {
|
||
|
regresoInmediato: true,
|
||
|
operador: this.operador,
|
||
|
idPrestamo: this.prestamo.idPrestamo.toString(),
|
||
|
regresar: this.regresar,
|
||
|
multaPrestamo: this.multa,
|
||
|
imprimirError: this.imprimirError,
|
||
|
imprimirMensaje: this.imprimirMensaje,
|
||
|
updateIsLoading: this.updateIsLoadingPage,
|
||
|
}
|
||
|
|
||
|
this.$buefy.modal.open({
|
||
|
props: modalProps,
|
||
|
parent: this,
|
||
|
component: ModalMultaIdPrestamo,
|
||
|
hasModalCard: true,
|
||
|
customClass: 'custom-class custom-class-2',
|
||
|
trapFocus: true,
|
||
|
})
|
||
|
},
|
||
|
},
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style></style>
|