feat:errores presupuesto

This commit is contained in:
amazuecos
2024-10-19 07:29:47 +00:00
parent f1df4559f7
commit f9b12cbcdd
4 changed files with 36 additions and 22 deletions

View File

@ -11,7 +11,11 @@ class ErrorPresupuestoForm {
this.inputDatos = this.item.find("#datos-presupuesto")
this.inputComments = this.item.find("#comments-presupuesto")
this.errorPresupuestoId = this.item.find("#error-presupuesto-id").attr("value")
this.updateBtnIcon = this.item.find("#update-button-icon")
this.updateBtnIcon = this.item.find(".button-update-comment")
this.checkVisto = this.item.find("#error-presupuesto-visto")
this.loader = this.item.find("#update-button-loader")
this.btnIcon = this.item.find("#update-button-icon")
}
init() {
this.item.on("click",".button-update-comment",this.handlePostErrorPresupuesto.bind(this))
@ -32,10 +36,15 @@ class ErrorPresupuestoForm {
this.inputPresupuestoUserId.val(data.data.presupuestoUser)
this.inputDatos.val(data.data.datos)
this.inputComments.val(data.data.comment)
this.updateBtnIcon.removeClass()
this.updateBtnIcon.addClass("ti ti-md ti-send")
this.updateBtnIcon.prop("disabled",false)
this.checkVisto.prop("checked",parseInt(data.data.visto) == 1 ? true : false)
this.setLoader(false)
}
setLoader(state = true){
this.loader.prop("hidden",!state)
this.btnIcon.prop("hidden",state)
}
handleGetErrorPresupuestoError(){}
handlePostErrorPresupuesto()
{
@ -43,8 +52,8 @@ class ErrorPresupuestoForm {
{
"comments" : this.inputComments.val()
}
this.updateBtnIcon.removeClass()
this.updateBtnIcon.addClass("spinner-border spinner-border-lg text-secondary")
this.updateBtnIcon.prop("disabled",true)
this.setLoader()
const ajax = new Ajax(
`/configuracion/errores-presupuesto/edit/${this.errorPresupuestoId}`,
data,
@ -55,8 +64,6 @@ class ErrorPresupuestoForm {
ajax.post()
}
handlePostErrorPresupuestoSuccess(){
this.updateBtnIcon.removeClass()
this.updateBtnIcon.addClass("ti ti-md ti-check")
this.handleGetErrorPresupuesto()
}