mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminando a falta del listado añadir etiquetas
This commit is contained in:
@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user