toggle corte rotativa planning

This commit is contained in:
amazuecos
2025-03-31 09:05:03 +02:00
parent c65c6571cd
commit 460cb0344f
10 changed files with 174 additions and 59 deletions

View File

@ -176,10 +176,10 @@ class OrdenTrabajo {
console.log("Create selects")
this.summaryData.tasks.forEach(element => {
let selectItem = this.item.find("#select-maquina-tarea-" + element.id);
if (element.presupuesto_linea_id) this.createSelectMaquinaImpresion(selectItem)
if (element.presupuesto_linea_id && element.is_corte == false) this.createSelectMaquinaImpresion(selectItem)
if (element.presupuesto_acabado_id) this.createSelectMaquinaAcabado(selectItem)
if (element.presupuesto_encuadernado_id) this.createSelectMaquinaEncuadernacion(selectItem)
if (element.presupuesto_manipulado_id) this.createSelectMaquinaManipulado(selectItem)
if (element.presupuesto_manipulado_id || element.is_corte) this.createSelectMaquinaManipulado(selectItem)
if (element.presupuesto_preimpresion_id) this.createSelectMaquinaAll(selectItem)
if (element.presupuesto_extra_id) this.createSelectMaquinaAll(selectItem)
});

View File

@ -1,5 +1,6 @@
import ClassSelect from "../../../components/select2.js";
import Ajax from "../../../components/ajax.js";
import { alertError, alertSuccess } from "../../../components/alerts/sweetAlert.js";
class PlanningRotativa {
@ -204,7 +205,7 @@ class PlanningRotativa {
this.papelGramajeDatatable.on('draw', this.addTotalFooter.bind(this))
this.tablePlanningRot.on('change', ".metros-check", this.calcMetrosCheck.bind(this))
this.tablePlanningRot.on("click",'.change-corte',this.toggleCorte.bind(this))
/**
* PLANNING PLANA
*/
@ -307,15 +308,34 @@ class PlanningRotativa {
this.totalPliegosSel.set(metros_sel.reduce((a, b) => a + b, 0))
}
renderCorteImage() {
renderCorteImage(data) {
const tipo_corte = data.tipo_corte == "bobina" ? "cortadora_bobinas" : "guillotina";
console.log(data.tipo_corte)
return `
<a type="button" class="btn btn-outline-secondary bg-white btn-xs change-corte">
<a type="button" class="btn btn-outline-secondary bg-white btn-xs change-corte" data-id=${data.otId}>
<div class="avatar avatar-size-xs">
<img src="/assets/img/cortadora_bobinas.png" alt="Guillotina" width="10px" height="10px">
<img src="/assets/img/${tipo_corte}.png" alt="${data.tipo_corte}" width="10px" height="10px">
</div>
</a>
`
}
toggleCorte(event){
let otId = $(event.currentTarget).data('id')
let ajax = new Ajax("/produccion/ordentrabajo/planning/tarea/toggle/corte/" + otId,
null,
null,
this.toggleCorteSuccess.bind(this),
this.toggleCorteError.bind(this)
)
ajax.post()
}
toggleCorteSuccess(response){
this.datatablePlanningRot.ajax.reload()
alertSuccess(response.message).fire()
}
toggleCorteError(){
}
}