imposiciones

This commit is contained in:
amazuecos
2025-04-12 23:53:48 +02:00
parent 41159d1588
commit ba9c4dc339
19 changed files with 293 additions and 453 deletions

View File

@ -14,11 +14,14 @@ class OrdenTrabajoDatatable {
{ data: 'cliente_nombre', searchable: false, sortable: false },
{ data: 'presupuesto_titulo', searchable: false, sortable: false },
{ data: 'ubicacion_nombre', searchable: false, sortable: false },
{ data: 'total_tirada', searchable: false, sortable: false ,render : (d) => `<span class="autonumeric">${d}</span>`},
{ data: 'total_tirada', searchable: false, sortable: false, render: (d) => `<span class="autonumeric">${d}</span>` },
{ data: 'tipo_presupuesto_impresion', searchable: false, sortable: false },
{
data: 'logo', searchable: false, sortable: false, render: (d, t) => {
return `<img src="${d}" width="30px" height="30px" alt="logo-impresion" />`
return `<div class="logo-container">
<img class="d-block" src="${d.logo}" width="45px" height="45px" alt="logo-impresion" />
${d.imposicion ? `<span class="imposicion-overlay-image">${d.imposicion ?? ""}</span>` : ''}
</div>`
}
},
{
@ -50,7 +53,7 @@ class OrdenTrabajoDatatable {
bottomStart: 'info',
bottomEnd: 'paging'
},
columnDefs : [
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
serverSide: true,
@ -71,7 +74,7 @@ class OrdenTrabajoDatatable {
bottomStart: 'info',
bottomEnd: 'paging'
},
columnDefs : [
columnDefs: [
{ className: 'dt-center', targets: '_all' },
],
serverSide: true,

View File

@ -1,12 +1,12 @@
$(() => {
console.log("PDF")
var opt = {
margin: 2,
filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf",
image: { type: 'jpeg', quality: 1 },
html2canvas: { scale: 3 },
jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
};
let elementToPdf = $('body')[0]
html2pdf().set(opt).from(elementToPdf).save()
// console.log("PDF")
// var opt = {
// margin: 2,
// filename: "PDF_OrdenTrabajo_" + $(".pdf-wrapper").data("id") + ".pdf",
// image: { type: 'jpeg', quality: 1 },
// html2canvas: { scale: 3 },
// jsPDF: { unit: 'mm', format: 'a4', orientation: 'portrait' }
// };
// let elementToPdf = $('body')[0]
// html2pdf().set(opt).from(elementToPdf).save()
})

View File

@ -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)

View File

@ -0,0 +1,17 @@
.imposicion-overlay-image
{
position: absolute;
top: 75%;
left: 25%;
transform: translate(-10%, -10%);
background-color:rgb(255, 255, 255);
color: black;
font-size: 11px;
text-align: center;
border : 1px solid;
}
.logo-container{
position: relative;
display: inline-block;
}

View File

@ -1,348 +0,0 @@
@page {
size: A4;
margin: 0;
}
@media print {
body,html {
width: 210mm;
height: 297mm;
max-width: 210mm;
max-height: 297mm;
print-color-adjust: exact;
}
/* ... the rest of the rules ... */
}
html {
font-family: Arial, sans-serif;
width: 210mm;
height: 297mm;
max-width: 210mm;
font-size : 11px;
max-height: 297mm;
background-color: #f9f9f9;
}
body{
border: 0px solid;
padding: 20px;
max-width: 210mm;
max-height: 297mm;
}
.cubierta{
color: #007bff;
}
.encuadernacion{
color: green;
}
.impresion{
color: #ff4000;
}
.container {
width: 100%;
width: 210mm;
height: 297mm;
background: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border: 2px solid;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
}
.cover{
display: flex;
justify-content: start;
align-items: center;
gap: 10px;
margin-top: 10px;
margin-bottom: 10px;
}
.portada-info{
display: flex;
flex-direction: column;
width: 100%;
}
.impresion-tipo-row{
display: flex;
align-items: center;
justify-items: center;
justify-content: end;
width: 100%;
height: 5mm;
margin: 2px;
}
.portada-row{
display: flex;
align-items: center;
justify-items: center;
justify-content: space-between;
background-color: #4ba0fccc;
width: 100%;
height: 5mm;
border: solid 2px;
margin: 2px;
border-color: black;
}
.portada-row-2{
display: flex;
align-items: center;
justify-items: center;
width: 100%;
height: 35mm;
margin: 2px;
border: 2px solid;
border-color: black;
}
.portada{
height: 40mm;
}
.presupuesto-title{
color: #007bff;
font-size: medium;
line-height: 0;
}
.pl-2{
padding-left: 0.5rem;
}
.pr-2{
padding-right: 0.5rem;
}
.pt-2{
padding-top: 0.5rem;
}
.flex-row{
display: flex;
width: 100%;
justify-content: start;
align-items: flex-start;
}
.date{
padding-left: 0.5rem;
padding-top: 0px;
width: 100%;
line-height: 0px;
stroke-width: 5px;
font-size: medium;
}
#presupuesto-section{
width: 100%;
}
.flex-col{
display: flex;
padding: 0;
flex-direction: column;
}
.cliente-title{
color: red;
font-size: medium;
stroke-width: 10px;
line-height: 0px;
}
.header .title {
font-size: 24px;
font-weight: bold;
color: #333;
}
.section {
margin-top: 0.5rem;
border-top: 1px solid #ddd;
padding-top: 0.2rem;
}
.section-title {
font-weight: bold;
margin-bottom: 10px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 5px;
font-size: 12px;
}
table th, table td {
border: 2px solid #000000;
text-align: center;
}
table th {
background-color: #f4f4f4;
font-weight: bold;
}
table td{
font-weight: bold;
}
.comments {
color: #555;
font-style: italic;
margin-top: 0.2rem;
}
.comment-content {
line-height: 0;
width: 100%;
height: 50px;
border: solid;
border-width: 1px;
}
.footer {
text-align: center;
margin-top: 0.5rem;
font-size: 14px;
color: #777;
}
.row-logo-impresion{
text-align: center;
}
.portada-img{
border: black;
border-style: solid;
border-width: 2px;
height: 40mm;
width: 100px;
max-width: 30mm;
border: 2px solid;
border-color: black;
border-radius: 5%;
}
.portada-text{
color: white;
}
.t-header{
color: black;
width: 25%;
}
.t-cell{
background-color: white;
color: black;
text-align: start;
padding-left: 0.2rem;
}
.t-row{
font-size: 10px;
}
.esquema{
display: flex;
justify-content:flex-end;
width: 100%;
justify-items: flex-end;
}
.pagina-imposicion-outer-start{
border-top: 2px solid;
border-left: 2px solid;
border-bottom: 2px solid;
width: 50px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.pagina-imposicion-outer-end{
border-top: 2px solid;
border-right: 2px solid;
border-bottom: 2px solid;
width: 50px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.pagina-imposicion-outer{
border-top: 2px solid;
border-bottom: 2px solid;
width: 50px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.pagina-imposicion-inner{
border: 2px solid;
font-size: 25px;
width: 40px;
height: 90px;
display: flex;
align-items: center;
justify-content: center;
}
.square-wrapper{
display: grid;
grid-template-columns: repeat(2,1fr);
margin-left: 5px;
}
.square{
width: 100px;
height: 50px;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.cod{
width: 150px;
height: 100px;
display: flex;
flex-direction: column;
background-color: orange;
margin-left : 20px;
color: white;
align-items: center;
justify-content: space-between;
font-weight: bold;
}
.cod-code{
font-weight: bold;
color: white;
}
.esquema-imposicion-wrapper{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-left: 2rem;
gap: 10px;
}
.imposicion{
display: flex;
align-items: center;
justify-content: center;
width: 200px;
}
.imposicion td{
font-size: large;
}
.cod-barras{
width: 150px;
height: 80px;
text-align : center;
background-color: white;
align-content: center;
}
.cod-barras img {
padding : 1px;
}
.bg-white{
background-color: white;
color: black;
}
.bg-red{
background-color: red;
color: white;
}
.bg-gray{
background-color: gray;
color:white
}
.bg-blue{
background-color: blue;
color: white;
}