mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
modificacion finalizada y testeada
This commit is contained in:
@ -202,6 +202,7 @@ $routes->group('papelimpresiontipologias', ['namespace' => 'App\Controllers\Conf
|
|||||||
$routes->group('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
$routes->group('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Configuracion'], function ($routes) {
|
||||||
$routes->post('datatable', 'Papelimpresionmargenes::datatable', ['as' => 'dataTableOfPapelImpresionMargen']);
|
$routes->post('datatable', 'Papelimpresionmargenes::datatable', ['as' => 'dataTableOfPapelImpresionMargen']);
|
||||||
$routes->post('datatable_editor', 'Papelimpresionmargenes::datatable_editor', ['as' => 'editorOfPapelImpresionMargenes']);
|
$routes->post('datatable_editor', 'Papelimpresionmargenes::datatable_editor', ['as' => 'editorOfPapelImpresionMargenes']);
|
||||||
|
$routes->get('delete/(:num)', 'Papelimpresionmargenes::delete/$1', ['as' => 'deletePapelImpresionMargen']);
|
||||||
});
|
});
|
||||||
$routes->resource('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelimpresionmargenes', 'except' => 'show,new,create,update']);
|
$routes->resource('papelesimpresionmargenes', ['namespace' => 'App\Controllers\Configuracion', 'controller' => 'Papelimpresionmargenes', 'except' => 'show,new,create,update']);
|
||||||
|
|
||||||
|
|||||||
@ -157,7 +157,7 @@ class Papelimpresionmargenes extends \App\Controllers\GoBaseResourceController
|
|||||||
$order = PapelImpresionMargenModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
|
$order = PapelImpresionMargenModel::SORTABLE[$requestedOrder >= 0 ? $requestedOrder : 0];
|
||||||
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
$dir = $reqData['order']['0']['dir'] ?? 'asc';
|
||||||
|
|
||||||
$id_PI = $reqData['papel_impresion_id'] ?? -1;
|
$id_PI = $reqData['id_PI'] ?? -1;
|
||||||
|
|
||||||
$resourceData = $this->model->getResource("", $id_PI)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
$resourceData = $this->model->getResource("", $id_PI)->orderBy($order, $dir)->limit($length, $start)->get()->getResultObject();
|
||||||
|
|
||||||
|
|||||||
@ -148,9 +148,9 @@ class PapelImpresionTipologiaModel extends \App\Models\GoBaseModel
|
|||||||
->where("papel_impresion_id", $data["papel_impresion_id"])
|
->where("papel_impresion_id", $data["papel_impresion_id"])
|
||||||
->where("tipo", $data["tipo"]);
|
->where("tipo", $data["tipo"]);
|
||||||
|
|
||||||
|
if ($builder->countAllResults(false) > 0){
|
||||||
if ($builder->countAllResults() > 0){
|
$found_id = $builder->get()->getResultObject()[0]->id;
|
||||||
if($builder->get()->getResultObject()[0]->id!=$id){
|
if($found_id != $id){
|
||||||
return lang('ImpresionTipologias.validation.error_tipo_duplicado');
|
return lang('ImpresionTipologias.validation.error_tipo_duplicado');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -183,6 +183,35 @@
|
|||||||
cache: true
|
cache: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// 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('margenes')){
|
||||||
|
$(".btn-remove").attr('table', "margenes");
|
||||||
|
}
|
||||||
|
else if($(this).closest('table').attr('id').includes('tipologias')){
|
||||||
|
$(".btn-remove").attr('table', "tipologias");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$(".btn-remove").attr('table', );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(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('margenes')){
|
||||||
|
remove_margenes(dataId, row);
|
||||||
|
}
|
||||||
|
else if ($(this).attr('table').includes('tipologias')){
|
||||||
|
remove_tipologias(dataId, row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
@ -302,7 +331,7 @@
|
|||||||
|
|
||||||
// Activate an inline edit on click of a table cell
|
// Activate an inline edit on click of a table cell
|
||||||
$(document).on('click', '.btn-edit2', function(e) {
|
$(document).on('click', '.btn-edit2', function(e) {
|
||||||
editor.inline(
|
editor3.inline(
|
||||||
theTable3.cells(this.parentNode.parentNode.parentNode, '*').nodes(),
|
theTable3.cells(this.parentNode.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>',
|
||||||
@ -341,31 +370,22 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
// Delete row
|
||||||
|
function remove_margenes(dataId, row){
|
||||||
|
|
||||||
// Borrar registro
|
$.ajax({
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
url: `/configuracion/papelimpresionmargenes/delete/${dataId}`,
|
||||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-remove', function(e) {
|
|
||||||
const dataId = $(this).attr('data-id');
|
|
||||||
const row = $(this).closest('tr');
|
|
||||||
if ($.isNumeric(dataId)) {
|
|
||||||
$.ajax({
|
|
||||||
url: `/configuracion/papelimpresiontipologias/delete/${dataId}`,
|
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
$('#confirm2delete').modal('toggle');
|
$('#confirm2delete').modal('toggle');
|
||||||
theTable.clearPipeline();
|
theTable3.clearPipeline();
|
||||||
theTable.row($(row)).invalidate().draw();
|
theTable3.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() ?>
|
||||||
|
|
||||||
@ -507,6 +527,7 @@
|
|||||||
// Notificar que no se pueden añadir más tipologías
|
// Notificar que no se pueden añadir más tipologías
|
||||||
editor.on( 'initCreate', function () {
|
editor.on( 'initCreate', function () {
|
||||||
if ( $('#tableOfPapelimpresiontipologias').DataTable().data().count() >= 3 ){
|
if ( $('#tableOfPapelimpresiontipologias').DataTable().data().count() >= 3 ){
|
||||||
|
editor.close();
|
||||||
popErrorAlert('<?= lang('Basic.global.sweet.maxRowsReached') ?>');
|
popErrorAlert('<?= lang('Basic.global.sweet.maxRowsReached') ?>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -553,16 +574,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Borrar registro
|
// Delete row
|
||||||
$(document).on('click', '.btn-delete', function(e) {
|
function remove_tipologias(dataId, row){
|
||||||
$(".btn-remove").attr('data-id', $(this).attr('data-id'));
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.btn-remove', function(e) {
|
$.ajax({
|
||||||
const dataId = $(this).attr('data-id');
|
|
||||||
const row = $(this).closest('tr');
|
|
||||||
if ($.isNumeric(dataId)) {
|
|
||||||
$.ajax({
|
|
||||||
url: `/configuracion/papelimpresiontipologias/delete/${dataId}`,
|
url: `/configuracion/papelimpresiontipologias/delete/${dataId}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
}).done((data, textStatus, jqXHR) => {
|
}).done((data, textStatus, jqXHR) => {
|
||||||
@ -572,9 +587,9 @@
|
|||||||
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() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user