mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/tarifas_encuadernacion_view' into 'main'
arreglado form de tarifas enc See merge request jjimenez/safekat!621
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models\Pedidos;
|
namespace App\Models\Pedidos;
|
||||||
|
|
||||||
use App\Entities\Presupuestos\OrdenTrabajoEntity;
|
use App\Entities\Produccion\OrdenTrabajoEntity;
|
||||||
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
use App\Models\OrdenTrabajo\OrdenTrabajoModel;
|
||||||
|
|
||||||
use function PHPSTORM_META\map;
|
use function PHPSTORM_META\map;
|
||||||
|
|||||||
@ -157,135 +157,135 @@
|
|||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
const url_parts = url.split('/');
|
const url_parts = url.split('/');
|
||||||
var id = -1;
|
var id = -1;
|
||||||
if(url_parts[url_parts.length-2] == 'edit'){
|
if (url_parts[url_parts.length - 2] == 'edit') {
|
||||||
id = url_parts[url_parts.length-1];
|
id = url_parts[url_parts.length - 1];
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
id = -1;
|
id = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
<?php if (str_contains($formAction, 'edit')): ?>
|
<?php if (str_contains($formAction, 'edit')): ?>
|
||||||
const actionBtns = function(data) {
|
const actionBtns = function (data) {
|
||||||
return `
|
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>
|
<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>
|
<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>
|
<span class="cancel"></span>
|
||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Delete row
|
// Delete row
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
$(document).on('click', '.btn-delete', function (e) {
|
||||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
||||||
if($(this).closest('table').attr('id').includes('tiradas')){
|
if ($(this).closest('table').attr('id').includes('tiradas')) {
|
||||||
$(".btn-remove").attr('table', "tiradas");
|
$(".btn-remove").attr('table', "tiradas");
|
||||||
}
|
}
|
||||||
else if($(this).closest('table').attr('id').includes('lineas')){
|
else if ($(this).closest('table').attr('id').includes('lineas')) {
|
||||||
$(".btn-remove").attr('table', "lineas");
|
$(".btn-remove").attr('table', "lineas");
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$(".btn-remove").attr('table', );
|
$(".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 dataId = $(this).attr('data-id');
|
||||||
const row = $(this).closest('tr');
|
const row = $(this).closest('tr');
|
||||||
if ($.isNumeric(dataId)) {
|
if ($.isNumeric(dataId)) {
|
||||||
|
|
||||||
if($(this).attr('table').includes('tiradas')){
|
if ($(this).attr('table').includes('tiradas')) {
|
||||||
remove_tiradas(dataId, row);
|
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(){
|
function check_por_horas() {
|
||||||
if($('#por_horas').is(':checked')){
|
if ($('#por_horas').is(':checked')) {
|
||||||
$('#accordionEncuadernacionLineasHoras').removeClass("d-none");
|
$('#accordionEncuadernacionLineasHoras').removeClass("d-none");
|
||||||
$('#accordionEncuadernacionLineas').addClass("d-none");
|
$('#accordionEncuadernacionLineas').addClass("d-none");
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$('#accordionEncuadernacionLineasHoras').addClass("d-none");
|
$('#accordionEncuadernacionLineasHoras').addClass("d-none");
|
||||||
$('#accordionEncuadernacionLineas').removeClass("d-none");
|
$('#accordionEncuadernacionLineas').removeClass("d-none");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
check_por_horas()
|
check_por_horas()
|
||||||
|
|
||||||
$("#por_horas").change(function() {
|
$("#por_horas").change(function () {
|
||||||
asyncConfirmDialog('<?= lang('Tarifaencuadernacion.sureToChange') ?>',
|
asyncConfirmDialog('<?= lang('Tarifaencuadernacion.sureToChange') ?>',
|
||||||
'<?= lang('Tarifaencuadernacion.sureToChangePorHorasText') ?>', yesCallback, noCallback);
|
'<?= lang('Tarifaencuadernacion.sureToChangePorHorasText') ?>', yesCallback, noCallback);
|
||||||
});
|
});
|
||||||
|
|
||||||
function yesCallback() {
|
function yesCallback() {
|
||||||
|
|
||||||
check_por_horas()
|
check_por_horas()
|
||||||
if($('#por_horas').is(':checked')){
|
if ($('#por_horas').is(':checked')) {
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.draw();
|
theTable.draw();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineas') ?>',
|
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineas') ?>',
|
||||||
data: {
|
data: {
|
||||||
cleandatatable: 1,
|
cleandatatable: 1,
|
||||||
tarifa_encuadernacion_id: id,
|
tarifa_encuadernacion_id: id,
|
||||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
|
||||||
},
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||||
success:function(response){
|
success: function (response) {
|
||||||
token = response.<?= csrf_token() ?>;
|
token = response.<?= csrf_token() ?>;
|
||||||
yeniden(token);
|
yeniden(token);
|
||||||
|
|
||||||
theTable3.clearPipeline();
|
theTable3.clearPipeline();
|
||||||
theTable3.draw();
|
theTable3.draw();
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.draw();
|
theTable.draw();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}else{
|
}else {
|
||||||
|
|
||||||
theTable3.clearPipeline();
|
theTable3.clearPipeline();
|
||||||
theTable3.draw();
|
theTable3.draw();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineasHoras') ?>',
|
url: '<?= route_to('dataTableOfTarifaEncuadernacionLineasHoras') ?>',
|
||||||
data: {
|
data: {
|
||||||
cleandatatable: 1,
|
cleandatatable: 1,
|
||||||
tarifa_encuadernacion_id: id,
|
tarifa_encuadernacion_id: id,
|
||||||
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
|
<?= csrf_token() ?? "token" ?>: <?= csrf_token() ?>v,
|
||||||
},
|
},
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
headers: { 'X-Requested-With': 'XMLHttpRequest' },
|
||||||
success:function(response){
|
success: function (response) {
|
||||||
|
|
||||||
token=response.<?= csrf_token() ?>;
|
token = response.<?= csrf_token() ?>;
|
||||||
yeniden(token);
|
yeniden(token);
|
||||||
|
|
||||||
theTable3.clearPipeline();
|
theTable3.clearPipeline();
|
||||||
theTable3.draw();
|
theTable3.draw();
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.draw();
|
theTable.draw();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function noCallback() {
|
function noCallback() {
|
||||||
// Toggle behaviour
|
// Toggle behaviour
|
||||||
$('#por_horas').prop("checked", !$('#por_horas').prop("checked"));
|
$('#por_horas').prop("checked", !$('#por_horas').prop("checked"));
|
||||||
}
|
}
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ var editor3 = new $.fn.dataTable.Editor({
|
|||||||
ajax: {
|
ajax: {
|
||||||
url: "<?= route_to('editorOfTarifaEncuadernacionLineasHoras') ?>",
|
url: "<?= route_to('editorOfTarifaEncuadernacionLineasHoras') ?>",
|
||||||
headers: {
|
headers: {
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
table : "#tableOfTarifaencuadernacionlineasHoras",
|
table : "#tableOfTarifaencuadernacionlineasHoras",
|
||||||
@ -550,7 +550,7 @@ var editor = new $.fn.dataTable.Editor({
|
|||||||
ajax: {
|
ajax: {
|
||||||
url: "<?= route_to('editorOfTarifaEncuadernacionLineas') ?>",
|
url: "<?= route_to('editorOfTarifaEncuadernacionLineas') ?>",
|
||||||
headers: {
|
headers: {
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
table : "#tableOfTarifaencuadernacionlineas",
|
table : "#tableOfTarifaencuadernacionlineas",
|
||||||
@ -620,7 +620,7 @@ var editor = new $.fn.dataTable.Editor({
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
// Generación de la lista de proveedores (id, nombre) para encuadernación
|
// 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.field('dimensiones_id').update(dimensionesList);
|
||||||
editor.on('open', (event) => {
|
editor.on('open', (event) => {
|
||||||
$("input.autonumeric").each(function () {
|
$("input.autonumeric").each(function () {
|
||||||
@ -818,7 +818,7 @@ var editor2 = new $.fn.dataTable.Editor({
|
|||||||
ajax: {
|
ajax: {
|
||||||
url: "<?= route_to('editorOfTarifaEncuadernacionTiradas') ?>",
|
url: "<?= route_to('editorOfTarifaEncuadernacionTiradas') ?>",
|
||||||
headers: {
|
headers: {
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?> v,
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
table : "#tableOfTarifaencuadernaciontiradas",
|
table : "#tableOfTarifaencuadernaciontiradas",
|
||||||
@ -865,7 +865,7 @@ var editor2 = new $.fn.dataTable.Editor({
|
|||||||
|
|
||||||
|
|
||||||
// Generación de la lista de proveedores (id, nombre) para encuadernación
|
// 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.field('proveedor_id').update(suppliersList);
|
||||||
|
|
||||||
editor2.on('open', (event) => {
|
editor2.on('open', (event) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user