Merge branch 'main' into 'feat/importador_rama'

Main

See merge request jjimenez/safekat!749
This commit is contained in:
Ignacio Martinez Navajas
2025-04-27 18:56:08 +00:00
59 changed files with 1588 additions and 503 deletions

View File

@ -7,6 +7,8 @@ class MessagesDatatable {
this.datatablePresupuestoMessageItem = this.item.find("#tablePresupuestoMessages")
this.datatablePedidoMessageItem = this.item.find("#tablePedidoMessages")
this.datatableFacturaMessageItem = this.item.find("#tableFacturaMessages")
this.datatableOtMessageItem = this.item.find("#tableOtMessages")
this.focusTable = this.datatableItem
this.columnDefs = [
]
@ -131,6 +133,25 @@ class MessagesDatatable {
columns: this.datatableColumns,
ajax: '/messages/datatable/factura'
});
this.datatableOtMessage = this.datatableOtMessageItem.DataTable({
processing: true,
order: [[1, 'desc']],
columnDefs : this.columnDefs,
orderCellsTop : true,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
pageLength: 10,
language: {
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
},
columns: this.datatableColumns,
ajax: '/messages/datatable/ots'
});
this.datatablePresupuestoMessageItem.on("keyup", ".datatable-message-filter", (event) => {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatablePresupuestoMessage.column(columnIndex).search($(event.currentTarget).val()).draw()
@ -143,6 +164,10 @@ class MessagesDatatable {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatableFacturaMessage.column(columnIndex).search($(event.currentTarget).val()).draw()
})
this.datatableOtMessageItem.on("keyup", ".datatable-message-filter", (event) => {
let columnIndex = this.datatableColumns.findIndex((element) => element.data == $(event.currentTarget).attr("name"))
this.datatableFacturaMessage.column(columnIndex).search($(event.currentTarget).val()).draw()
})
}

View File

@ -79,10 +79,14 @@ class MaquinistaTareaView {
}
handleUpdateClickInputSucess(response) {
popSuccessAlert(response.message)
this.updateContentClick(response.data.click_end - response.data.click_init)
}
handleUpdateClickInputError(error) {
popErrorAlert(error)
}
updateContentClick(clicks){
this.item.find('#clicks-info').empty().html(clicks)
}
handleDeleteTareaProgress() {
let ajax = new Ajax('/produccion/ordentrabajo/tarea/progress/' + this.tareaId,
null,
@ -194,6 +198,17 @@ class MaquinistaTareaView {
}
})
}
getTarea(tarea_id) {
return new Promise((resolve, reject) => {
let ajax = new Ajax(`/produccion/ordentrabajo/tarea/${tarea_id}`, null, null, (response) => {
resolve(response)
},
(error) => {
resolve(error)
})
ajax.get()
})
}
}

View File

