mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
ot new features
This commit is contained in:
@ -11,9 +11,9 @@ class MaquinistaTareaList {
|
||||
{ data: 'otId', searchable: false, sortable: false },
|
||||
{ data: 'tareaName', searchable: false, sortable: false },
|
||||
{ data: 'tareaEstado', searchable: false, sortable: false,render : this.renderStado.bind(this)},
|
||||
{ data: 'presupuesto_titulo', searchable: false, sortable: false },
|
||||
{ data: 'papel_impresion', searchable: false, sortable: false },
|
||||
{ data: 'papel_gramaje', searchable: false, sortable: false },
|
||||
// { data: 'presupuesto_titulo', searchable: false, sortable: false },
|
||||
// { data: 'papel_impresion', searchable: false, sortable: false },
|
||||
// { data: 'papel_gramaje', searchable: false, sortable: false },
|
||||
{ data: 'fecha_impresion', searchable: false, sortable: false },
|
||||
{ data: 'action', searchable: false, sortable: false, width: "20rem" },
|
||||
]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
import Ajax from '../../../components/ajax.js'
|
||||
import { alertConfirmAction } from '../../../components/alerts/sweetAlert.js'
|
||||
import { alertConfirmAction, alertError, alertSuccess } from '../../../components/alerts/sweetAlert.js'
|
||||
class MaquinistaTareaView {
|
||||
constructor(domItem) {
|
||||
this.item = domItem
|
||||
@ -84,7 +84,7 @@ class MaquinistaTareaView {
|
||||
handleUpdateClickInputError(error) {
|
||||
popErrorAlert(error)
|
||||
}
|
||||
updateContentClick(clicks){
|
||||
updateContentClick(clicks) {
|
||||
this.item.find('#clicks-info').empty().html(clicks)
|
||||
}
|
||||
handleDeleteTareaProgress() {
|
||||
@ -155,11 +155,13 @@ class MaquinistaTareaView {
|
||||
window.location.href = '/produccion/ordentrabajo/maquinista/maquinas/view'
|
||||
}
|
||||
this.showBasedOnStatus(response.data.status)
|
||||
alertSuccess(response.message, null, { position: 'top' }).fire()
|
||||
}
|
||||
this.actionLoader(false)
|
||||
}
|
||||
handleUpdateTareaProgressError(error) {
|
||||
popErrorAlert(error.error)
|
||||
alertError(error.error, null, { position: 'top' }).fire()
|
||||
this.actionLoader(false)
|
||||
}
|
||||
|
||||
|
||||
@ -28,15 +28,35 @@ class OrdenTrabajo {
|
||||
this.otEstado = this.item.find("#ot-estado");
|
||||
|
||||
this.datatableColumns = [
|
||||
{ data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this), width: "10%" },
|
||||
{ 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', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this) },
|
||||
{ data: 'orden', searchable: true, sortable: true, render: this._renderOrdenTarea.bind(this) },
|
||||
{ data: 'nombre', searchable: true, sortable: true },
|
||||
{
|
||||
data: 'maquina_presupuesto_linea', searchable: true, sortable: true, render: (d) => {
|
||||
if (d) {
|
||||
|
||||
return `
|
||||
<div class="btn-group dropstart">
|
||||
<button class="btn btn-primary btn-xs dropdown-toggle" type="button" data-bs-toggle="dropdown">
|
||||
<i class="ti ti-printer ti-xs"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li> <a class="dropdown-item" href="javascript:void(0);">${d}</a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
`
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
{ data: 'maquina_tarea', searchable: false, sortable: false, render: this._renderMaquinaSelectTable.bind(this), width: "10%" },
|
||||
{ data: 'imposicion', searchable: false, sortable: false, render: this._renderImposicionSelectTable.bind(this), width: "10%" },
|
||||
{ data: 'proveedor', searchable: false, sortable: false, render: this._renderProveedorSelectTable.bind(this), width: "10%" },
|
||||
{ data: 'tiempo_estimado', searchable: false, sortable: false },
|
||||
{ data: 'tiempo_real', searchable: false, sortable: false },
|
||||
{
|
||||
data: 'action', searchable: false, sortable: false, width: "10%", render: this._renderActionCell.bind(this)
|
||||
data: 'action', searchable: false, sortable: false, width: "5%", render: this._renderActionCell.bind(this)
|
||||
},
|
||||
]
|
||||
|
||||
@ -76,27 +96,40 @@ class OrdenTrabajo {
|
||||
this.pendienteFerro = new DatePicker(this.otForm.find("#ot-pendiente-ferro"), option)
|
||||
this.ferroCliente = new DatePicker(this.otForm.find("#ot-ferro-cliente"), option)
|
||||
this.ferroOk = new DatePicker(this.otForm.find("#ot-ferro-ok"), option)
|
||||
this.plakeneTraslucido = new DatePicker(this.otForm.find("#ot-plakene-traslucido"), option)
|
||||
// this.plakeneTraslucido = new DatePicker(this.otForm.find("#ot-plakene-traslucido"), option)
|
||||
this.impresionColor = new DatePicker(this.otForm.find("#ot-impresion-color"), option)
|
||||
this.impresionBN = new DatePicker(this.otForm.find("#ot-impresion-bn"), option)
|
||||
this.cubierta = new DatePicker(this.otForm.find("#ot-cubierta"), option)
|
||||
this.sobrecubierta = new DatePicker(this.otForm.find("#ot-sobrecubierta"), option)
|
||||
this.guarda = new DatePicker(this.otForm.find("#ot-guarda"), option)
|
||||
|
||||
this.portada = new DatePicker(this.otForm.find("#ot-portada"), option)
|
||||
this.plastificadoMate = new DatePicker(this.otForm.find("#ot-plastificado-mate"), option)
|
||||
|
||||
this.plastificado = new DatePicker(this.otForm.find("#ot-plastificado"), option)
|
||||
this.plakene = new DatePicker(this.otForm.find("#ot-plakene"), option)
|
||||
this.retractilado = new DatePicker(this.otForm.find("#ot-retractilado"), option)
|
||||
this.estampado = new DatePicker(this.otForm.find("#ot-estampado"), option)
|
||||
this.uvi = new DatePicker(this.otForm.find("#ot-uvi"), option)
|
||||
|
||||
|
||||
|
||||
this.encuadernacion = new DatePicker(this.otForm.find("#ot-encuadernacion"), option)
|
||||
|
||||
this.entradaManipulado = new DatePicker(this.otForm.find("#ot-manipulado"), option)
|
||||
this.prepGuillotina = new DatePicker(this.otForm.find("#ot-prep-guillotina"), option)
|
||||
|
||||
|
||||
this.prepCosido = new DatePicker(this.otForm.find("#ot-prep-cosido"), option)
|
||||
this.prepGrapado = new DatePicker(this.otForm.find("#ot-prep-grapado"), option)
|
||||
this.prepSolapa = new DatePicker(this.otForm.find("#ot-prep-solapa"), option)
|
||||
|
||||
this.prepPrototipo = new DatePicker(this.otForm.find("#ot-prep-prototipo"), option)
|
||||
// this.prepPrototipo = new DatePicker(this.otForm.find("#ot-prep-prototipo"), option)
|
||||
this.prepMarcapaginas = new DatePicker(this.otForm.find("#ot-prep-marcapaginas"), option)
|
||||
this.prepRetractilado = new DatePicker(this.otForm.find("#ot-prep-retractilado"), option)
|
||||
this.prepRetractilado5 = new DatePicker(this.otForm.find("#ot-prep-retractilado5"), option)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.espiral = new DatePicker(this.otForm.find("#ot-espiral"), option)
|
||||
// this.espiral = new DatePicker(this.otForm.find("#ot-espiral"), option)
|
||||
this.embalaje = new DatePicker(this.otForm.find("#ot-embalaje"), option)
|
||||
this.envio = new DatePicker(this.otForm.find("#ot-envio"), option)
|
||||
|
||||
@ -115,6 +148,7 @@ class OrdenTrabajo {
|
||||
}
|
||||
eventTareas() {
|
||||
this.otForm.on("change", ".select-maquina-tarea-datatable", this.handleTareaChange.bind(this))
|
||||
this.otForm.on("change", ".select-proveedor-tarea-datatable", this.handleUpdateProveedor.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) => {
|
||||
@ -133,6 +167,7 @@ class OrdenTrabajo {
|
||||
unbindEventTareas() {
|
||||
this.otForm.off("change", ".select-maquina-tarea-datatable")
|
||||
this.otForm.off("change", ".select-imposicion-tarea-datatable")
|
||||
this.otForm.off("change", ".select-proveedor-tarea-datatable")
|
||||
this.otForm.off("change", ".orden-tarea")
|
||||
this.otForm.off("click", ".increase-order")
|
||||
this.otForm.off("click", ".decrease-order")
|
||||
@ -208,6 +243,16 @@ class OrdenTrabajo {
|
||||
return render
|
||||
|
||||
}
|
||||
_renderProveedorSelectTable(d, t) {
|
||||
if (d.proveedor) {
|
||||
let render = `<select id="select-proveedor-tarea-${d.tarea.id}" data-proveedor-id="${d.proveedor.id}" data-proveedor-tipo="${d.proveedor.tipo_id}" data-id="${d.tarea.id}" name="proveedor_id" class="select2 form-select select-proveedor-tarea-datatable" ${this.isOtFinalizada ? "disabled" : ""}>
|
||||
<option value="${d.proveedor.id}" selected="selected">${d.proveedor.nombre ?? ''}</option>
|
||||
</select>`
|
||||
return render
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
_renderActionCell(d, t) {
|
||||
|
||||
let cell = `<div class="d-flex justify-content-start align-items-center gap-1">
|
||||
@ -222,7 +267,7 @@ class OrdenTrabajo {
|
||||
|
||||
return `
|
||||
<div class="d-flex justify-content-between aling-items-center gap-2 orden-tarea-cell">
|
||||
<input type="text" style="min-width:5rem" data-id="${d.id}" class="form-control form-control-sm orden-tarea mr-2" name="orden" value="${d.orden}" ${this.isOtFinalizada ? "disabled" : ""}>
|
||||
<input type="text" style="min-width:2rem" data-id="${d.id}" class="form-control form-control-sm orden-tarea mr-2" name="orden" value="${d.orden}" ${this.isOtFinalizada ? "disabled" : ""}>
|
||||
<div class="btn-group-vertical">
|
||||
<button type="button" class="btn btn-primary btn-outlined btn-xs increase-order"><i class="ti ti-chevron-up ti-xs"></i></button>
|
||||
<button type="button" class="btn btn-primary btn-xs decrease-order" data-id="${d.id}"><i class="ti ti-chevron-down ti-xs"></i></button>
|
||||
@ -232,6 +277,10 @@ class OrdenTrabajo {
|
||||
}
|
||||
createSelectMaquinaTarea() {
|
||||
try {
|
||||
$('.select-proveedor-tarea-datatable').each((index, element) => {
|
||||
console.log(element)
|
||||
this.createSelectProveedor($(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)
|
||||
@ -262,6 +311,7 @@ class OrdenTrabajo {
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} finally {
|
||||
this.eventTareas()
|
||||
|
||||
@ -270,7 +320,7 @@ class OrdenTrabajo {
|
||||
}
|
||||
createSelectMaquinaAcabado(selectItem) {
|
||||
let maquina_id = selectItem.data("maquina-id")
|
||||
let maquinaSelects = new ClassSelect(selectItem, `/tarifas/maquinas/acabado/select`, "Seleccione una maquina", true);
|
||||
let maquinaSelects = new ClassSelect(selectItem, `/tarifas/maquinas/acabado/select`, "Seleccione un máquina", true);
|
||||
maquinaSelects.init();
|
||||
if (maquina_id) {
|
||||
maquinaSelects.setVal(maquina_id)
|
||||
@ -278,6 +328,24 @@ class OrdenTrabajo {
|
||||
maquinaSelects.reset()
|
||||
}
|
||||
}
|
||||
createSelectProveedor(selectItem) {
|
||||
try {
|
||||
|
||||
|
||||
let proveedor_id = selectItem.data("proveedor-id")
|
||||
let tipo = selectItem.data("proveedor-tipo")
|
||||
let proveedorSelect = new ClassSelect(selectItem, `/compras/proveedores/getProveedores`, "Seleccione una proveedor", true, { tipo_id: tipo }, this.tareasTableItem);
|
||||
proveedorSelect.init();
|
||||
if (proveedor_id) {
|
||||
proveedorSelect.setVal(proveedor_id)
|
||||
} else {
|
||||
proveedorSelect.reset()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
}
|
||||
}
|
||||
createSelectMaquinaManipulado(selectItem) {
|
||||
let maquina_id = selectItem.data("maquina-id")
|
||||
let maquinaSelects = new ClassSelect(selectItem, `/tarifas/maquinas/manipulado/select`, "Seleccione una maquina", true);
|
||||
@ -416,21 +484,33 @@ class OrdenTrabajo {
|
||||
this.ferroCliente.setDate(this.summaryData.dates.ferro_en_cliente_at)
|
||||
this.ferroOk.setDate(this.summaryData.dates.ferro_ok_at)
|
||||
// this.plakeneTraslucido.setDate(this.summaryData.dates.fecha_impresion_at)
|
||||
this.impresionColor.setDate(this.summaryData.dates.interior_color_at)
|
||||
/**IMPRESION */
|
||||
this.impresionBN.setDate(this.summaryData.dates.interior_bn_at)
|
||||
this.portada.setDate(this.summaryData.dates.cubierta_at)
|
||||
this.plastificadoMate.setDate(this.summaryData.dates.plastificado_at)
|
||||
this.impresionColor.setDate(this.summaryData.dates.interior_color_at)
|
||||
this.cubierta.setDate(this.summaryData.dates.cubierta_at)
|
||||
this.sobrecubierta.setDate(this.summaryData.dates.sobrecubierta_at)
|
||||
this.guarda.setDate(this.summaryData.dates.guarda_at)
|
||||
/**ACABADO */
|
||||
this.plastificado.setDate(this.summaryData.dates.plastificado_at)
|
||||
this.plakene.setDate(this.summaryData.dates.plakene_at)
|
||||
this.retractilado.setDate(this.summaryData.dates.retractilado_at)
|
||||
this.estampado.setDate(this.summaryData.dates.estampado_at)
|
||||
this.uvi.setDate(this.summaryData.dates.uvi_at)
|
||||
/** ENCUADERNACION */
|
||||
this.encuadernacion.setDate(this.summaryData.dates.encuadernacion_at)
|
||||
|
||||
this.prepGuillotina.setDate(this.summaryData.dates.corte_at)
|
||||
this.prepCosido.setDate(this.summaryData.dates.cosido_at)
|
||||
this.prepSolapa.setDate(this.summaryData.dates.solapa_at)
|
||||
this.prepGrapado.setDate(this.summaryData.dates.grapado_at)
|
||||
|
||||
this.prepPrototipo.setDate(this.summaryData.dates.prototipo_at)
|
||||
this.entradaManipulado.setDate(this.summaryData.dates.entrada_manipulado_at)
|
||||
|
||||
// this.prepCosido.setDate(this.summaryData.dates.cosido_at)
|
||||
// this.prepSolapa.setDate(this.summaryData.dates.solapa_at)
|
||||
// this.prepGrapado.setDate(this.summaryData.dates.grapado_at)
|
||||
|
||||
// this.prepPrototipo.setDate(this.summaryData.dates.prototipo_at)
|
||||
this.prepMarcapaginas.setDate(this.summaryData.dates.marcapaginas_at)
|
||||
this.prepRetractilado.setDate(this.summaryData.dates.retractilado_at)
|
||||
this.prepRetractilado5.setDate(this.summaryData.dates.retractilado5_at)
|
||||
|
||||
this.espiral.setDate(this.summaryData.dates.fecha_impresion_at)
|
||||
// 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);
|
||||
@ -865,6 +945,24 @@ class OrdenTrabajo {
|
||||
ajax.post()
|
||||
}
|
||||
|
||||
handleUpdateProveedor(event) {
|
||||
let orden_trabajo_tarea_id = $(event.currentTarget).data('id')
|
||||
let actualValue = $(event.currentTarget).val()
|
||||
let ajax = new Ajax(`/produccion/ordentrabajo/update/tarea/proveedor`,
|
||||
{
|
||||
orden_trabajo_tarea_id: orden_trabajo_tarea_id,
|
||||
proveedor_id: actualValue
|
||||
},
|
||||
null,
|
||||
(response) => {
|
||||
alertSuccess(response.message).fire()
|
||||
},
|
||||
(error) => {
|
||||
alertError(error.message).fire()
|
||||
})
|
||||
ajax.post()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,5 +5,5 @@
|
||||
font-size : 20px;
|
||||
}
|
||||
.table-maquinista td{
|
||||
height : 10rem;
|
||||
height : 7rem;
|
||||
}
|
||||
Reference in New Issue
Block a user