ot pliegos

This commit is contained in:
amazuecos
2025-04-27 10:58:23 +02:00
parent 45e41c77e4
commit c75d08b3c3
17 changed files with 355 additions and 121 deletions

View File

@ -154,6 +154,7 @@ class OrdenTrabajo {
this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this))
$("#btn-update-tarea-comment").on("click", this.handleTareaNoteSubmit.bind(this))
this.otForm.on("change", "#ot-comment", this.handleOtComment.bind(this))
$("#btn-update-pliegos").on('click', this.handleUpdatePliegos.bind(this))
this._handleGetData()
this.handleGetPortada()
@ -162,14 +163,9 @@ class OrdenTrabajo {
this.datatableTareas = this.tareasTableItem.DataTable({
processing: true,
paging: false,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
responsive: true,
bFilter: false,
createdRow: this.filterCreatedRow.bind(this),
pageLength: 10,
language: {
@ -236,7 +232,7 @@ class OrdenTrabajo {
}
createSelectMaquinaTarea() {
try {
this.summaryData.tasks.forEach(element => {
this.summaryData.tasks.forEach(async (element) => {
let selectItem = this.item.find("#select-maquina-tarea-" + element.id);
if (element.presupuesto_linea_id && element.is_corte == false) this.createSelectMaquinaImpresion(selectItem)
if (element.presupuesto_acabado_id) this.createSelectMaquinaAcabado(selectItem)
@ -322,7 +318,7 @@ class OrdenTrabajo {
maquinaSelects.reset()
}
}
createSelectImposicion(selectItem) {
async createSelectImposicion(selectItem) {
let imposicionId = selectItem.data("imposicion-id")
let imposicionSelect = new ClassSelect(selectItem, `/imposiciones/select`, "Seleccione una imposición", true);
@ -359,9 +355,11 @@ class OrdenTrabajo {
this.otForm.off("change", ".ot-pedido")
this.otForm.off("change", ".ot-pedido-check")
this.otForm.off("change", ".ot-preview")
this.fillOtDetails()
this.fillOtDates()
this.fillPreimpresionReview()
this.fillPliegos()
this.isOtFinalizada = this.summaryData.ot.estado == "F";
this.datatableTareas.ajax.reload()
} catch (error) {
@ -393,6 +391,15 @@ class OrdenTrabajo {
}
fillPliegos() {
// if (this.summaryData.tareaCosido) {
// const tareaCosido = this.summaryData.tareaCosido
// this.otForm.find('input[name=pliego_1]').val(tareaCosido.pliego_1)
// this.otForm.find('input[name=pliego_1_total]').val(tareaCosido.pliego_1_total)
// this.otForm.find('input[name=pliego_2]').val(tareaCosido.pliego_2)
// this.otForm.find('input[name=pliego_2_total]').val(tareaCosido.pliego_2_total)
// }
}
fillOtDetails() {
const progreso = this.summaryData.ot.progreso
@ -823,6 +830,40 @@ class OrdenTrabajo {
this._handleGetData()
}
getTarea(tarea_id) {
return new Promise((resolve, reject) => {
let ajax = new Ajax(`/produccion/ordentrabajo/tarea/${tarea_id}`, null, null, (response) => {
resolve(response)
},
(error) => {
resolve(error)
})
ajax.get()
})
}
getDataPliegos() {
return {
orden_trabajo_id: this.modelId,
pliego_1: $("#pliegos-1").val(),
pliego_1_total: $("#pliegos-1-total").val(),
pliego_2: $("#pliegos-2").val(),
pliego_2_total: $("#pliegos-2-total").val(),
}
}
handleUpdatePliegos() {
let ajax = new Ajax(`/produccion/ordentrabajo/update/tarea/pliegos`,
this.getDataPliegos(),
null,
(response) => {
alertSuccess(response.message).fire()
},
(error) => {
alertError(error.message).fire()
})
ajax.post()
}
}