solucionado el problema con el id en clientes

This commit is contained in:
2024-04-12 11:59:55 +02:00
parent 2b5f33db5d
commit 72831b248b
2 changed files with 651 additions and 7 deletions

View File

@ -718,6 +718,13 @@ $(document).on('click', '.btn-remove', function(e) {
}
});
// funcion para obtener el cliente id de la url
function getId(){
var url = window.location.href;
var parts = url.split("/");
return parts[parts.length-1];
}
<?=$this->endSection() ?>
@ -768,11 +775,11 @@ $(document).on('click', '.btn-remove', function(e) {
editor.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['cliente_id'] = id;
d.data[0]['cliente_id'] = getId();
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['cliente_id'] = id;
d.data[v]['cliente_id'] = getId();
}
}
});
@ -848,7 +855,7 @@ $(document).on('click', '.btn-remove', function(e) {
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfClienteContactos') ?>',
data: {
id_cliente: id,
id_cliente: getId(),
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
@ -1012,11 +1019,11 @@ $(document).on('click', '.btn-remove', function(e) {
editorPrecios.on( 'preSubmit', function ( e, d, type ) {
if ( type === 'create'){
d.data[0]['cliente_id'] = id;
d.data[0]['cliente_id'] = getId();
}
else if(type === 'edit' ) {
for (v in d.data){
d.data[v]['cliente_id'] = id;
d.data[v]['cliente_id'] = getId();
}
}
});
@ -1076,7 +1083,7 @@ $(document).on('click', '.btn-remove', function(e) {
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfClienteprecios') ?>',
data: {
cliente_id: id,
cliente_id: getId(),
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
@ -1366,7 +1373,7 @@ var tableDirecciones = $('#tableOfDireccionesEnvio').DataTable( {
ajax : $.fn.dataTable.pipeline( {
url: '<?= route_to('dataTableOfClienteDirecciones') ?>',
data: function ( d ) {
d.cliente_id = id;
d.cliente_id = getId();
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},