@ -54,6 +54,10 @@ class MessagePage {
this.messageDatatable.datatableFacturaMessage.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatableFacturaMessageItem
})
$("#navs-top-align-ot-tab").on("click",()=>{
this.messageDatatable.datatableOtMessage.ajax.reload()
this.messageDatatable.focusTable = this.messageDatatable.datatableOtMessageItem
})
}
openNewMessageModal() {

View File

@ -4,11 +4,14 @@ import ClassSelect from '../../components/select2.js';
$(() => {
let otsFilter = '';
const tipo_envio = $('#tipo_envio').val();
const selectPedidos = new ClassSelect($('#buscadorPedidos'), '/logistica/selectForNewEnvio', "");
const selectPedidos = new ClassSelect($('#buscadorPedidos'), '/logistica/selectForNewEnvio', "", true, {
tipo_envio: () => $('#tipo_envio').val()
});
selectPedidos.init();
const selectDirecciones = new ClassSelect($('#selectDirecciones'), '/logistica/selectDireccionForEnvio', "", true, {
pedido_id: () => selectPedidos.getVal()
ot_id: () => selectPedidos.getVal()
});
selectDirecciones.init();
@ -19,7 +22,10 @@ $(() => {
})
selectPedidos.item.on('change', () => {
selectDirecciones.empty();
$('.select-direcciones').removeClass('d-none');
if(tipo_envio == 'ferro_prototipo')
$('.add-envio').removeClass('d-none');
else
$('.select-direcciones').removeClass('d-none');
})
selectDirecciones.item.on('select2:open', () => {
$('.add-envio').addClass('d-none');
@ -31,12 +37,24 @@ $(() => {
$('#btnAddEnvio').on('click', () => {
const pedido_id = selectPedidos.getVal();
const direccionSeleccionada = selectDirecciones.getText();
$.post('/logistica/generateEnvio', {
pedido_id: pedido_id,
direccion: direccionSeleccionada
}, function (response) {
let url = '';
let data = {};
if(tipo_envio == 'ferro_prototipo'){
url = '/logistica/generateEnvioFerro';
data = {
ot_id: selectPedidos.getVal()
};
}
else{
url = '/logistica/generateEnvio';
data = {
ot_id: selectPedidos.getVal(),
direccion: selectDirecciones.getText()
};
}
$.post(
url,
data, function (response) {
if (response.status) {
window.open(`${window.location.origin}/logistica/envio/${response.data.id_envio}`);
selectDirecciones.empty();
@ -51,7 +69,7 @@ $(() => {
});
})
const tableEnvios = $('#tableOfEnvios').DataTable({
processing: true,
serverSide: true,
@ -66,6 +84,7 @@ $(() => {
"url": "/logistica/datatableEnvios",
"data": function (d) {
d.otsFilter = otsFilter;
d.tipo_envio = $('#tipo_envio').val();
}
},
"columns": [

View File

@ -235,9 +235,35 @@ class DatosLibro {
if (this.ferro.prop('checked')) {
$(document).trigger('add-servicio-lineas', 'ferro');
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: false,
update_tiradas_alternativas: false
});
}
else {
$(document).trigger('remove-servicio-lineas', 'ferro');
if(!this.prototipo.prop('checked')){
const table = $('#tableOfDireccionesEnvio').DataTable();
const rows = table.rows().data();
for (let i = 0; i < rows.length; i++) {
const rowData = rows[i];
if (rowData.is_ferro_prototipo == 1) {
table.rows(i).remove();
table.draw();
break;
}
}
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: true,
update_tiradas_alternativas: true
});
}
}
}
@ -261,9 +287,35 @@ class DatosLibro {
if (this.prototipo.prop('checked')) {
$(document).trigger('add-servicio-lineas', 'prototipo');
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: false,
update_tiradas_alternativas: false
});
}
else {
$(document).trigger('remove-servicio-lineas', 'prototipo');
if(!this.ferro.prop('checked')){
const table = $('#tableOfDireccionesEnvio').DataTable();
const rows = table.rows().data();
for (let i = 0; i < rows.length; i++) {
const rowData = rows[i];
if (rowData.is_ferro_prototipo == 1) {
table.rows(i).remove();
table.draw();
break;
}
}
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
update_envios: true,
update_resumen: true,
update_tiradas_alternativas: true
});
}
}
}

View File

@ -71,6 +71,7 @@ class Envios {
},
{ 'data': 'margen', render: function (data, type, row) { return Math.round(data) } },
{ 'data': 'entregaPieCalle' },
{ 'data': 'is_ferro_prototipo' },
{
data: function (row, type, set, meta) {
return `
@ -87,7 +88,7 @@ class Envios {
orderable: false,
searchable: false,
// all columns
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
targets: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
//targets: [$('#tableOfDireccionesEnvio').find("tr:first th").length - 1]
},
],
@ -97,7 +98,7 @@ class Envios {
drawCallback: function (settings) {
const boolCols = [15];
const boolCols = [15, 16];
for (let coln of boolCols) {
self.table.column(coln, { page: 'current' }).nodes().each(function (cell, i) {
cell.innerHTML = cell.innerHTML == '1' ? '<i class="ti ti-check"></i>' : '';
@ -164,6 +165,19 @@ class Envios {
$('#add_telefono').val(data.telefono)
$('#add_cantidad').val(data.cantidad)
$('#add_entregaPieCalle').prop('checked', data.entregaPieCalle == 1 ? true : false)
$('#dirFerroProto').prop('checked', data.is_ferro_prototipo == 1 ? true : false)
if (data.is_ferro_prototipo == 1) {
$('#add_cantidad').val(1);
$('#add_cantidad').attr('disabled', true);
$('#dirFerroProto').prop('disabled', true);
$('#direccionFerroProto').removeClass('d-none');
}
else {
$('#add_cantidad').attr('disabled', false);
$('#dirFerroProto').prop('disabled', false);
$('#direccionFerroProto').addClass('d-none');
}
self.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
self.direccionesClienteForm.init();
@ -220,6 +234,7 @@ class Envios {
let newAddDialog = $("#addressForm");
this.direccionesClienteForm.setParams({ 'cliente_id': () => $("#clienteId").select2('data')[0].id });
this.direccionesClienteForm.init();
let maximaCantidad = parseInt($('#tirada').val());
$("#add_cantidad").attr("max", maximaCantidad);;
$("#add_cantidad").val(maximaCantidad);
@ -228,16 +243,39 @@ class Envios {
})
let cantidad_total = 0;
let hasFerroPrototipo = false;
$('#tableOfDireccionesEnvio').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) {
let data = this.data();
cantidad_total += parseInt(data.cantidad);
if (data.is_ferro_prototipo == 0)
cantidad_total += parseInt(data.cantidad);
else
hasFerroPrototipo = true;
});
$('#add_cantidad').attr('max-value', parseInt($('#tirada').val()) - cantidad_total);
$('#add_cantidad').val(parseInt($('#tirada').val()) - cantidad_total);
const restante = parseInt($('#tirada').val()) - cantidad_total;
$('#add_cantidad').attr('max-value', restante);
$('#add_cantidad').val(restante > 0 ? restante : 0);
if (hasFerroPrototipo) {
$('#dirFerroProto').prop('checked', false);
$('#direccionFerroProto').addClass('d-none');
$('#add_cantidad').attr('disabled', false);
}
else {
if (restante == 0) {
$('#direccionFerroProto').removeClass('d-none');
$('#dirFerroProto').prop('checked', true);
$('#dirFerroProto').prop('disabled', true);
$('#add_cantidad').attr('disabled', true);
$('#add_cantidad').val(1);
}
}
newAddDialog.modal('show');
}
get_peso_libro() {
var peso_total_libro = 0.0
@ -277,11 +315,12 @@ class Envios {
margen: data.margen,
proveedor: data.proveedor,
proveedor_id: data.proveedor_id,
entregaPieCalle: data.entregaPieCalle
entregaPieCalle: data.entregaPieCalle,
is_ferro_prototipo: data.is_ferro_prototipo,
})
});
})
}
@ -379,11 +418,14 @@ class Envios {
'precio': datos_tarifa.precio.toFixed(2),
'margen': datos_tarifa.margen,
'entregaPieCalle': rowData.entregaPieCalle,
'is_ferro_prototipo': rowData.is_ferro_prototipo,
'actionBtns_direcciones': self.actionBtns_direcciones,
})
.draw();
self.check_unidades_enviadas(null,null);
$(document).trigger('update-presupuesto', {
update_lineas: false,
update_servicios: false,
@ -566,6 +608,7 @@ class Envios {
'precio': tarifa_final.precio,
'margen': tarifa_final.margen,
'entregaPieCalle': $('#add_entregaPieCalle').is(":checked") ? 1 : 0,
'is_ferro_prototipo': $('#dirFerroProto').is(":checked") ? 1 : 0,
'actionBtns_direcciones': `
<span class="edit-add"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit-envio mx-2"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm tiradas-alternativas btn-delete-envio mx-2"></i></a>
@ -673,8 +716,12 @@ class Envios {
}
let cantidad_total = 0
let hasFerroPrototipo = false
this.table.rows().every(function (rowIdx, tableLoop, rowLoop) {
cantidad_total += parseInt(this.data().cantidad)
if (this.data().is_ferro_prototipo == 0)
cantidad_total += parseInt(this.data().cantidad);
else
hasFerroPrototipo = true;
});
const tirada = parseInt($('#tirada').val());
@ -695,7 +742,11 @@ class Envios {
this.insertarEnvio.removeClass('d-none');
return false;
}
this.insertarEnvio.addClass('d-none');
if (($('#ferro').is(':checked') || $('#prototipo').is(':checked')) && !hasFerroPrototipo)
this.insertarEnvio.removeClass('d-none');
else
this.insertarEnvio.addClass('d-none');
$('#alert-envios').html(htmlString);
return true;
}

View File

@ -154,6 +154,7 @@ class OrdenTrabajo {
this.otForm.on("click", ".ot-tarea-comment", this.handleNoteTarea.bind(this))
$("#btn-update-tarea-comment").on("click", this.handleTareaNoteSubmit.bind(this))
this.otForm.on("change", "#ot-comment", this.handleOtComment.bind(this))
$("#btn-update-pliegos").on('click', this.handleUpdatePliegos.bind(this))
this._handleGetData()
this.handleGetPortada()
@ -162,14 +163,9 @@ class OrdenTrabajo {
this.datatableTareas = this.tareasTableItem.DataTable({
processing: true,
paging: false,
layout: {
topStart: 'pageLength',
topEnd: 'search',
bottomStart: 'info',
bottomEnd: 'paging'
},
serverSide: true,
responsive: true,
bFilter: false,
createdRow: this.filterCreatedRow.bind(this),
pageLength: 10,
language: {
@ -236,7 +232,7 @@ class OrdenTrabajo {
}
createSelectMaquinaTarea() {
try {
this.summaryData.tasks.forEach(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)
if (element.presupuesto_acabado_id) this.createSelectMaquinaAcabado(selectItem)
@ -322,7 +318,7 @@ class OrdenTrabajo {
maquinaSelects.reset()
}
}
createSelectImposicion(selectItem) {
async createSelectImposicion(selectItem) {
let imposicionId = selectItem.data("imposicion-id")
let imposicionSelect = new ClassSelect(selectItem, `/imposiciones/select`, "Seleccione una imposición", true);
@ -359,9 +355,11 @@ class OrdenTrabajo {
this.otForm.off("change", ".ot-pedido")
this.otForm.off("change", ".ot-pedido-check")
this.otForm.off("change", ".ot-preview")
this.fillOtDetails()
this.fillOtDates()
this.fillPreimpresionReview()
this.fillPliegos()
this.isOtFinalizada = this.summaryData.ot.estado == "F";
this.datatableTareas.ajax.reload()
} catch (error) {
@ -393,6 +391,15 @@ class OrdenTrabajo {
}
fillPliegos() {
// if (this.summaryData.tareaCosido) {
// const tareaCosido = this.summaryData.tareaCosido
// this.otForm.find('input[name=pliego_1]').val(tareaCosido.pliego_1)
// this.otForm.find('input[name=pliego_1_total]').val(tareaCosido.pliego_1_total)
// this.otForm.find('input[name=pliego_2]').val(tareaCosido.pliego_2)
// this.otForm.find('input[name=pliego_2_total]').val(tareaCosido.pliego_2_total)
// }
}
fillOtDetails() {
const progreso = this.summaryData.ot.progreso
@ -823,6 +830,40 @@ class OrdenTrabajo {
this._handleGetData()
}
getTarea(tarea_id) {
return new Promise((resolve, reject) => {
let ajax = new Ajax(`/produccion/ordentrabajo/tarea/${tarea_id}`, null, null, (response) => {
resolve(response)
},
(error) => {
resolve(error)
})
ajax.get()
})
}
getDataPliegos() {
return {
orden_trabajo_id: this.modelId,
pliego_1: $("#pliegos-1").val(),
pliego_1_total: $("#pliegos-1-total").val(),
pliego_2: $("#pliegos-2").val(),
pliego_2_total: $("#pliegos-2-total").val(),
}
}
handleUpdatePliegos() {
let ajax = new Ajax(`/produccion/ordentrabajo/update/tarea/pliegos`,
this.getDataPliegos(),
null,
(response) => {
alertSuccess(response.message).fire()
},
(error) => {
alertError(error.message).fire()
})
ajax.post()
}
}

View File

@ -1,182 +1,192 @@
@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;
size: A4;
margin: 0;
}
@media print {
body,
html {
width: 210mm;
height: 297mm;
max-width: 210mm;
font-size : 11px;
max-height: 297mm;
background-color: white;
print-color-adjust: exact;
}
/* ... the rest of the rules ... */
}
body{
border: 0px solid;
padding: 10px;
max-width: 210mm;
max-height: 297mm;
background-color : white;
html {
font-family: Arial, sans-serif;
width: 210mm;
height: 297mm;
max-width: 210mm;
font-size: 11px;
max-height: 297mm;
background-color: white;
}
.portada-img{
border-style: solid;
height: 100%;
border: 2px solid;
body {
border: 0px solid;
padding: 10px;
margin : 10px;
max-width: 210mm;
max-height: 297mm;
background-color: white;
}
.square{
align-items: center;
align-content : center;
justify-content: center;
font-weight: bold;
font-size : 14px;
.portada-img {
border-style: solid;
height: 100%;
border: 2px solid;
}
.esquema{
.square {
align-items: center;
align-content: center;
justify-content: center;
font-weight: bold;
font-size: 14px;
}
.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;
.esquema {
}
.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-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{
border-top: 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-inner{
border: 2px solid;
font-size: 25px;
width: 40px;
height: 90px;
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;
}
.esquema-imposicion-wrapper{
.pagina-imposicion-inner {
border: 2px solid;
font-size: 25px;
width: 40px;
height: 90px;
display: flex;
align-items: center;
justify-content: center;
}
.imposicion{
display: flex;
align-items: center;
justify-content: center;
.esquema-imposicion-wrapper {
}
.imposicion {
display: flex;
align-items: center;
justify-content: center;
}
.section-title {
font-weight: bold;
margin-bottom: 10px;
font-weight: bold;
margin-bottom: 10px;
}
.cubierta{
color: #007bff;
.cubierta {
color: #007bff;
}
.encuadernacion{
color: green;
.encuadernacion {
color: green;
}
.impresion{
color: #ff4000;
.impresion {
color: #ff4000;
}
.comments {
color: #555;
font-style: italic;
margin-top: 0.2rem;
color: #555;
font-style: italic;
margin-top: 0.2rem;
}
.comment-content {
line-height: 0;
width: 100%;
height: 50px;
border: solid;
border-width: 1px;
line-height: 0;
width: 100%;
height: 50px;
border: solid;
border-width: 1px;
}
table {
width: 100%;
margin-bottom: 5px;
font-size: 10px;
width: 100%;
margin-bottom: 5px;
font-size: 10px;
}
table td {
text-align: center;
table td {
text-align: center;
}
table,th,td{
border: 0.1px solid rgb(0, 0, 0);
border-collapse: collapse;
table,
th,
td {
border: 0.1px solid rgb(0, 0, 0);
border-collapse: collapse;
}
table th {
background-color: #f4f4f4;
font-weight: bold;
color : black;
text-align: center;
font-weight: bold;
color: black;
text-align: center;
}
table td{
font-weight: bold;
table td {
font-weight: bold;
}
.comments {
color: #555;
font-style: italic;
margin-top: 0.2rem;
color: #555;
font-style: italic;
margin-top: 0.2rem;
}
.t-header{
color: black;
width: 25%;
.t-header {
color: black;
width: 25%;
}
.t-cell{
background-color: white;
color: black;
text-align: start;
padding-left: 0.2rem;
.t-cell {
color: black;
text-align: start;
padding-left: 0.2rem;
}
.t-row{
font-size: 8px;
width : 100%;
.t-row {
font-size: 8px;
width: 100%;
}
.bicolor{
background: linear-gradient( to right, #00b5fc 0%, #00b5fc 45%, #000000 55%, #000000 100%);
color: white;
.bicolor {
background: linear-gradient(
to right,
#00b5fc 0%,
#00b5fc 45%,
#000000 55%,
#000000 100%
);
color: white;
}
.cmyk{
background-image: url('/themes/vuexy/img/safekat/presupuestos/cmyk.png');
background-size: 110px;
color : white;
text-shadow: 0px 0px 2px black;
stroke:white;
.cmyk {
background-image: url("/themes/vuexy/img/safekat/presupuestos/cmyk.png");
background-size: 110px;
color: white;
text-shadow: 0px 0px 2px black;
stroke: white;
}
.bn{
background : black;
color: white;
.bn {
background: black;
color: white;
}
.footer {
font-size: 10px;
}
.bg-encuadernacion {
background-color: #bbd8a3;
}
.encuadernacion th {
color: green;
}
.cell-50 {
width: 50px;
}
.footer{
font-size : 10px
}