mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'main' of https://git.imnavajas.es/jjimenez/safekat
This commit is contained in:
@ -14,6 +14,7 @@ class MaquinistaTareaView {
|
||||
this.tareaCardClass = '.tarea-card-action-block'
|
||||
this.inputClick = $('.ot-tarea-click')
|
||||
this.btnPrintLabels = this.item.find('#btn-print-labels')
|
||||
this.btnFicharEmbalaje = this.item.find('#btn-fichar-embalaje')
|
||||
}
|
||||
init() {
|
||||
this.actionButtons.on('click', this.eventActionButton.bind(this))
|
||||
@ -22,6 +23,7 @@ class MaquinistaTareaView {
|
||||
this.handleGetTareaProgress();
|
||||
this.inputClick.on('input', this.handleUpdateClickInput.bind(this))
|
||||
this.btnPrintLabels.on('click', this.handlePrintLabels.bind(this))
|
||||
this.btnFicharEmbalaje.on('click', this.handleFicharEmbalaje.bind(this))
|
||||
}
|
||||
|
||||
eventActionButton(event) {
|
||||
@ -301,6 +303,51 @@ class MaquinistaTareaView {
|
||||
});
|
||||
}
|
||||
|
||||
handleFicharEmbalaje() {
|
||||
const ot_id = [$('#otId').html()];
|
||||
$.post('/logistica/ficharEmbalaje', {
|
||||
ids: ot_id,
|
||||
}, function (response) {
|
||||
if (response.status) {
|
||||
Swal.fire({
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: response.message,
|
||||
icon: 'error',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
table.ajax.reload();
|
||||
}
|
||||
}).fail(() => {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: 'No se pudo realizar el fichaje.',
|
||||
icon: 'error',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
table.ajax.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default MaquinistaTareaView;
|
||||
@ -49,7 +49,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
|
||||
Swal.close();
|
||||
Swal.fire('Éxito', `${xmlFiles.length} archivos XML cargados.`, 'success');
|
||||
Swal.fire('Éxito', `${xmlFiles.length} archivos XML detectados, proceda a la importación.`, 'success');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
Swal.fire('Error', 'No se pudo procesar el ZIP.', 'error');
|
||||
|
||||
@ -7,6 +7,7 @@ class EnvioEdit {
|
||||
constructor() {
|
||||
this.tableCols = [
|
||||
{ data: "rowSelected" },
|
||||
{ data: "ordenTrabajo" },
|
||||
{ data: "pedido" },
|
||||
{ data: "presupuesto" },
|
||||
{ data: "titulo" },
|
||||
@ -19,6 +20,7 @@ class EnvioEdit {
|
||||
];
|
||||
|
||||
this.table = null;
|
||||
this.tableProximosEnvios = null;
|
||||
|
||||
this.buscarPedidos = new ClassSelect($("#buscadorPedidos"), '/logistica/selectAddLinea', "", true, { 'envio': $("#id").val() });
|
||||
|
||||
@ -84,16 +86,56 @@ class EnvioEdit {
|
||||
"searchable": false,
|
||||
},
|
||||
{
|
||||
"targets": [1, 2, 4, 5, 6],
|
||||
"targets": [1, 2, 4, 5, 6, 7],
|
||||
"className": "text-center",
|
||||
},
|
||||
{
|
||||
targets: [7, 8, 9],
|
||||
targets: [8, 9, 10],
|
||||
visible: false
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.tableProximosEnvios = $('#tableProximosEnvios').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
autoWidth: true,
|
||||
responsive: true,
|
||||
scrollX: true,
|
||||
orderCellsTop: true,
|
||||
orderable: false,
|
||||
order: [[1, 'asc']],
|
||||
lengthMenu: [5, 10, 25, 50, 75, 100, 250, 500, 1000, 2500],
|
||||
pageLength: 5,
|
||||
"dom": 'tp',
|
||||
"ajax": {
|
||||
"url": "/logistica/datatableProximosEnvios/" + $('#id').val(),
|
||||
},
|
||||
"columns": [
|
||||
{data: 'ot'},
|
||||
{data: 'fechaEncuadernado'}
|
||||
],
|
||||
"language": {
|
||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||
},
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": [0, 1],
|
||||
"className": "text-center",
|
||||
},
|
||||
],
|
||||
drawCallback: function(){
|
||||
$(this.api().table().container()).find('table').css('width', '100%');
|
||||
this.api().columns.adjust();
|
||||
}
|
||||
});
|
||||
|
||||
$('#proximosEnviosTip' + this.id).on('shown.bs.collapse', () => {
|
||||
if (this.tableProximosEnvios) {
|
||||
this.tableProximosEnvios.columns.adjust().draw(false);
|
||||
}
|
||||
});
|
||||
|
||||
$('#btnImprimirEtiquetas').on('click', () => {
|
||||
const table = this.table;
|
||||
const selectedRows = table.rows({ page: 'current' }).nodes().filter((node) => {
|
||||
@ -121,7 +163,7 @@ class EnvioEdit {
|
||||
}
|
||||
const idEnvio = $('#id').val();
|
||||
let num_cajas = this.cajas.val();
|
||||
if(ids.length != table.rows().count()){
|
||||
if (ids.length != table.rows().count()) {
|
||||
// se preguntará el numero de cajas en un swal con un input para obtener el valor
|
||||
Swal.fire({
|
||||
title: 'Atención!',
|
||||
@ -146,7 +188,7 @@ class EnvioEdit {
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this._imprimirEtiquetas(idEnvio, ids, num_cajas);
|
||||
}
|
||||
});
|
||||
@ -485,9 +527,14 @@ class EnvioEdit {
|
||||
});
|
||||
});
|
||||
|
||||
$('#ficharEmbalaje').on('click', (e) => {
|
||||
this._ficharEmbalajeLineas();
|
||||
});
|
||||
|
||||
this._getAlbaranes();
|
||||
}
|
||||
|
||||
|
||||
_imprimirEtiquetas(envio_id, ids, num_cajas) {
|
||||
|
||||
$.post('/logistica/imprimirEtiquetas', {
|
||||
@ -510,7 +557,7 @@ class EnvioEdit {
|
||||
},
|
||||
buttonsStyling: false
|
||||
}).then(() => {
|
||||
if(response.data){
|
||||
if (response.data) {
|
||||
// show xml in a new tab
|
||||
const blob = new Blob([response.data], { type: 'application/xml' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
@ -520,7 +567,7 @@ class EnvioEdit {
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
a.remove();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -671,6 +718,95 @@ class EnvioEdit {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
_ficharEmbalajeLineas() {
|
||||
const table = this.table;
|
||||
const selectedRows = table.rows({ page: 'current' }).nodes().filter((node) => {
|
||||
const checkbox = $(node).find('.checkbox-linea-envio');
|
||||
return checkbox.is(':checked');
|
||||
});
|
||||
const ids = selectedRows.map((node) => {
|
||||
const rowData = table.row(node).data();
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(rowData.ordenTrabajo, 'text/html');
|
||||
return doc.body.textContent.trim(); // extrae solo el texto dentro del <a>
|
||||
}).toArray();
|
||||
|
||||
if (ids.length > 0) {
|
||||
Swal.fire({
|
||||
title: 'Fichar embalaje',
|
||||
text: '¿Está seguro de fichar el embalaje de las líneas seleccionadas?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: 'Sí',
|
||||
cancelButtonText: 'Cancelar',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-danger me-1',
|
||||
cancelButton: 'btn btn-secondary'
|
||||
},
|
||||
buttonsStyling: false
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.post('/logistica/ficharEmbalaje', {
|
||||
ids: ids
|
||||
}, function (response) {
|
||||
if (response.status) {
|
||||
Swal.fire({
|
||||
text: response.message,
|
||||
icon: 'success',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: response.message,
|
||||
icon: 'error',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
table.ajax.reload();
|
||||
}
|
||||
}).fail(() => {
|
||||
Swal.fire({
|
||||
title: 'Error',
|
||||
text: 'No se pudo realizar el fichaje.',
|
||||
icon: 'error',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
table.ajax.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: 'Sin filas seleccionadas',
|
||||
text: 'Marca al menos una línea para eliminarla.',
|
||||
icon: 'info',
|
||||
confirmButtonColor: '#3085d6',
|
||||
confirmButtonText: 'Ok',
|
||||
customClass: {
|
||||
confirmButton: 'btn btn-primary me-1',
|
||||
},
|
||||
buttonsStyling: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_deleteLineas() {
|
||||
const table = this.table;
|
||||
const selectedRows = table.rows({ page: 'current' }).nodes().filter((node) => {
|
||||
|
||||
Reference in New Issue
Block a user