arreglado que sólo se podia duplicar presupuestos con rotativas

This commit is contained in:
2024-04-05 13:44:26 +02:00
parent 15b59d75f9
commit e5a5071a6b

View File

@ -84,14 +84,16 @@
}
})
const domain = window.location.origin
const url = window.location.href;
const url_parts = url.split('/');
var id = -1;
if(url_parts[url_parts.length-2] == 'edit'){
id = url_parts[url_parts.length-1];
}
if(gotaNegro){
const domain = window.location.origin
const url = window.location.href;
const url_parts = url.split('/');
var id = -1;
if(url_parts[url_parts.length-2] == 'edit'){
id = url_parts[url_parts.length-1];
}
asyncMessageDialog('<?= lang("Basic.global.Warning") ?>', '<?= lang("Presupuestos.duplicarConTipologias") ?>', function() {
$.ajax({
type: 'post',
@ -117,6 +119,30 @@
});
})
}
else{
$.ajax({
type: 'post',
url: '<?= route_to("updateDataOfCosidotapablanda") ?>',
data: {
tipo: 'duplicar',
presupuesto_id: id,
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v
},
dataType: 'json',
success:function(response){
token=response.<?= csrf_token() ?>;
yeniden(token);
// redirect
new_location = '<?= site_url("presupuestos/cosidotapablanda/edit/") ?>' + response.id
window.location.href = new_location;
}
}).fail(function (jqXHR, textStatus, error) {
// Handle error here
console.log(jqXHR)
});
}
});