mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Creado popups de alerts para exito y error
This commit is contained in:
2
ci4/.env
2
ci4/.env
@ -22,7 +22,7 @@ CI_ENVIRONMENT = development
|
||||
# APP
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
app.baseURL = 'https://sk-jjo.imnavajas.es'
|
||||
app.baseURL = 'https://sk-imn.imnavajas.es'
|
||||
#app.baseURL = 'https://sk-imn.imnavajas.es'
|
||||
# app.baseURL = "http://safekat.test/"
|
||||
# app.forceGlobalSecureRequests = false
|
||||
|
||||
@ -234,7 +234,8 @@ abstract class GoBaseResourceController extends \CodeIgniter\RESTful\ResourceCon
|
||||
|
||||
}
|
||||
|
||||
$message = lang('Basic.global.deleteSuccess', [$objName]);
|
||||
// $message = lang('Basic.global.deleteSuccess', [$objName]); IMN commented
|
||||
$message = lang('Basic.global.deleteSuccess', [lang('Basic.global.record')]);
|
||||
$response = $this->respondDeleted(['id' => $id, 'msg' => $message]);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -63,24 +63,50 @@ if (session()->has('error')) {
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="sk-alert">
|
||||
<div class="alert alert-warning d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-check ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"><?= lang('Basic.global.Warning') ?></h5>
|
||||
<p class="mb-0"><?= $warningMessage; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
$('#sk-alert').on('click', function (e) {
|
||||
function popSuccessAlert(successMsg){
|
||||
var htmlString = `
|
||||
<div class="alert alert-success d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-check ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"><?= lang('Basic.global.Success') ?></h5>
|
||||
<p class="mb-0">` + successMsg + `</p>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$(this).fadeOut("slow");
|
||||
});
|
||||
$(window).scrollTop(0);
|
||||
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
setTimeout(function(){
|
||||
$('#sk-alert').fadeOut("slow");
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
function popErrorAlert(errorMsg){
|
||||
var htmlString = `
|
||||
<div class="alert alert-error d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-error ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"><?= lang('Basic.global.Error') ?></h5>
|
||||
<p class="mb-0">` + errorMsg + `</p>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$(window).scrollTop(0);
|
||||
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
setTimeout(function(){
|
||||
$('#sk-alert').fadeOut("slow");
|
||||
}, 5000);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
@ -107,25 +107,16 @@ const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
||||
url: `/tarifas/tarifaacabado/delete/${dataId}`,
|
||||
method: 'GET',
|
||||
}).done((data, textStatus, jqXHR) => {
|
||||
$('#confirm2delete').modal('toggle'),
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: data.msg ?? jqXHR.statusText,
|
||||
});
|
||||
|
||||
$('#confirm2delete').modal('toggle');
|
||||
theTable.clearPipeline();
|
||||
theTable.row($(row)).invalidate().draw();
|
||||
popSuccessAlert(data.msg ?? jqXHR.statusText);
|
||||
}).fail((jqXHR, textStatus, errorThrown) => {
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: jqXHR.responseJSON.messages.error,
|
||||
});
|
||||
popErrorAlert(jqXHR.responseJSON.messages.error)
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user