mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
imposiciones
This commit is contained in:
@ -26,7 +26,7 @@ class OrdenTrabajo {
|
||||
{ data: 'nombre', searchable: true, sortable: true, width: "20%" },
|
||||
{ data: 'maquina_presupuesto_linea', searchable: true, sortable: true, width: "20%" },
|
||||
{ data: 'maquina_tarea', searchable: false, sortable: false, render: this._renderMaquinaSelectTable.bind(this), width: "20%" },
|
||||
// { data: 'imposicion_id', searchable: false, sortable: false },
|
||||
{ data: 'imposicion', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this) },
|
||||
{ data: 'tiempo_estimado', searchable: false, sortable: false },
|
||||
{ data: 'tiempo_real', searchable: false, sortable: false },
|
||||
{
|
||||
@ -42,13 +42,13 @@ class OrdenTrabajo {
|
||||
nameId: "orden_trabajo_id",
|
||||
getUri: '/produccion/ordentrabajo/get_files',
|
||||
postUri: '/produccion/ordentrabajo/upload_files',
|
||||
resourcePath : 'orden_trabajo/' + this.modelId
|
||||
resourcePath: 'orden_trabajo/' + this.modelId
|
||||
}
|
||||
if ($(this.configUploadDropzone.domElement).length > 0) {
|
||||
this.fileUploadDropzone = new FileUploadDropzone(this.configUploadDropzone)
|
||||
}
|
||||
}
|
||||
initDropFiles(){
|
||||
initDropFiles() {
|
||||
if ($(this.configUploadDropzone.domElement).length > 0) {
|
||||
this.fileUploadDropzone.init()
|
||||
}
|
||||
@ -90,6 +90,7 @@ class OrdenTrabajo {
|
||||
eventTareas() {
|
||||
this.otForm.on("change", ".select-maquina-tarea-datatable", this.handleTareaChange.bind(this))
|
||||
this.otForm.on("change", ".orden-tarea", this.handleTareaChange.bind(this))
|
||||
this.otForm.on("change", ".select-imposicion-tarea-datatable", this.handleTareaChange.bind(this))
|
||||
this.otForm.on("click", ".increase-order", (event) => {
|
||||
const input_orden_tarea = $(event.currentTarget).parent().parent().find('.orden-tarea')
|
||||
let actual_value = parseInt(input_orden_tarea.val())
|
||||
@ -105,6 +106,7 @@ class OrdenTrabajo {
|
||||
}
|
||||
unbindEventTareas() {
|
||||
this.otForm.off("change", ".select-maquina-tarea-datatable")
|
||||
this.otForm.off("change", ".select-imposicion-tarea-datatable")
|
||||
this.otForm.off("change", ".orden-tarea")
|
||||
this.otForm.off("click", ".increase-order")
|
||||
this.otForm.off("click", ".decrease-order")
|
||||
@ -172,6 +174,14 @@ class OrdenTrabajo {
|
||||
<option value="${d.maquina_id}" selected="selected">${d.maquina_name ?? ''}</option>
|
||||
</select>`
|
||||
|
||||
}
|
||||
_renderImposicionSelectTable(d, t) {
|
||||
|
||||
let render = `<select id="select-imposicion-tarea-${d.id}" data-imposicion-id="${d.imposicion_id}" data-id="${d.id}" name="imposicion_id" class="select2 form-select select-imposicion-tarea-datatable ${d.imposicion_id ? '' : 'is-invalid'}">
|
||||
<option value="${d.imposicion_id}" selected="selected">${d.name ?? ''}</option>
|
||||
</select>`
|
||||
return render
|
||||
|
||||
}
|
||||
_renderActionCell(d, t) {
|
||||
|
||||
@ -204,6 +214,26 @@ class OrdenTrabajo {
|
||||
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)
|
||||
if (this.summaryData.impresion_interior_bn) {
|
||||
let isTareaImpresionInteriorBN = this.summaryData.impresion_interior_bn?.presupuesto_linea_id == element.presupuesto_linea_id
|
||||
if (isTareaImpresionInteriorBN) {
|
||||
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
|
||||
this.createSelectImposicion(selectItemImposicion)
|
||||
} else {
|
||||
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
|
||||
selectItemImposicion.addClass("d-none");
|
||||
}
|
||||
}
|
||||
if (this.summaryData.impresion_interior_color) {
|
||||
let isTareaImpresionInteriorColor = this.summaryData.impresion_interior_color?.presupuesto_linea_id == element.presupuesto_linea_id
|
||||
if (isTareaImpresionInteriorColor) {
|
||||
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
|
||||
this.createSelectImposicion(selectItemImposicion)
|
||||
} else {
|
||||
let selectItemImposicion = this.item.find("#select-imposicion-tarea-" + element.id);
|
||||
selectItemImposicion.addClass("d-none");
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
} finally {
|
||||
@ -262,6 +292,25 @@ class OrdenTrabajo {
|
||||
maquinaSelects.reset()
|
||||
}
|
||||
}
|
||||
createSelectImposicion(selectItem) {
|
||||
let imposicionId = selectItem.data("imposicion-id")
|
||||
let imposicionSelect = new ClassSelect(selectItem, `/imposiciones/select`, "Seleccione una imposición", true);
|
||||
|
||||
imposicionSelect.config.templateResult = (state) => {
|
||||
let $state = $(`
|
||||
<div class="d-flex flex-column justify-content-start align-items-start gap-1">
|
||||
<span class="item-text">${state.text}</span>
|
||||
<span class="badge text-bg-secondary">${state.desc ?? ''}</span>
|
||||
</div>`)
|
||||
return $state;
|
||||
}
|
||||
imposicionSelect.init();
|
||||
if (imposicionId) {
|
||||
imposicionSelect.setVal(imposicionId)
|
||||
} else {
|
||||
imposicionSelect.reset()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -294,7 +343,7 @@ class OrdenTrabajo {
|
||||
}
|
||||
handleSummaryError(error) {
|
||||
Notiflix.Block.remove('.section-block');
|
||||
}
|
||||
}
|
||||
fillPreimpresionReview() {
|
||||
this.otForm.find("[name=fecha_entrega_warning]").prop("checked", this.summaryData.ot.fecha_entrega_warning)
|
||||
this.otForm.find("[name=fecha_entrega_warning_revised]").prop("checked", this.summaryData.ot.fecha_entrega_warning_revised)
|
||||
@ -333,10 +382,10 @@ class OrdenTrabajo {
|
||||
this.espiral.setDate(this.summaryData.dates.fecha_impresion_at)
|
||||
this.embalaje.setDate(this.summaryData.dates.embalaje_at)
|
||||
this.envio.setDate(this.summaryData.dates.envio_at)
|
||||
this.pedidoEnEsperaCheck.prop("checked",this.summaryData.ot.is_pedido_espera);
|
||||
if(this.summaryData.ot.pedido_espera_by){
|
||||
this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name,this.summaryData.ot.pedido_espera_by.last_name].join(" "))
|
||||
}else{
|
||||
this.pedidoEnEsperaCheck.prop("checked", this.summaryData.ot.is_pedido_espera);
|
||||
if (this.summaryData.ot.pedido_espera_by) {
|
||||
this.pedidoEnEsperaBy.text([this.summaryData.ot.pedido_espera_by.first_name, this.summaryData.ot.pedido_espera_by.last_name].join(" "))
|
||||
} else {
|
||||
this.pedidoEnEsperaBy.text("");
|
||||
}
|
||||
this.otEstado.val(this.summaryData.ot.estado)
|
||||
|
||||
Reference in New Issue
Block a user