terminando a falta del listado añadir etiquetas

This commit is contained in:
2025-05-03 12:06:25 +02:00
parent 746955c3b1
commit 71e70bf551
14 changed files with 605 additions and 6 deletions

View File

@ -0,0 +1,73 @@
import ClassSelect from '../../components/select2.js';
$(() => {
const selectOts = new ClassSelect($('#buscadorPedidos'), '/etiquetasTitulos/otList', "", true);
selectOts.init();
const selectDirecciones = new ClassSelect($('#selectDirecciones'), '/etiquetasTitulos/addList', "", true, {
ot_id: () => selectOts.getVal()
});
selectDirecciones.init();
selectOts.item.on('select2:open', () => {
$('.select-direcciones').addClass('d-none');
$('.add-etiqueta').addClass('d-none');
})
selectOts.item.on('change', () => {
selectDirecciones.empty();
$('.add-etiqueta').addClass('d-none');
$('.select-direcciones').removeClass('d-none');
})
selectDirecciones.item.on('select2:open', () => {
$('.add-etiqueta').addClass('d-none');
})
selectDirecciones.item.on('change', () => {
$('.add-etiqueta').removeClass('d-none');
})
$('#btnAddEtiqueta').on('click', () => {
Swal.fire({
title: 'Unidades por caja',
text: 'Seleccione la cantidad de unidades por caja',
icon: 'info',
input: 'text',
inputLabel: 'Unidades/caja',
inputValue: 0,
showCancelButton: true,
confirmButtonColor: '#3085d6',
confirmButtonText: 'Aceptar',
cancelButtonText: 'Cancelar',
customClass: {
confirmButton: 'btn btn-primary me-1',
cancelButton: 'btn btn-secondary'
},
buttonsStyling: false
}).then((result) => {
if (result.isConfirmed) {
const unidades_caja = result.value;
const url = '/etiquetasTitulos/newEtiquetaTitulos';
const data = {
ot_id: selectOts.getVal(),
direccion: selectDirecciones.getText(),
unidades_caja: unidades_caja
};
$.post(
url,
data,
function (response) {
if (response.status) {
// OK
} else {
popErrorAlert('Error en la respuesta');
}
}
).fail(function (xhr, status, error) {
popErrorAlert(error);
});
}
});
})
})