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 ($thenRedirect) :
|
||||||
if (!empty($this->indexRoute)) :
|
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);
|
//return redirect()->to(route_to($this->indexRoute))->with('sweet-success', $message);
|
||||||
else:
|
else:
|
||||||
return $this->redirect2listView('sweet-success', $message);
|
return $this->redirect2listView('sweet-success', $message);
|
||||||
|
|||||||
@ -17,65 +17,24 @@ return [
|
|||||||
'updatedAt' => 'Actualizado en',
|
'updatedAt' => 'Actualizado en',
|
||||||
'userCreatedId' => 'ID Usuario "Creado en"',
|
'userCreatedId' => 'ID Usuario "Creado en"',
|
||||||
'userUpdateId' => 'ID Usuario "Actualizado 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' => [
|
'validation' => [
|
||||||
'nombre' => [
|
'nombre' => [
|
||||||
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
'max_length' => 'El campo {field} no puede exceder {param} caracteres en longitud.',
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
],
|
|
||||||
|
|
||||||
'validation' => [
|
|
||||||
'precio_min' => [
|
'precio_min' => [
|
||||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
],
|
],
|
||||||
],
|
|
||||||
|
|
||||||
'validation' => [
|
|
||||||
'importe_fijo' => [
|
'importe_fijo' => [
|
||||||
'decimal' => 'El campo {field} debe contener un número decimal.',
|
'decimal' => 'El campo {field} debe contener un número decimal.',
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
'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' => [
|
'ajuste' => [
|
||||||
'decimal' => 'El campo {field} debe contener un número decimal',
|
'decimal' => 'El campo {field} debe contener un número decimal',
|
||||||
'required' => 'El campo {field} es obligatorio.',
|
'required' => 'El campo {field} es obligatorio.',
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -40,31 +40,31 @@ class TarifaacabadoModel extends \App\Models\GoBaseModel
|
|||||||
|
|
||||||
protected $validationRules = [
|
protected $validationRules = [
|
||||||
"nombre" => [
|
"nombre" => [
|
||||||
"label" => "TarifaAcabado.nombre",
|
"label" => "Tarifaacabado.nombre",
|
||||||
"rules" => "trim|required|max_length[255]",
|
"rules" => "trim|required|max_length[255]",
|
||||||
],
|
],
|
||||||
"precio_min" => [
|
"precio_min" => [
|
||||||
"label" => "TarifaAcabado.precioMin",
|
"label" => "Tarifaacabado.precioMin",
|
||||||
"rules" => "required|decimal",
|
"rules" => "required|decimal",
|
||||||
],
|
],
|
||||||
"importe_fijo" => [
|
"importe_fijo" => [
|
||||||
"label" => "TarifaAcabado.importeFijo",
|
"label" => "Tarifaacabado.importeFijo",
|
||||||
"rules" => "required|decimal",
|
"rules" => "required|decimal",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $validationMessages = [
|
protected $validationMessages = [
|
||||||
"nombre" => [
|
"nombre" => [
|
||||||
"max_length" => "TarifaAcabado.validation.nombre.max_length",
|
"max_length" => "Tarifaacabado.validation.nombre.max_length",
|
||||||
"required" => "TarifaAcabado.validation.nombre.required",
|
"required" => "Tarifaacabado.validation.nombre.required",
|
||||||
],
|
],
|
||||||
"precio_min" => [
|
"precio_min" => [
|
||||||
"required" => "TarifaAcabado.validation.precio_min.required",
|
"required" => "Tarifaacabado.validation.precio_min.required",
|
||||||
"decimal" => "TarifaAcabado.validation.precio_min.decimal",
|
"decimal" => "Tarifaacabado.validation.precio_min.decimal",
|
||||||
],
|
],
|
||||||
"importe_fijo" => [
|
"importe_fijo" => [
|
||||||
"required" => "TarifaAcabado.validation.importe_fijo.required",
|
"required" => "Tarifaacabado.validation.importe_fijo.required",
|
||||||
"decimal" => "TarifaAcabado.validation.importe_fijo.decimal",
|
"decimal" => "Tarifaacabado.validation.importe_fijo.decimal",
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$errorMessage = $errorMessage ?? session('errorMessage');
|
$errorMessage = $errorMessage ?? session('errorMessage');
|
||||||
$warningMessage = session('warningMessage');
|
$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 id="sk-alert">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?= $this->section('additionalInlineJs') ?>
|
<?= $this->section('additionalInlineJs') ?>
|
||||||
|
|
||||||
function popSuccessAlert(successMsg){
|
function popAlert(message, alertType){
|
||||||
|
var alertClass = "alert-" + alertType;
|
||||||
|
var alertIcon = alertType == "success" ? "ti-check" : "ti-" + alertType;
|
||||||
var htmlString = `
|
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">
|
<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>
|
</span>
|
||||||
<div class="d-flex flex-column ps-1">
|
<div class="d-flex flex-column ps-1">
|
||||||
<h5 class="alert-heading mb-2"><?= lang('Basic.global.Success') ?></h5>
|
<h5 class="alert-heading mb-2">${message}</h5>
|
||||||
<p class="mb-0">` + successMsg + `</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
$(window).scrollTop(0);
|
$(window).scrollTop(0);
|
||||||
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
$('#sk-alert').hide().empty().html(htmlString).fadeIn("slow", function(){
|
||||||
setTimeout(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){
|
function popErrorAlert(errorMsg){
|
||||||
var htmlString = `
|
popAlert(errorMsg, "error");
|
||||||
<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);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<?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() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|||||||
@ -1,22 +1,16 @@
|
|||||||
<?php if (config('Basics')->theme['name'] == 'vuexy') { ?>
|
<div class="alert alert-warning alert-dismissible d-flex align-items-baseline" role="alert">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
<span class="alert-icon alert-icon-lg text-primary me-2">
|
||||||
<symbol id="exclamation-triangle-fill" fill="currentColor" viewBox="0 0 16 16">
|
<i class="ti ti-bell ti-sm"></i>
|
||||||
<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"/>
|
</span>
|
||||||
</symbol>
|
<div class="d-flex flex-column ps-1">
|
||||||
</svg>
|
<h5 class="alert-heading mb-2"><?= lang('Basic.global.formErr2') ?></h5>
|
||||||
|
<ul>
|
||||||
<div class="alert alert-warning" role="alert">
|
<?php foreach ($errors as $error) : ?>
|
||||||
<svg class="bi mt-1 me-3 float-start" width="24" height="24" role="img" aria-label="Success:">
|
<li><?= esc($error) ?></li>
|
||||||
<use xlink:href="#exclamation-triangle-fill"/>
|
<?php endforeach ?>
|
||||||
</svg>
|
</ul>
|
||||||
<button type="button" class="btn-close float-end" data-bs-dismiss="alert" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close">
|
||||||
<div class="fdfs">
|
</button>
|
||||||
<h4>Please correct the errors below:</h4>
|
|
||||||
<ul>
|
|
||||||
<?php foreach ($errors as $error) : ?>
|
|
||||||
<li><?= esc($error) ?></li>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,90 +1,41 @@
|
|||||||
<!-- Push section css -->
|
<!-- Push section css -->
|
||||||
<?= $this->section('css') ?>
|
<?= $this->section('css') ?>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
|
<link rel="stylesheet" href="<?= site_url('themes/vuexy/vendor/libs/toastr/toastr.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>
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Push section js -->
|
<!-- Push section js -->
|
||||||
<?= $this->section('additionalExternalJs') ?>
|
<?= $this->section('additionalExternalJs') ?>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.all.min.js"></script>
|
<script src="<?= site_url('themes/vuexy/vendor/libs/toastr/toastr.js') ?>"></script>
|
||||||
<!--<script src="--><?php //= site_url('themes/vuexy/vendor/libs/toastr/toastr.js') ?><!--"></script>-->
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?= $this->section('additionalInlineJs') ?>
|
<?= $this->section('additionalInlineJs') ?>
|
||||||
|
|
||||||
const Toast = Swal.mixin({
|
toastr.options = {
|
||||||
toast: true,
|
"closeButton": false,
|
||||||
position: 'top-right',
|
"debug": false,
|
||||||
iconColor: 'white',
|
"newestOnTop": false,
|
||||||
customClass: {
|
"progressBar": false,
|
||||||
popup: 'colored-toast'
|
"positionClass": "toast-top-right",
|
||||||
},
|
"preventDuplicates": false,
|
||||||
showConfirmButton: false,
|
"onclick": null,
|
||||||
timer: 6000,
|
"showDuration": "300",
|
||||||
timerProgressBar: true,
|
"hideDuration": "1000",
|
||||||
didOpen: (toast) => {
|
"timeOut": "5000",
|
||||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
"extendedTimeOut": "1000",
|
||||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
"showEasing": "swing",
|
||||||
}
|
"hideEasing": "linear",
|
||||||
});
|
"showMethod": "fadeIn",
|
||||||
|
"hideMethod": "fadeOut"
|
||||||
|
};
|
||||||
|
|
||||||
<?php if (session('sweet-success')) { ?>
|
<?php if (session('sweet-success')) { ?>
|
||||||
Toast.fire({
|
toastr.success(`<?= session('sweet-success') ?>`);
|
||||||
icon: 'success',
|
<?php } ?>
|
||||||
title: '<?= session('sweet-success.') ?>'
|
<?php if (session('sweet-warning')) { ?>
|
||||||
});
|
toastr.success(`<?= session('sweet-warning') ?>`);
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if (session('sweet-warning')) { ?>
|
<?php if (session('sweet-error')) { ?>
|
||||||
Toast.fire({
|
toastr.success(`<?= session('sweet-error') ?>`);
|
||||||
icon: 'warning',
|
<?php } ?>
|
||||||
title: '<?= session('sweet-warning.') ?>'
|
|
||||||
});
|
|
||||||
<?php } ?>
|
|
||||||
<?php if (session('sweet-error')) { ?>
|
|
||||||
Toast.fire({
|
|
||||||
icon: 'error',
|
|
||||||
title: '<?= session('sweet-error.') ?>'
|
|
||||||
});
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
@ -39,8 +39,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<?= $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 actionBtns = function(data) {
|
const actionBtns = function(data) {
|
||||||
return `
|
return `
|
||||||
<td class="text-right py-0 align-middle">
|
<td class="text-right py-0 align-middle">
|
||||||
@ -120,7 +119,6 @@ const lastColNr = $('#tableOfTarifasacabado').find("tr:first th").length - 1;
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
<?= $this->endSection() ?>
|
<?= $this->endSection() ?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user