mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
terminado envio de ferros
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user