add select imposicion datatable

This commit is contained in:
amazuecos
2025-04-21 08:32:21 +02:00
parent b318721b90
commit 969966ac78
9 changed files with 127 additions and 74 deletions

View File

@ -4,7 +4,12 @@ import ImposicionEsquemaDrawing from '../imposicionEsquemaDrawing.js';
class ImposicionEsquemaForm {
constructor(domItem) {
this.item = domItem
this.drawing = new ImposicionEsquemaDrawing($("#imposicion-esquema-drawing"))
if ($("#imposicion-esquema-drawing").length > 0) {
this.drawing = new ImposicionEsquemaDrawing($("#imposicion-esquema-drawing"))
} else {
this.drawing = null
}
this.modelId = this.item.data("id");
this.btnSubmitUpdateImposicion = this.item.find("#btnSubmitUpdateImposicionEsquema")
this.btnSubmitNewImposicion = this.item.find("#btnSubmitNewImposicionEsquema")
@ -29,31 +34,34 @@ class ImposicionEsquemaForm {
}
init() {
this.item.on("change", "#esquema-rows", (event) => {
let rows = $(event.currentTarget).val()
this.drawing.setRows(rows)
})
this.item.on("change", "#esquema-rotativa", (event) => {
let rotativa = $(event.currentTarget).prop("checked")
this.drawing.setRotativa(rotativa)
})
this.item.on("change", "#esquema-cosido", (event) => {
let cosido = $(event.currentTarget).prop("checked")
this.drawing.setCosido(cosido)
})
this.item.on("change", "#esquema-orientacion", (event) => {
let orientation = $(event.currentTarget).val()
this.drawing.setOrientation(orientation)
})
this.item.on("change", "#esquema-columns", (event) => {
let columns = $(event.currentTarget).val()
this.drawing.setColumns(columns)
})
if (this.modelId) {
this.btnSubmitUpdateImposicion.on("click", this.handleUpdate.bind(this))
this.handleGetData()
} else {
this.initNew()
if (this.drawing) {
this.drawing.setOrientation($("#esquema-orientacion").val())
this.item.on("change", "#esquema-rows", (event) => {
let rows = $(event.currentTarget).val()
this.drawing.setRows(rows)
})
this.item.on("change", "#esquema-rotativa", (event) => {
let rotativa = $(event.currentTarget).prop("checked")
this.drawing.setRotativa(rotativa)
})
this.item.on("change", "#esquema-cosido", (event) => {
let cosido = $(event.currentTarget).prop("checked")
this.drawing.setCosido(cosido)
})
this.item.on("change", "#esquema-orientacion", (event) => {
let orientation = $(event.currentTarget).val()
this.drawing.setOrientation(orientation)
})
this.item.on("change", "#esquema-columns", (event) => {
let columns = $(event.currentTarget).val()
this.drawing.setColumns(columns)
})
if (this.modelId) {
this.btnSubmitUpdateImposicion.on("click", this.handleUpdate.bind(this))
this.handleGetData()
} else {
this.initNew()
}
}
}
initNew() {
@ -156,6 +164,7 @@ class ImposicionEsquemaForm {
this.disable()
this.item.find(".invalid-feedback").remove()
this.btnSubmitNewImposicion.addClass("d-none")
this.btnSubmitUpdateImposicion.addClass("d-none")
popSuccessAlert(response.message)
}
postErrorNew(error) {