mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Eliminado Swal por Toastr. Refactorizadas las alertBoxes
This commit is contained in:
@ -114,7 +114,7 @@ class Tarifaacabado extends \App\Controllers\GoBaseResourceController
|
||||
|
||||
if ($thenRedirect) :
|
||||
if (!empty($this->indexRoute)) :
|
||||
return redirect()->to(site_url('/tarifas/tarifaacabado/edit/' . $id))->with('sweet-success', $message);
|
||||
return redirect()->to(site_url('/tarifas/tarifaacabado/edit/' . $id))->with('message', $message);
|
||||
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||
else:
|
||||
return $this->redirect2listView('sweet-success', $message);
|
||||
|
||||
@ -17,65 +17,24 @@ return [
|
||||
'updatedAt' => 'Actualizado en',
|
||||
'userCreatedId' => 'ID Usuario "Creado en"',
|
||||
'userUpdateId' => 'ID Usuario "Actualizado en"',
|
||||
'validation' => [
|
||||
'formula_price' => [
|
||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'nombre' => [
|
||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'precio_min' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
],
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'importe_fijo' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
],
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'user_created_id' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'user_update_id' => [
|
||||
'integer' => 'El campo {field} debe contener un número entero.',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
'validation' => [
|
||||
'ajuste' => [
|
||||
'decimal' => 'El campo {field} debe contener un número decimal',
|
||||
'required' => 'El campo {field} es obligatorio.',
|
||||
|
||||
],
|
||||
|
||||
|
||||
],
|
||||
|
||||
|
||||
|
||||
@ -40,31 +40,31 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
|
||||
|
||||
protected $validationRules = [
|
||||
"nombre" => [
|
||||
"label" => "TarifaAcabado.nombre",
|
||||
"label" => "Tarifaacabado.nombre",
|
||||
"rules" => "trim|required|max_length[255]",
|
||||
],
|
||||
"precio_min" => [
|
||||
"label" => "TarifaAcabado.precioMin",
|
||||
"label" => "Tarifaacabado.precioMin",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"label" => "TarifaAcabado.importeFijo",
|
||||
"label" => "Tarifaacabado.importeFijo",
|
||||
"rules" => "required|decimal",
|
||||
],
|
||||
];
|
||||
|
||||
protected $validationMessages = [
|
||||
"nombre" => [
|
||||
"max_length" => "TarifaAcabado.validation.nombre.max_length",
|
||||
"required" => "TarifaAcabado.validation.nombre.required",
|
||||
"max_length" => "Tarifaacabado.validation.nombre.max_length",
|
||||
"required" => "Tarifaacabado.validation.nombre.required",
|
||||
],
|
||||
"precio_min" => [
|
||||
"required" => "TarifaAcabado.validation.precio_min.required",
|
||||
"decimal" => "TarifaAcabado.validation.precio_min.decimal",
|
||||
"required" => "Tarifaacabado.validation.precio_min.required",
|
||||
"decimal" => "Tarifaacabado.validation.precio_min.decimal",
|
||||
],
|
||||
"importe_fijo" => [
|
||||
"required" => "TarifaAcabado.validation.importe_fijo.required",
|
||||
"decimal" => "TarifaAcabado.validation.importe_fijo.decimal",
|
||||
"required" => "Tarifaacabado.validation.importe_fijo.required",
|
||||
"decimal" => "Tarifaacabado.validation.importe_fijo.decimal",
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
$errorMessage = $errorMessage ?? session('errorMessage');
|
||||
$warningMessage = session('warningMessage');
|
||||
|
||||
@ -19,67 +18,24 @@ if (session()->has('error')) {
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php if (isset($successMessage) && $successMessage): ?>
|
||||
<div class="alert alert-success alert-dismissible 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"><?= $successMessage; ?></p>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($errorMessage) && $errorMessage): ?>
|
||||
<div class="alert alert-danger alert-dismissible d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-ban 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"><?= $errorMessage; ?></p>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if (isset($warningMessage) && $warningMessage): ?>
|
||||
<div class="alert alert-warning alert-dismissible d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-bell 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>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="sk-alert">
|
||||
</div>
|
||||
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
function popSuccessAlert(successMsg){
|
||||
function popAlert(message, alertType){
|
||||
var alertClass = "alert-" + alertType;
|
||||
var alertIcon = alertType == "success" ? "ti-check" : "ti-" + alertType;
|
||||
var htmlString = `
|
||||
<div class="alert alert-success d-flex align-items-baseline" role="alert">
|
||||
<div class="alert ${alertClass} 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>
|
||||
<i class="ti ${alertIcon} 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>
|
||||
<h5 class="alert-heading mb-2">${message}</h5>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$(window).scrollTop(0);
|
||||
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||
setTimeout(function(){
|
||||
@ -88,26 +44,30 @@ function popSuccessAlert(successMsg){
|
||||
});
|
||||
}
|
||||
|
||||
function popSuccessAlert(successMsg){
|
||||
popAlert(successMsg, "success");
|
||||
}
|
||||
|
||||
function popWarningAlert(warningMsg){
|
||||
popAlert(warningMsg, "warning");
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
popAlert(errorMsg, "error");
|
||||
}
|
||||
|
||||
<?php if (isset($successMessage) && $successMessage){ ?>
|
||||
popSuccessAlert(`<?= $successMessage ?>`);
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($warningMessage) && $warningMessage){ ?>
|
||||
popWarningAlert(`<?= $warningMessage ?>`);
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($errorMessage) && $errorMessage){ ?>
|
||||
popErrorAlert(`<?= $errorMessage ?>`);
|
||||
<?php } ?>
|
||||
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
@ -1,22 +1,16 @@
|
||||
<?php if (config('Basics')->theme['name'] == 'vuexy') { ?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
||||
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
|
||||
<path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
|
||||
</symbol>
|
||||
</svg>
|
||||
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<svg class="bi mt-1 me-3 float-start" width="24" height="24" role="img" aria-label="Success:">
|
||||
<use xlink:href="#exclamation-triangle-fill"/>
|
||||
</svg>
|
||||
<button type="button" class="btn-close float-end" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
<div class="fdfs">
|
||||
<h4>Please correct the errors below:</h4>
|
||||
<ul>
|
||||
<?php foreach ($errors as $error) : ?>
|
||||
<li><?= esc($error) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="alert alert-warning alert-dismissible d-flex align-items-baseline" role="alert">
|
||||
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||
<i class="ti ti-bell ti-sm"></i>
|
||||
</span>
|
||||
<div class="d-flex flex-column ps-1">
|
||||
<h5 class="alert-heading mb-2"><?= lang('Basic.global.formErr2') ?></h5>
|
||||
<ul>
|
||||
<?php foreach ($errors as $error) : ?>
|
||||
<li><?= esc($error) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
||||
</button>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
|
||||
@ -1,90 +1,41 @@
|
||||
<!-- Push section css -->
|
||||
<?= $this->section('css') ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-dark@4/dark.css">
|
||||
<!-- <link rel="stylesheet" href="--><?php //= site_url('themes/vuexy/vendor/libs/toastr/toastr.css') ?><!--"/>-->
|
||||
|
||||
1 <style>
|
||||
/* Toastr */
|
||||
.colored-toast.swal2-icon-success {
|
||||
background-color: #478921 !important;
|
||||
}
|
||||
|
||||
.colored-toast.swal2-icon-error {
|
||||
background-color: #c42a2a !important;
|
||||
}
|
||||
|
||||
.colored-toast.swal2-icon-warning {
|
||||
background-color: #f8bb86 !important;
|
||||
}
|
||||
|
||||
.colored-toast.swal2-icon-info {
|
||||
background-color: #3fc3ee !important;
|
||||
}
|
||||
|
||||
.colored-toast.swal2-icon-question {
|
||||
background-color: #87adbd !important;
|
||||
}
|
||||
|
||||
.colored-toast .swal2-title {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.colored-toast .swal2-close {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.colored-toast .swal2-html-container {
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/toastr/toastr.css') ?>"/>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
<!-- Push section js -->
|
||||
<?= $this->section('additionalExternalJs') ?>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js"></script>
|
||||
<!--<script src="--><?php //= site_url('themes/vuexy/vendor/libs/toastr/toastr.js') ?><!--"></script>-->
|
||||
<script src="<?= site_url('themes/vuexy/vendor/libs/toastr/toastr.js') ?>"></script>
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
const Toast = Swal.mixin({
|
||||
toast: true,
|
||||
position: 'top-right',
|
||||
iconColor: 'white',
|
||||
customClass: {
|
||||
popup: 'colored-toast'
|
||||
},
|
||||
showConfirmButton: false,
|
||||
timer: 6000,
|
||||
timerProgressBar: true,
|
||||
didOpen: (toast) => {
|
||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
||||
}
|
||||
});
|
||||
toastr.options = {
|
||||
"closeButton": false,
|
||||
"debug": false,
|
||||
"newestOnTop": false,
|
||||
"progressBar": false,
|
||||
"positionClass": "toast-top-right",
|
||||
"preventDuplicates": false,
|
||||
"onclick": null,
|
||||
"showDuration": "300",
|
||||
"hideDuration": "1000",
|
||||
"timeOut": "5000",
|
||||
"extendedTimeOut": "1000",
|
||||
"showEasing": "swing",
|
||||
"hideEasing": "linear",
|
||||
"showMethod": "fadeIn",
|
||||
"hideMethod": "fadeOut"
|
||||
};
|
||||
|
||||
<?php if (session('sweet-success')) { ?>
|
||||
Toast.fire({
|
||||
icon: 'success',
|
||||
title: '<?= session('sweet-success.') ?>'
|
||||
});
|
||||
<?php } ?>
|
||||
<?php if (session('sweet-warning')) { ?>
|
||||
Toast.fire({
|
||||
icon: 'warning',
|
||||
title: '<?= session('sweet-warning.') ?>'
|
||||
});
|
||||
<?php } ?>
|
||||
<?php if (session('sweet-error')) { ?>
|
||||
Toast.fire({
|
||||
icon: 'error',
|
||||
title: '<?= session('sweet-error.') ?>'
|
||||
});
|
||||
<?php } ?>
|
||||
toastr.success(`<?= session('sweet-success') ?>`);
|
||||
<?php } ?>
|
||||
<?php if (session('sweet-warning')) { ?>
|
||||
toastr.success(`<?= session('sweet-warning') ?>`);
|
||||
<?php } ?>
|
||||
<?php if (session('sweet-error')) { ?>
|
||||
toastr.success(`<?= session('sweet-error') ?>`);
|
||||
<?php } ?>
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
@ -39,8 +39,7 @@
|
||||
|
||||
|
||||
<?= $this->section('additionalInlineJs') ?>
|
||||
|
||||
const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
||||
const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
||||
const actionBtns = function(data) {
|
||||
return `
|
||||
<td class="text-right py-0 align-middle">
|
||||
@ -120,7 +119,6 @@ const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
<?= $this->endSection() ?>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user