mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
error presupuestos
This commit is contained in:
@ -4,8 +4,7 @@ class ErrorPresupuestoView {
|
||||
this.item = domItem
|
||||
this.datatableItem = this.item.find("#tableErrorPresupuesto")
|
||||
this.datatableColumns = [
|
||||
{ data: 'id', name: "id", searchable: true, sortable: false },
|
||||
{ data: 'presupuestoTitulo',searchable: true, sortable: false },
|
||||
{ data: 'presupuestoId', searchable: true, sortable: false },
|
||||
{ data: 'presupuestoUser',searchable: true, sortable: false },
|
||||
{ data: 'lastUser', searchable: true, sortable: false },
|
||||
{ data: 'visto', searchable: false, sortable: false ,
|
||||
|
||||
@ -1,44 +1,68 @@
|
||||
import Ajax from "../../../components/ajax.js"
|
||||
|
||||
|
||||
import Ajax from "../../../components/ajax.js";
|
||||
import ajax from "../../../components/ajax.js"
|
||||
|
||||
class ErrorPresupuestoView {
|
||||
class ErrorPresupuestoForm {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
this.datatableItem = this.item.find("#tableErrorPresupuesto")
|
||||
this.datatableColumns = [
|
||||
{ data: 'id', searchable: true, sortable: false },
|
||||
{ data: 'presupuestoTitulo', searchable: true, sortable: false },
|
||||
{ data: 'presupuestoUser', searchable: true, sortable: false },
|
||||
{ data: 'visto', searchable: false, sortable: false },
|
||||
{ data: 'lastUser', searchable: true, sortable: false },
|
||||
{
|
||||
data: 'action', sortable: false, searchable: false,
|
||||
render: (d, t) => {
|
||||
return `
|
||||
<div class="btn-group btn-group-sm">
|
||||
<a href="javascript:void(0)" data-id="${d}" class="edit-error-presupuesto"><i class="ti ti-eye ti-sm mx-2"></i></a>
|
||||
</div>
|
||||
`
|
||||
}
|
||||
},
|
||||
]
|
||||
this.form = this.item.find("#error-presupuesto-form")
|
||||
this.inputPresupuestoUserId = this.item.find("#presupuesto-user-id")
|
||||
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")
|
||||
}
|
||||
init() {
|
||||
this.datatable = this.datatableItem.DataTable({
|
||||
processing: true,
|
||||
dom: 'Brtip',
|
||||
serverSide: true,
|
||||
|
||||
language: {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
columns: this.datatableColumns,
|
||||
ajax: '/configuracion/errores-presupuesto/datatable'
|
||||
});
|
||||
this.item.on("click",".button-update-comment",this.handlePostErrorPresupuesto.bind(this))
|
||||
this.handleGetErrorPresupuesto()
|
||||
}
|
||||
handleGetErrorPresupuesto()
|
||||
{
|
||||
const ajax = new Ajax(
|
||||
`/configuracion/errores-presupuesto/get/${this.errorPresupuestoId}`,
|
||||
null,
|
||||
null,
|
||||
this.handleGetErrorPresupuestoSuccess.bind(this),
|
||||
this.handleGetErrorPresupuestoError.bind(this)
|
||||
)
|
||||
ajax.get()
|
||||
}
|
||||
handleGetErrorPresupuestoSuccess(data){
|
||||
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")
|
||||
|
||||
}
|
||||
handleGetErrorPresupuestoError(){}
|
||||
handlePostErrorPresupuesto()
|
||||
{
|
||||
let data =
|
||||
{
|
||||
"comments" : this.inputComments.val()
|
||||
}
|
||||
this.updateBtnIcon.removeClass()
|
||||
this.updateBtnIcon.addClass("spinner-border spinner-border-lg text-secondary")
|
||||
const ajax = new Ajax(
|
||||
`/configuracion/errores-presupuesto/edit/${this.errorPresupuestoId}`,
|
||||
data,
|
||||
null,
|
||||
this.handlePostErrorPresupuestoSuccess.bind(this),
|
||||
this.handlePostErrorPresupuestoError.bind(this)
|
||||
)
|
||||
ajax.post()
|
||||
}
|
||||
handlePostErrorPresupuestoSuccess(){
|
||||
this.updateBtnIcon.removeClass()
|
||||
this.updateBtnIcon.addClass("ti ti-md ti-check")
|
||||
|
||||
this.handleGetErrorPresupuesto()
|
||||
}
|
||||
handlePostErrorPresupuestoError(error){}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export default ErrorPresupuestoView;
|
||||
export default ErrorPresupuestoForm;
|
||||
@ -0,0 +1,6 @@
|
||||
import ErrorPresupuestoForm from "./errorPresupuestoForm.js";
|
||||
|
||||
$(document).ready(() => {
|
||||
const errorPresupuestoForm = new ErrorPresupuestoForm($("#error-presupuesto-container"))
|
||||
errorPresupuestoForm.init()
|
||||
})
|
||||
Reference in New Issue
Block a user