mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'fix/tarifa-maquina-form' into 'main'
hide in tarifa-maquinas form when form is add See merge request jjimenez/safekat!490
This commit is contained in:
@ -2,37 +2,36 @@
|
|||||||
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
<?= $this->include("themes/_commonPartialsBs/select2bs5") ?>
|
||||||
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
<?= $this->include("themes/_commonPartialsBs/sweetalert") ?>
|
||||||
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
<?= $this->include('themes/_commonPartialsBs/_confirm2delete') ?>
|
||||||
<?=$this->extend('themes/vuexy/main/defaultlayout') ?>
|
<?= $this->extend('themes/vuexy/main/defaultlayout') ?>
|
||||||
|
|
||||||
<?= $this->section("content") ?>
|
<?= $this->section("content") ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||||
</div><!--//.card-header -->
|
</div><!--//.card-header -->
|
||||||
<form id="tarifaAcabadoForm" class="card-body" method="post" action="<?= $formAction ?>">
|
<form id="tarifaAcabadoForm" class="card-body" method="post" action="<?= $formAction ?>">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||||
<?= view("themes/vuexy/form/tarifas/acabado/_tarifaAcabadoFormItems") ?>
|
<?= view("themes/vuexy/form/tarifas/acabado/_tarifaAcabadoFormItems") ?>
|
||||||
<div class="pt-4">
|
<div class="pt-4">
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
class="btn btn-primary float-start me-sm-3 me-1"
|
class="btn btn-primary float-start me-sm-3 me-1"
|
||||||
name="save"
|
name="save"
|
||||||
value="<?= lang("Basic.global.Save") ?>"
|
value="<?= lang("Basic.global.Save") ?>" />
|
||||||
/>
|
<?= anchor(route_to("tarifaAcabadoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
||||||
<?= anchor(route_to("tarifaAcabadoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start"]) ?>
|
</div><!-- /.card-footer -->
|
||||||
</div><!-- /.card-footer -->
|
</form>
|
||||||
</form>
|
</div><!-- //.card -->
|
||||||
</div><!-- //.card -->
|
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
|
|
||||||
<?php if($formAction == route_to('tarifaAcabadoAdd')): ?>
|
<?php if ($formAction == route_to('tarifaAcabadoAdd')): ?>
|
||||||
<div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:hidden" >
|
<div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:hidden">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:visible" >
|
<div class="accordion mt-3" id="accordionAcabadoLineas" style="visibility:visible">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="card accordion-item active">
|
<div class="card accordion-item active">
|
||||||
<h2 class="accordion-header" id="headingOne">
|
<h2 class="accordion-header" id="headingOne">
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
||||||
@ -51,7 +50,7 @@
|
|||||||
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
|
<th><?= lang('TarifaAcabadoLineas.tiradaMax') ?></th>
|
||||||
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
|
<th><?= lang('TarifaAcabadoLineas.precioMin') ?></th>
|
||||||
<th><?= lang('TarifaAcabadoLineas.margen') ?></th>
|
<th><?= lang('TarifaAcabadoLineas.margen') ?></th>
|
||||||
<th class="noFilter" ></th>
|
<th class="noFilter"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -60,311 +59,313 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- //.accordion -->
|
</div> <!-- //.accordion -->
|
||||||
|
<?php if (str_contains($formAction, 'edit')): ?>
|
||||||
|
|
||||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||||
<div class="card accordion-item active">
|
<div class="card accordion-item active">
|
||||||
<h2 class="accordion-header" id="headingTwo">
|
<h2 class="accordion-header" id="headingTwo">
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
||||||
<h3>Tarifa máquinas</h3>
|
<h3>Tarifa máquinas</h3>
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas",["id" => "tarifa_maquina_component","tarifaId" => $tarifaacabadoEntity->id ]) ?>
|
<?= view("themes/vuexy/components/forms/tarifa_maquinas", ["id" => "tarifa_maquina_component", "tarifaId" => $tarifaacabadoEntity->id]) ?>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> <!-- //.accordion -->
|
||||||
</div> <!-- //.accordion -->
|
<?php endif ?>
|
||||||
</div><!--//.row -->
|
</div><!--//.row -->
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/acabado/index.js') ?>"></script>
|
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/acabado/index.js') ?>"></script>
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
const url_parts = url.split('/');
|
const url_parts = url.split('/');
|
||||||
let id = -1;
|
let 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];
|
||||||
}
|
}
|
||||||
|
|
||||||
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>
|
||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var editor = new $.fn.dataTable.Editor( {
|
var editor = new $.fn.dataTable.Editor( {
|
||||||
ajax: {
|
ajax: {
|
||||||
url: "<?= route_to('tarifaAcabadoLineasDTE') ?>",
|
url: "<?= route_to('tarifaAcabadoLineasDTE') ?>",
|
||||||
headers: {
|
headers: {
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
table : "#tableOfTarifaacabadolineas",
|
},
|
||||||
idSrc: 'id',
|
table : "#tableOfTarifaacabadolineas",
|
||||||
|
idSrc: 'id',
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "proveedor_id",
|
name: "proveedor_id",
|
||||||
type: "select",
|
type: "select",
|
||||||
}, {
|
}, {
|
||||||
name: "tirada_min"
|
name: "tirada_min"
|
||||||
}, {
|
}, {
|
||||||
name: "precio_max"
|
name: "precio_max"
|
||||||
}, {
|
}, {
|
||||||
name: "tirada_max"
|
name: "tirada_max"
|
||||||
}, {
|
}, {
|
||||||
name: "precio_min"
|
name: "precio_min"
|
||||||
},{
|
},{
|
||||||
name: "margen"
|
name: "margen"
|
||||||
}, {
|
}, {
|
||||||
"name": "tarifa_acabado_id",
|
"name": "tarifa_acabado_id",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},{
|
},{
|
||||||
name: "proveedor_nombre",
|
name: "proveedor_nombre",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},{
|
},{
|
||||||
"name": "deleted_at",
|
"name": "deleted_at",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},{
|
},{
|
||||||
"name": "is_deleted",
|
"name": "is_deleted",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// 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); ?>;
|
||||||
editor.field( 'proveedor_id' ).update( suppliersList );
|
editor.field( 'proveedor_id' ).update( suppliersList );
|
||||||
|
|
||||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||||
if ( type === 'create'){
|
if ( type === 'create'){
|
||||||
d.data[0]['tarifa_acabado_id'] = id;
|
d.data[0]['tarifa_acabado_id'] = id;
|
||||||
}
|
}
|
||||||
else if(type === 'edit' ) {
|
else if(type === 'edit' ) {
|
||||||
for (v in d.data){
|
for (v in d.data){
|
||||||
d.data[v]['tarifa_acabado_id'] = id;
|
d.data[v]['tarifa_acabado_id'] = id;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||||
|
|
||||||
yeniden(json.<?= csrf_token() ?>);
|
yeniden(json.<?= csrf_token() ?>);
|
||||||
});
|
});
|
||||||
|
|
||||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.draw();
|
theTable.draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function searchProviders(){
|
function searchProviders(){
|
||||||
var values = [];
|
var values = [];
|
||||||
$('#select_Proveedor').find(':selected').each(function () {
|
$('#select_Proveedor').find(':selected').each(function () {
|
||||||
values.push($(this).val());
|
values.push($(this).val());
|
||||||
});
|
});
|
||||||
theTable.column(0).search(values).draw();
|
theTable.column(0).search(values).draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Setup - add a text input to each footer cell
|
// Setup - add a text input to each footer cell
|
||||||
$('#tableOfTarifaacabadolineas thead tr').clone(true).appendTo('#tableOfTarifaacabadolineas thead');
|
$('#tableOfTarifaacabadolineas thead tr').clone(true).appendTo('#tableOfTarifaacabadolineas thead');
|
||||||
$('#tableOfTarifaacabadolineas thead tr:eq(1) th').each(function (i) {
|
$('#tableOfTarifaacabadolineas thead tr:eq(1) th').each(function (i) {
|
||||||
if (!$(this).hasClass("noFilter")) {
|
if (!$(this).hasClass("noFilter")) {
|
||||||
var title = $(this).text();
|
var title = $(this).text();
|
||||||
title = title.replace(/ /g, "_").replace(/\./g, "_");
|
title = title.replace(/ /g, "_").replace(/\./g, "_");
|
||||||
|
|
||||||
|
|
||||||
if(i==0){
|
if(i==0){
|
||||||
|
|
||||||
// Agregar un selector en la primera columna
|
// Agregar un selector en la primera columna
|
||||||
$(this).html(`<select id=select_${title} class="form-control select2" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>`);
|
$(this).html(`<select id=select_${title} class="form-control select2" style="min-width:100px;max-width:120px;font-size:0.8rem !important;"></select>`);
|
||||||
|
|
||||||
// Agregar opciones al selector
|
// Agregar opciones al selector
|
||||||
var selector = $('select', this);
|
var selector = $('select', this);
|
||||||
const suppliersList = <?php echo json_encode($proveedores); ?>;
|
const suppliersList = <?php echo json_encode($proveedores); ?>;
|
||||||
//selector.append('<option value="">Todos</option>'); // Opción vacía
|
//selector.append('<option value="">Todos</option>'); // Opción vacía
|
||||||
for (j = 0; j < suppliersList.length; j++) {
|
for (j = 0; j < suppliersList.length; j++) {
|
||||||
selector.append('<option value="' + suppliersList[j].value + '">' + suppliersList[j].label + '</option>');
|
selector.append('<option value="' + suppliersList[j].value + '">' + suppliersList[j].label + '</option>');
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#select_' + title).select2({
|
$('#select_' + title).select2({
|
||||||
multiple: true,
|
multiple: true,
|
||||||
placeholder: ""
|
placeholder: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
selector.bind('select2:select', searchProviders);
|
selector.bind('select2:select', searchProviders);
|
||||||
selector.bind('select2:unselect', searchProviders);
|
selector.bind('select2:unselect', searchProviders);
|
||||||
|
|
||||||
$('#select_' + title).val("").trigger('change');
|
$('#select_' + title).val("").trigger('change');
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
|
|
||||||
$(this).html(`
|
$(this).html(`
|
||||||
<div class='d-flex'>
|
<div class='d-flex'>
|
||||||
<input name=min_${title} id=min_${title} class="form-control" type='text' min='0' placeholder='Min' style='width: 80px;'/>
|
<input name=min_${title} id=min_${title} class="form-control" type='text' min='0' placeholder='Min' style='width: 80px;' />
|
||||||
<input name=max_${title} id=max_${title} class="form-control ml-1" type='text' min='0' placeholder='Max' style='width: 80px;'/>
|
<input name=max_${title} id=max_${title} class="form-control ml-1" type='text' min='0' placeholder='Max' style='width: 80px;' />
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('input', this).on('change clear', function () {
|
$('input', this).on('change clear', function () {
|
||||||
var minInputValue = parseFloat($(`#min_${title}`).val().replace(',','.')) || "";
|
var minInputValue = parseFloat($(`#min_${title}`).val().replace(',','.')) || "";
|
||||||
var maxInputValue = parseFloat($(`#max_${title}`).val().replace(',','.')) || "";
|
var maxInputValue = parseFloat($(`#max_${title}`).val().replace(',','.')) || "";
|
||||||
|
|
||||||
|
|
||||||
if (theTable.column(i).search() !== [minInputValue,maxInputValue]) {
|
if (theTable.column(i).search() !== [minInputValue,maxInputValue]) {
|
||||||
theTable
|
theTable
|
||||||
.column(i)
|
.column(i)
|
||||||
.search([minInputValue,maxInputValue])
|
.search([minInputValue,maxInputValue])
|
||||||
.draw();
|
.draw();
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
else {
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
$(this).html('<span></span>');
|
$(this).html('<span></span>');
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var theTable = $('#tableOfTarifaacabadolineas').DataTable( {
|
|
||||||
orderCellsTop: true,
|
|
||||||
serverSide: true,
|
|
||||||
processing: true,
|
|
||||||
autoWidth: true,
|
|
||||||
responsive: true,
|
|
||||||
fixedHeader: true,
|
|
||||||
lengthMenu: [ 5, 10, 25],
|
|
||||||
order: [[ 0, "asc" ], [ 1, "asc" ]],
|
|
||||||
pageLength: 10,
|
|
||||||
lengthChange: true,
|
|
||||||
paging: true,
|
|
||||||
info: false,
|
|
||||||
stateSave: false,
|
|
||||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
|
||||||
ajax : $.fn.dataTable.pipeline( {
|
|
||||||
url: '<?= route_to('tarifaAcabadoLineasDT') ?>',
|
|
||||||
data: {
|
|
||||||
id_tarifaacabado: id,
|
|
||||||
},
|
|
||||||
method: 'POST',
|
|
||||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
|
||||||
async: true,
|
|
||||||
}),
|
|
||||||
columns: [
|
|
||||||
{ 'data': 'proveedor_id',
|
|
||||||
render: function(data, type, row, meta) {
|
|
||||||
var value = suppliersList.find(element => element.value === data);
|
|
||||||
return value['label'];
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ 'data': 'tirada_min' },
|
|
||||||
{ 'data': 'precio_max' },
|
|
||||||
{ 'data': 'tirada_max' },
|
|
||||||
{ 'data': 'precio_min' },
|
|
||||||
{ 'data': 'margen' },
|
|
||||||
{
|
|
||||||
data: actionBtns,
|
|
||||||
className: 'row-edit dt-center'
|
|
||||||
}
|
}
|
||||||
],
|
});
|
||||||
columnDefs: [
|
|
||||||
{
|
|
||||||
orderable: false,
|
|
||||||
searchable: false,
|
|
||||||
targets: [lastColNr]
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
language: {
|
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
|
||||||
|
|
||||||
},
|
var theTable = $('#tableOfTarifaacabadolineas').DataTable( {
|
||||||
buttons: [ {
|
orderCellsTop: true,
|
||||||
className: 'btn btn-primary me-sm-3 me-1',
|
serverSide: true,
|
||||||
extend: "createInline",
|
processing: true,
|
||||||
editor: editor,
|
autoWidth: true,
|
||||||
formOptions: {
|
responsive: true,
|
||||||
submitTrigger: -1,
|
fixedHeader: true,
|
||||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
lengthMenu: [ 5, 10, 25],
|
||||||
}
|
order: [[ 0, "asc" ], [ 1, "asc" ]],
|
||||||
} ]
|
pageLength: 10,
|
||||||
} );
|
lengthChange: true,
|
||||||
|
paging: true,
|
||||||
|
info: false,
|
||||||
|
stateSave: false,
|
||||||
|
dom: '<"mt-4"><"float-end"B><"float-start"l>
|
||||||
|
<t><"mt-4 mb-3"p>',
|
||||||
|
ajax : $.fn.dataTable.pipeline( {
|
||||||
|
url: '<?= route_to('tarifaAcabadoLineasDT') ?>',
|
||||||
|
data: {
|
||||||
|
id_tarifaacabado: id,
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
|
async: true,
|
||||||
|
}),
|
||||||
|
columns: [
|
||||||
|
{ 'data': 'proveedor_id',
|
||||||
|
render: function(data, type, row, meta) {
|
||||||
|
var value = suppliersList.find(element => element.value === data);
|
||||||
|
return value['label'];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ 'data': 'tirada_min' },
|
||||||
|
{ 'data': 'precio_max' },
|
||||||
|
{ 'data': 'tirada_max' },
|
||||||
|
{ 'data': 'precio_min' },
|
||||||
|
{ 'data': 'margen' },
|
||||||
|
{
|
||||||
|
data: actionBtns,
|
||||||
|
className: 'row-edit dt-center'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
orderable: false,
|
||||||
|
searchable: false,
|
||||||
|
targets: [lastColNr]
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
language: {
|
||||||
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
|
|
||||||
|
},
|
||||||
|
buttons: [ {
|
||||||
|
className: 'btn btn-primary me-sm-3 me-1',
|
||||||
|
extend: "createInline",
|
||||||
|
editor: editor,
|
||||||
|
formOptions: {
|
||||||
|
submitTrigger: -1,
|
||||||
|
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||||
|
}
|
||||||
|
} ]
|
||||||
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Activate an inline edit on click of a table cell
|
// Activate an inline edit on click of a table cell
|
||||||
$('#tableOfTarifaacabadolineas').on( 'click', 'tbody span.edit', function (e) {
|
$('#tableOfTarifaacabadolineas').on( 'click', 'tbody span.edit', function (e) {
|
||||||
editor.inline(
|
editor.inline(
|
||||||
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
||||||
{
|
{
|
||||||
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
||||||
cancelTrigger: 'span.cancel',
|
cancelTrigger: 'span.cancel',
|
||||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
|
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
|
||||||
submitTrigger: 'span.edit',
|
submitTrigger: 'span.edit',
|
||||||
submit: 'allIfChanged'
|
submit: 'allIfChanged'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
// 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'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$(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)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `/tarifas/acabados/lineas/delete/${dataId}`,
|
url: `/tarifas/acabados/lineas/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
$('#confirm2delete').modal('toggle');
|
$('#confirm2delete').modal('toggle');
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?=$this->section('css') ?>
|
<?= $this->section('css') ?>
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/fixedheader/fixedHeader.dataTables.min.css") ?>">
|
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/fixedheader/fixedHeader.dataTables.min.css") ?>">
|
||||||
<?=$this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||||
<?=$this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -6,160 +6,163 @@
|
|||||||
<?= $this->section("content") ?>
|
<?= $this->section("content") ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card card-info">
|
<div class="card card-info">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
<h3 class="card-title"><?= $boxTitle ?? $pageTitle ?></h3>
|
||||||
</div><!--//.card-header -->
|
</div><!--//.card-header -->
|
||||||
<form id="tarifaManipuladoForm" class="card-body" method="post" action="<?= $formAction ?>">
|
<form id="tarifaManipuladoForm" class="card-body" method="post" action="<?= $formAction ?>">
|
||||||
<?= csrf_field() ?>
|
<?= csrf_field() ?>
|
||||||
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
<?= view("themes/_commonPartialsBs/_alertBoxes") ?>
|
||||||
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
<?= !empty($validation->getErrors()) ? $validation->listErrors("bootstrap_style") : "" ?>
|
||||||
<?= view("themes/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems") ?>
|
<?= view("themes/vuexy/form/tarifas/manipulado/_tarifaManipuladoFormItems") ?>
|
||||||
<div class="pt-4">
|
<div class="pt-4">
|
||||||
<input type="submit"
|
<input type="submit"
|
||||||
class="btn btn-primary float-start me-sm-3 me-1"
|
class="btn btn-primary float-start me-sm-3 me-1"
|
||||||
name="save"
|
name="save"
|
||||||
value="<?= lang("Basic.global.Save") ?>"
|
value="<?= lang("Basic.global.Save") ?>" />
|
||||||
/>
|
<?= anchor(route_to("tarifaManipuladoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
||||||
<?= anchor(route_to("tarifaManipuladoList"), lang("Basic.global.Cancel"), ["class" => "btn btn-secondary float-start",]) ?>
|
|
||||||
|
|
||||||
</div><!-- /.card-footer -->
|
</div><!-- /.card-footer -->
|
||||||
</form>
|
</form>
|
||||||
</div><!-- //.card -->
|
</div><!-- //.card -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
|
|
||||||
<?php if($formAction == site_url('tarifas/tarifasmanipulado/add')): ?>
|
<?php if ($formAction == site_url('tarifas/tarifasmanipulado/add')): ?>
|
||||||
<div class="accordion mt-3" id="accordionManipuladoLineas" style="visibility:hidden" >
|
<div class="accordion mt-3" id="accordionManipuladoLineas" style="visibility:hidden">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="accordion mt-3" id="accordionManipuladoLineas" style="visibility:visible" >
|
<div class="accordion mt-3" id="accordionManipuladoLineas" style="visibility:visible">
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="card accordion-item active">
|
<div class="card accordion-item active">
|
||||||
<h2 class="accordion-header" id="headingOne">
|
<h2 class="accordion-header" id="headingOne">
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTip1" aria-expanded="false" aria-controls="accordionTip1">
|
||||||
<h3><?= lang("TarifaManipuladoLineas.moduleTitle") ?></h3>
|
<h3><?= lang("TarifaManipuladoLineas.moduleTitle") ?></h3>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionManipuladoLineas">
|
<div id="accordionTip1" class="accordion-collapse collapse show" data-bs-parent="#accordionManipuladoLineas">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
|
|
||||||
<table id="tableOfTarifamanipuladolineas" class="table table-striped table-hover" style="width: 100%;">
|
<table id="tableOfTarifamanipuladolineas" class="table table-striped table-hover" style="width: 100%;">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= lang('TarifaManipuladoLineas.tiradaMin') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.tiradaMin') ?></th>
|
||||||
<th><?= lang('TarifaManipuladoLineas.precioMax') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.precioMax') ?></th>
|
||||||
<th><?= lang('TarifaManipuladoLineas.tiradaMax') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.tiradaMax') ?></th>
|
||||||
<th><?= lang('TarifaManipuladoLineas.precioMin') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.precioMin') ?></th>
|
||||||
<th><?= lang('TarifaManipuladoLineas.margen') ?></th>
|
<th><?= lang('TarifaManipuladoLineas.margen') ?></th>
|
||||||
<th style="min-width:100px"></th>
|
<th style="min-width:100px"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> <!-- //.accordion -->
|
|
||||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
|
||||||
<div class="card accordion-item active">
|
|
||||||
<h2 class="accordion-header" id="headingTwo">
|
|
||||||
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
|
||||||
<h3>Tarifa máquinas</h3>
|
|
||||||
</button>
|
|
||||||
</h2>
|
|
||||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
|
||||||
<div class="accordion-body">
|
|
||||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas",["id" => "tarifa_maquina_component","tarifaId" => $tarifaManipuladoEntity?->id ]) ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div> <!-- //.accordion -->
|
</div> <!-- //.accordion -->
|
||||||
</div><!--//.row -->
|
<?php if ($formAction != site_url('tarifas/tarifasmanipulado/add')): ?>
|
||||||
<?= $this->endSection() ?>
|
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/manipulado/index.js') ?>"></script>
|
<div class="card accordion-item active">
|
||||||
<?= $this->endSection() ?>
|
<h2 class="accordion-header" id="headingTwo">
|
||||||
|
<button type="button" class="accordion-button" data-bs-toggle="collapse" data-bs-target="#accordionTipTarifaMaquina" aria-expanded="false" aria-controls="accordionTipTarifaMaquina">
|
||||||
|
<h3>Tarifa máquinas</h3>
|
||||||
|
</button>
|
||||||
|
</h2>
|
||||||
|
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||||
|
<div class="accordion-body">
|
||||||
|
<?= view("themes/vuexy/components/forms/tarifa_maquinas", ["id" => "tarifa_maquina_component", "tarifaId" => $tarifaManipuladoEntity?->id]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- //.accordion -->
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</div><!--//.row -->
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
|
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/manipulado/index.js') ?>"></script>
|
||||||
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
<?= $this->section("additionalInlineJs") ?>
|
<?= $this->section("additionalInlineJs") ?>
|
||||||
|
|
||||||
const lastColNr = $('#tableOfTarifamanipuladolineas').find("tr:first th").length - 1;
|
const lastColNr = $('#tableOfTarifamanipuladolineas').find("tr:first th").length - 1;
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
const url_parts = url.split('/');
|
const url_parts = url.split('/');
|
||||||
let id = -1;
|
let 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];
|
||||||
}
|
}
|
||||||
|
|
||||||
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>
|
||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
editor = new $.fn.dataTable.Editor( {
|
editor = new $.fn.dataTable.Editor( {
|
||||||
ajax: {
|
ajax: {
|
||||||
url: "<?= route_to('editorOfTarifaManipuladoLineas') ?>",
|
url: "<?= route_to('editorOfTarifaManipuladoLineas') ?>",
|
||||||
headers: {
|
headers: {
|
||||||
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
<?= csrf_token() ?? "token" ?> : <?= csrf_token() ?>v,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
table : "#tableOfTarifamanipuladolineas",
|
},
|
||||||
idSrc: 'id',
|
table : "#tableOfTarifamanipuladolineas",
|
||||||
|
idSrc: 'id',
|
||||||
fields: [ {
|
fields: [ {
|
||||||
name: "tirada_min"
|
name: "tirada_min"
|
||||||
}, {
|
}, {
|
||||||
name: "precio_max"
|
name: "precio_max"
|
||||||
}, {
|
}, {
|
||||||
name: "tirada_max"
|
name: "tirada_max"
|
||||||
}, {
|
}, {
|
||||||
name: "precio_min"
|
name: "precio_min"
|
||||||
}, {
|
}, {
|
||||||
name: "margen"
|
name: "margen"
|
||||||
}, {
|
}, {
|
||||||
"name": "tarifa_manipulado_id",
|
"name": "tarifa_manipulado_id",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},{
|
},{
|
||||||
"name": "deleted_at",
|
"name": "deleted_at",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},{
|
},{
|
||||||
"name": "is_deleted",
|
"name": "is_deleted",
|
||||||
"type": "hidden"
|
"type": "hidden"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
editor.on( 'preSubmit', function ( e, d, type ) {
|
editor.on( 'preSubmit', function ( e, d, type ) {
|
||||||
if ( type === 'create'){
|
if ( type === 'create'){
|
||||||
d.data[0]['tarifa_manipulado_id'] = id;
|
d.data[0]['tarifa_manipulado_id'] = id;
|
||||||
}
|
}
|
||||||
else if(type === 'edit' ) {
|
else if(type === 'edit' ) {
|
||||||
for (v in d.data){
|
for (v in d.data){
|
||||||
d.data[v]['tarifa_manipulado_id'] = id;
|
d.data[v]['tarifa_manipulado_id'] = id;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
editor.on( 'postSubmit', function ( e, json, data, action ) {
|
||||||
|
|
||||||
yeniden(json.<?= csrf_token() ?>);
|
yeniden(json.<?= csrf_token() ?>);
|
||||||
});
|
});
|
||||||
|
|
||||||
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
editor.on( 'submitSuccess', function ( e, json, data, action ) {
|
||||||
|
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.draw();
|
theTable.draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var theTable = $('#tableOfTarifamanipuladolineas').DataTable( {
|
var theTable = $('#tableOfTarifamanipuladolineas').DataTable( {
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
processing: true,
|
processing: true,
|
||||||
autoWidth: true,
|
autoWidth: true,
|
||||||
responsive: true,
|
responsive: true,
|
||||||
@ -170,146 +173,146 @@
|
|||||||
searching: false,
|
searching: false,
|
||||||
paging: true,
|
paging: true,
|
||||||
info: false,
|
info: false,
|
||||||
dom: '<"mt-4"><"float-end"B><"float-start"l><t><"mt-4 mb-3"p>',
|
dom: '<"mt-4"><"float-end"B><"float-start"l>
|
||||||
ajax : $.fn.dataTable.pipeline( {
|
<t><"mt-4 mb-3"p>',
|
||||||
url: '<?= route_to('dataTableOfTarifaManipuladoLineas') ?>',
|
ajax : $.fn.dataTable.pipeline( {
|
||||||
data: {
|
url: '<?= route_to('dataTableOfTarifaManipuladoLineas') ?>',
|
||||||
id_tarifamanipulado: id,
|
data: {
|
||||||
},
|
id_tarifamanipulado: id,
|
||||||
method: 'POST',
|
},
|
||||||
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
method: 'POST',
|
||||||
async: true,
|
headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
}),
|
async: true,
|
||||||
columns: [
|
}),
|
||||||
{ 'data': 'tirada_min' },
|
columns: [
|
||||||
{ 'data': 'precio_max' },
|
{ 'data': 'tirada_min' },
|
||||||
{ 'data': 'tirada_max' },
|
{ 'data': 'precio_max' },
|
||||||
{ 'data': 'precio_min' },
|
{ 'data': 'tirada_max' },
|
||||||
{ 'data': 'margen' },
|
{ 'data': 'precio_min' },
|
||||||
{
|
{ 'data': 'margen' },
|
||||||
data: actionBtns,
|
{
|
||||||
className: 'row-edit dt-center'
|
data: actionBtns,
|
||||||
}
|
className: 'row-edit dt-center'
|
||||||
],
|
}
|
||||||
columnDefs: [
|
],
|
||||||
{
|
columnDefs: [
|
||||||
orderable: false,
|
{
|
||||||
searchable: false,
|
orderable: false,
|
||||||
targets: [lastColNr]
|
searchable: false,
|
||||||
},
|
targets: [lastColNr]
|
||||||
{"orderData": [ 0, 1 ], "targets": 0 },
|
},
|
||||||
|
{"orderData": [ 0, 1 ], "targets": 0 },
|
||||||
|
|
||||||
],
|
],
|
||||||
language: {
|
language: {
|
||||||
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json"
|
||||||
},
|
},
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
extend: 'collection',
|
extend: 'collection',
|
||||||
text: 'Exportar',
|
text: 'Exportar',
|
||||||
buttons:[
|
buttons:[
|
||||||
'copy', 'csv', 'excel', 'print', {
|
'copy', 'csv', 'excel', 'print', {
|
||||||
extend: 'pdfHtml5',
|
extend: 'pdfHtml5',
|
||||||
orientation: 'landscape',
|
orientation: 'landscape',
|
||||||
pageSize: 'A4'
|
pageSize: 'A4'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
className: 'btn btn-primary float-end me-sm-3 me-1',
|
className: 'btn btn-primary float-end me-sm-3 me-1',
|
||||||
extend: "createInline",
|
extend: "createInline",
|
||||||
editor: editor,
|
editor: editor,
|
||||||
formOptions: {
|
formOptions: {
|
||||||
submitTrigger: -1,
|
submitTrigger: -1,
|
||||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>'
|
||||||
}
|
}
|
||||||
} ]
|
} ]
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Activate an inline edit on click of a table cell
|
// Activate an inline edit on click of a table cell
|
||||||
$('#tableOfTarifamanipuladolineas').on( 'click', 'tbody span.edit', function (e) {
|
$('#tableOfTarifamanipuladolineas').on( 'click', 'tbody span.edit', function (e) {
|
||||||
editor.inline(
|
editor.inline(
|
||||||
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
theTable.cells(this.parentNode.parentNode, '*').nodes(),
|
||||||
{
|
{
|
||||||
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
cancelHtml: '<a href="javascript:void(0);"><i class="ti ti-x"></i></a>',
|
||||||
cancelTrigger: 'span.cancel',
|
cancelTrigger: 'span.cancel',
|
||||||
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
|
submitHtml: '<a href="javascript:void(0);"><i class="ti ti-device-floppy"></i></a>',
|
||||||
submitTrigger: 'span.edit',
|
submitTrigger: 'span.edit',
|
||||||
submit: 'allIfChanged'
|
submit: 'allIfChanged'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
||||||
// Delete row
|
// Delete row
|
||||||
$('#tableOfTarifamanipuladolineas').on( 'click', 'tbody span.remove', function (e) {
|
$('#tableOfTarifamanipuladolineas').on( 'click', 'tbody span.remove', function (e) {
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
title: '<?= lang('Basic.global.sweet.sureToDeleteTitle', [mb_strtolower(lang('Basic.global.sweet.line'))]) ?>',
|
||||||
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
text: '<?= lang('Basic.global.sweet.sureToDeleteText') ?>',
|
||||||
icon: 'warning',
|
icon: 'warning',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: '#3085d6',
|
confirmButtonColor: '#3085d6',
|
||||||
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
confirmButtonText: '<?= lang('Basic.global.sweet.deleteConfirmationButton') ?>',
|
||||||
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
cancelButtonText: '<?= lang('Basic.global.Cancel') ?>',
|
||||||
cancelButtonColor: '#d33'
|
cancelButtonColor: '#d33'
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
const dataId = $(this).data('id');
|
const dataId = $(this).data('id');
|
||||||
const row = $(this).closest('tr');
|
const row = $(this).closest('tr');
|
||||||
if (result.value) {
|
if (result.value) {
|
||||||
editor
|
editor
|
||||||
.create( false )
|
.create( false )
|
||||||
.edit( this.parentNode, false)
|
.edit( this.parentNode, false)
|
||||||
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
.set( 'deleted_at', new Date().toISOString().slice(0, 19).replace('T', ' ') )
|
||||||
.set( 'is_deleted', 1 )
|
.set( 'is_deleted', 1 )
|
||||||
.submit();
|
.submit();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// 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'));
|
||||||
});
|
});
|
||||||
|
|
||||||
$(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)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: `/tarifas/tarifamanipuladolineas/delete/${dataId}`,
|
url: `/tarifas/tarifamanipuladolineas/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
$('#confirm2delete').modal('toggle');
|
$('#confirm2delete').modal('toggle');
|
||||||
theTable.clearPipeline();
|
theTable.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable.row($(row)).invalidate().draw();
|
||||||
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
<?=$this->section('css') ?>
|
<?= $this->section('css') ?>
|
||||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/css/datatables-editor/editor.dataTables.min.css') ?>">
|
||||||
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
<link rel="stylesheet" href="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.css") ?>">
|
||||||
<?=$this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/dataTables.buttons.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.bootstrap5.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.html5.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/buttons/buttons.print.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/jszip/jszip.min.js") ?>"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/pdfmake.min.js") ?>" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
||||||
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
<script src="<?= site_url("/themes/vuexy/vendor/libs/datatables-sk/plugins/pdfmake/vfs_fonts.js") ?>"></script>
|
||||||
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
<script src="<?= site_url('themes/vuexy/js/datatables-editor/dataTables.editor.min.js') ?>"></script>
|
||||||
<?=$this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
@ -26,6 +26,8 @@
|
|||||||
</div><!-- //.card -->
|
</div><!-- //.card -->
|
||||||
</div><!--//.col -->
|
</div><!--//.col -->
|
||||||
</div><!--//.row -->
|
</div><!--//.row -->
|
||||||
|
<?php if(str_contains($formAction, 'edit')): ?>
|
||||||
|
|
||||||
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
<div class="accordion mt-3" id="accordionTarifaMaquinas" style="visibility:visible">
|
||||||
<div class="card accordion-item active">
|
<div class="card accordion-item active">
|
||||||
<h2 class="accordion-header" id="headingTwo">
|
<h2 class="accordion-header" id="headingTwo">
|
||||||
@ -35,11 +37,13 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
<div id="accordionTipTarifaMaquina" class="accordion-collapse collapse show" data-bs-parent="#accordionTarifaMaquinas">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
<?= view("themes/vuexy/components/forms/tarifa_maquinas", ["id" => "tarifa_maquina_component", "tarifaId" => $tarifapreimpresionEntity->id]) ?>
|
<?= view("themes/vuexy/components/forms/tarifa_maquinas", ["id" => "tarifa_maquina_component", "tarifaId" => $tarifapreimpresionEntity?->id]) ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- //.accordion -->
|
</div> <!-- //.accordion -->
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
<?= $this->section("additionalExternalJs") ?>
|
<?= $this->section("additionalExternalJs") ?>
|
||||||
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/preimpresion/index.js') ?>"></script>
|
<script type="module" src="<?= site_url('assets/js/safekat/pages/tarifas/maquinas/preimpresion/index.js') ?>"></script>
|
||||||
|
|||||||
@ -73,7 +73,6 @@ class TarifaMaquina {
|
|||||||
this.datatable.ajax.reload()
|
this.datatable.ajax.reload()
|
||||||
this.selectMaquinaTarea.reset()
|
this.selectMaquinaTarea.reset()
|
||||||
this.selectTarifaMaquina.reset()
|
this.selectTarifaMaquina.reset()
|
||||||
console.log(response)
|
|
||||||
}
|
}
|
||||||
handleNewTarifaMaquinaError(error) { }
|
handleNewTarifaMaquinaError(error) { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user