arreglado form de tarifas enc

This commit is contained in:
2025-03-28 13:29:01 +01:00
parent adfa8bc465
commit c4b1620c1b
2 changed files with 95 additions and 95 deletions

View File

@ -2,7 +2,7 @@
namespace App\Models\Pedidos;
use App\Entities\Presupuestos\OrdenTrabajoEntity;
use App\Entities\Produccion\OrdenTrabajoEntity;
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
use function PHPSTORM_META\map;

View File

@ -157,135 +157,135 @@
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 (url_parts[url_parts.length - 2] == 'edit') {
id = url_parts[url_parts.length - 1];
}
else{
id = -1;
else {
id = -1;
}
<?php if (str_contains($formAction, 'edit')): ?>
const actionBtns = function(data) {
return `
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<span class="cancel"></span>
`;
};
const actionBtns = function (data) {
return `
<span class="edit"><a href="javascript:void(0);"><i class="ti ti-pencil ti-sm btn-edit mx-2" data-id="${data.id}"></i></a></span>
<a href="javascript:void(0);"><i class="ti ti-trash ti-sm btn-delete mx-2" data-id="${data.id}" data-bs-toggle="modal" data-bs-target="#confirm2delete"></i></a>
<span class="cancel"></span>
`;
};
// Delete row
$(document).on('click', '.btn-delete', function(e) {
// Delete row
$(document).on('click', '.btn-delete', function (e) {
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
if($(this).closest('table').attr('id').includes('tiradas')){
$(".btn-remove").attr('table', "tiradas");
if ($(this).closest('table').attr('id').includes('tiradas')) {
$(".btn-remove").attr('table', "tiradas");
}
else if($(this).closest('table').attr('id').includes('lineas')){
$(".btn-remove").attr('table', "lineas");
else if ($(this).closest('table').attr('id').includes('lineas')) {
$(".btn-remove").attr('table', "lineas");
}
else{
$(".btn-remove").attr('table', );
else {
$(".btn-remove").attr('table',);
}
});
});
var selected_tirada_id = -1;
var selected_tirada_id = -1;
$(document).on('click', '.btn-remove', function(e) {
$(document).on('click', '.btn-remove', function (e) {
const dataId = $(this).attr('data-id');
const row = $(this).closest('tr');
if ($.isNumeric(dataId)) {
if($(this).attr('table').includes('tiradas')){
remove_tiradas(dataId, row);
if ($(this).attr('table').includes('tiradas')) {
remove_tiradas(dataId, row);
}
else if ($(this).attr('table').includes('lineasHoras')) {
remove_lineas_horas(dataId, row);
}
else {
remove_lineas(dataId, row);
}
}
else if ($(this).attr('table').includes('lineasHoras')){
remove_lineas_horas(dataId, row);
}
else{
remove_lineas(dataId, row);
}
}
});
});
function check_por_horas(){
if($('#por_horas').is(':checked')){
$('#accordionEncuadernacionLineasHoras').removeClass("d-none");
$('#accordionEncuadernacionLineas').addClass("d-none");
function check_por_horas() {
if ($('#por_horas').is(':checked')) {
$('#accordionEncuadernacionLineasHoras').removeClass("d-none");
$('#accordionEncuadernacionLineas').addClass("d-none");
}
else{
$('#accordionEncuadernacionLineasHoras').addClass("d-none");
$('#accordionEncuadernacionLineas').removeClass("d-none");
else {
$('#accordionEncuadernacionLineasHoras').addClass("d-none");
$('#accordionEncuadernacionLineas').removeClass("d-none");
}
}
check_por_horas()
}
check_por_horas()
$("#por_horas").change(function() {
$("#por_horas").change(function () {
asyncConfirmDialog('<?= lang('Tarifaencuadernacion.sureToChange') ?>',
'<?= lang('Tarifaencuadernacion.sureToChangePorHorasText') ?>', yesCallback, noCallback);
});
'<?= lang('Tarifaencuadernacion.sureToChangePorHorasText') ?>', yesCallback, noCallback);
});
function yesCallback() {
function yesCallback() {
check_por_horas()
if($('#por_horas').is(':checked')){
if ($('#por_horas').is(':checked')) {
theTable.clearPipeline();
theTable.draw();
theTable.clearPipeline();
theTable.draw();
$.ajax({
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineas') ?>',
data: {
cleandatatable: 1,
tarifa_encuadernacion_id: id,
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
success:function(response){
token = response.<?= csrf_token() ?>;
yeniden(token);
$.ajax({
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineas') ?>',
data: {
cleandatatable: 1,
tarifa_encuadernacion_id: id,
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
},
method: 'POST',
headers: { 'X-Requested-With': 'XMLHttpRequest' },
success: function (response) {
token = response.<?= csrf_token() ?>;
yeniden(token);
theTable3.clearPipeline();
theTable3.draw();
theTable3.clearPipeline();
theTable3.draw();
theTable.clearPipeline();
theTable.draw();
}
theTable.clearPipeline();
theTable.draw();
}
});
}else{
}else {
theTable3.clearPipeline();
theTable3.draw();
theTable3.clearPipeline();
theTable3.draw();
$.ajax({
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineasHoras') ?>',
data: {
cleandatatable: 1,
tarifa_encuadernacion_id: id,
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
},
method: 'POST',
headers: {'X-Requested-With': 'XMLHttpRequest'},
success:function(response){
$.ajax({
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineasHoras') ?>',
data: {
cleandatatable: 1,
tarifa_encuadernacion_id: id,
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
},
method: 'POST',
headers: { 'X-Requested-With': 'XMLHttpRequest' },
success: function (response) {
token=response.<?= csrf_token() ?>;
yeniden(token);
token = response.<?= csrf_token() ?>;
yeniden(token);
theTable3.clearPipeline();
theTable3.draw();
theTable3.clearPipeline();
theTable3.draw();
theTable.clearPipeline();
theTable.draw();
}
});
}
theTable.clearPipeline();
theTable.draw();
}
});
}
}
function noCallback() {
function noCallback() {
// Toggle behaviour
$('#por_horas').prop("checked", !$('#por_horas').prop("checked"));
}
}
<?php endif; ?>
<?= $this->endSection() ?>
@ -303,7 +303,7 @@ var editor3 = new $.fn.dataTable.Editor({
ajax: {
url: "<?= route_to('editorOfTarifaEncuadernacionLineasHoras') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfTarifaencuadernacionlineasHoras",
@ -550,7 +550,7 @@ var editor = new $.fn.dataTable.Editor({
ajax: {
url: "<?= route_to('editorOfTarifaEncuadernacionLineas') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfTarifaencuadernacionlineas",
@ -620,7 +620,7 @@ var editor = new $.fn.dataTable.Editor({
} );
// Generación de la lista de proveedores (id, nombre) para encuadernación
const dimensionesList = <? php echo json_encode($dimensiones); ?>;
const dimensionesList = <?php echo json_encode($dimensiones); ?>;
editor.field('dimensiones_id').update(dimensionesList);
editor.on('open', (event) => {
$("input.autonumeric").each(function () {
@ -818,7 +818,7 @@ var editor2 = new $.fn.dataTable.Editor({
ajax: {
url: "<?= route_to('editorOfTarifaEncuadernacionTiradas') ?>",
headers: {
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
},
},
table : "#tableOfTarifaencuadernaciontiradas",
@ -865,7 +865,7 @@ var editor2 = new $.fn.dataTable.Editor({
// Generación de la lista de proveedores (id, nombre) para encuadernación
const suppliersList = <? php echo json_encode($proveedores); ?>;
const suppliersList = <?php echo json_encode($proveedores); ?>;
editor2.field('proveedor_id').update(suppliersList);
editor2.on('open', (event) => {