add block ui and file zone

This commit is contained in:
amazuecos
2025-04-06 05:59:23 +02:00
parent 4fb6533926
commit ccfc78ed0d

View File

@ -4,11 +4,11 @@ import DatePicker from "../../components/datepicker.js";
import { alertConfirmationDelete, alertSuccess } from "../../components/alerts/sweetAlert.js";
import Modal from "../../components/modal.js"
import FileUploadDropzone from '../../components/forms/fileUploadDropzone.js';
class OrdenTrabajo {
constructor(domItem) {
this.item = domItem
this.otForm = this.item.find("#ot-edit-form")
this.block = document.querySelector('.section-block');
this.modelId = this.item.data("id");
this.tareasTableItem = this.item.find("#ot-task-table");
this.tareasId = []
@ -17,6 +17,10 @@ class OrdenTrabajo {
this.alertOrdenTrabajo = this.item.find("#alert-orden-trabajo");
this.btnFinalizarPedido = this.item.find("#btn-finalizar-orden-pedido")
this.btnResetTareas = this.item.find("#btn-reset-tareas")
this.pedidoEnEsperaCheck = this.item.find("#ot-pedido-espera");
this.pedidoEnEsperaBy = this.item.find("#pedido_espera_by");
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%" },
@ -153,6 +157,7 @@ class OrdenTrabajo {
return data
}
_handleGetData() {
Notiflix.Block.circle('.section-block');
const ajax = new Ajax(`/produccion/ordentrabajo/summary/${this.modelId}`,
null,
null,
@ -282,11 +287,14 @@ class OrdenTrabajo {
} finally {
this.otForm.on("change", ".ot-date", this.handleDateChange.bind(this))
this.otForm.on("change", ".ot-preview", this.handlePreimpresionReviewChange.bind(this))
Notiflix.Block.remove('.section-block');
}
}
handleSummaryError(error) { }
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)
@ -298,6 +306,7 @@ class OrdenTrabajo {
this.otForm.find("[name=realizar_imposicion]").prop("checked", this.summaryData.ot.realizar_imposicion)
this.otForm.find("[name=enviar_impresion]").prop("checked", this.summaryData.ot.enviar_impresion)
}
fillOtDetails() {
const progreso = this.summaryData.ot.progreso
@ -324,6 +333,14 @@ 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.pedidoEnEsperaBy.text("");
}
this.otEstado.val(this.summaryData.ot.estado)
}
@ -372,12 +389,15 @@ class OrdenTrabajo {
},
null,
(response) => {
this._handleGetData();
alertSuccess(response.message).fire()
},
null
)
ajax.post();
}
handleDateChange(event) {
const key = $(event.currentTarget).attr("name")
const data = {}
@ -399,6 +419,7 @@ class OrdenTrabajo {
handleDateChangeSuccess(formItem, response) {
formItem.addClass("is-valid")
alertSuccess(response.message).fire()
this._handleGetData();
if (response.user) {
formItem.parent().find(".form-text").remove()
formItem.parent().append(`<div class="form-text">${[response.user.first_name, response.user.last_name].join(" ")}</div>`)
@ -421,6 +442,7 @@ class OrdenTrabajo {
}
handlePreimpresionReviewChangeSuccess(response) {
this._handleGetData();
alertSuccess(response.message).fire()
}