mirror of
https://github.com/devcode-it/openstamanager.git
synced 2024-12-22 21:28:08 +01:00
Miglioramenti notifiche hook
This commit is contained in:
parent
0af50b1984
commit
0619a3a377
@ -87,24 +87,43 @@ if (Auth::check()) {
|
||||
result = JSON.parse(data);
|
||||
|
||||
$("#hook-loader-" + hook.id).remove();
|
||||
message = \'<li class="hook-element"><a href="\' + (result.link ? result.link : "#") + \'"><i class="\' + result.icon + \'"></i><span class="small" > \' + result.message + \'</span></a></li>\';
|
||||
|
||||
// Inserimento della notifica
|
||||
if(result.notify) {
|
||||
hooks_count = $("#hooks-count");
|
||||
number = parseInt(hooks_count.text());
|
||||
number = isNaN(number) ? 0 : number;
|
||||
|
||||
hooks_count.text(parseInt(number) + 1);
|
||||
|
||||
$("#hooks").prepend(message);
|
||||
} else {
|
||||
$("#hooks").append(message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
notification = \'<li class="hook-element"><a href="\' + (result.link ? result.link : "#") + \'"><i class="\' + result.icon + \'"></i><span class="small" > \' + result.message + \'</span></a></li>\';
|
||||
|
||||
// Inserimento della notifica
|
||||
if(result.notify) {
|
||||
hooks_count = $("#hooks-count");
|
||||
number = parseInt(hooks_count.text());
|
||||
number = isNaN(number) ? 0 : number;
|
||||
|
||||
hooks_count.text(parseInt(number) + 1);
|
||||
|
||||
$("#hooks").prepend(notification);
|
||||
} else {
|
||||
$("#hooks").append(notification);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Rimozione eventuale della rotella di caricamento
|
||||
if($(".hook-element").length == hooks.length) {
|
||||
$("#hooks-loading").hide();
|
||||
|
||||
$(".notifications-menu .dropdown-toggle").attr(\'data-toggle\',\'dropdown\');
|
||||
$(".notifications-menu .dropdown-toggle").removeClass(\'disabled\');
|
||||
|
||||
$("#hooks-loading").hide();
|
||||
|
||||
if (hooks.length>0){
|
||||
$("#hooks-header").append(\'<span class="small" >'.tr('Hai _NUM_ notific_END_', [
|
||||
'_NUM_' => '\' + (parseInt(number) + 1) + \'',
|
||||
'_END_' => '\' + ((parseInt(number) === 0) ? \''.tr('a').'\' : \''.tr('he').'\') + \'',
|
||||
]).'</small>\');
|
||||
}else{
|
||||
$("#hooks-header").append(\'<span class="small" >'.tr('Nessuna notifica').'</small>\');
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -228,8 +228,8 @@ if (Auth::check()) {
|
||||
<!-- Navbar Right Menu -->
|
||||
<div class="navbar-custom-menu">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown notifications-menu">
|
||||
<a href="#" class="dropdown-toggle btn-github" data-toggle="dropdown">
|
||||
<li class="dropdown notifications-menu" >
|
||||
<a href="#" class="dropdown-toggle btn-github disabled">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
<span class="label label-warning">
|
||||
<span id="hooks-loading"><i class="fa fa-spinner fa-spin"></i></span>
|
||||
@ -237,6 +237,7 @@ if (Auth::check()) {
|
||||
</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="header" id="hooks-header" ></li>
|
||||
<li><ul class="menu" id="hooks">
|
||||
|
||||
</ul></li>
|
||||
|
@ -118,7 +118,7 @@ $(document).ready(function () {
|
||||
|
||||
// Messaggi automatici di eliminazione
|
||||
$(document).on('click', '.ask', function () {
|
||||
popup(this);
|
||||
message(this);
|
||||
});
|
||||
|
||||
// Pulsanti di Datatables
|
||||
@ -176,7 +176,7 @@ $(document).ready(function () {
|
||||
$(this).attr("data-id_records", table.data('selected'));
|
||||
$(this).data("id_records", table.data('selected'));
|
||||
|
||||
popup(this);
|
||||
message(this);
|
||||
|
||||
$(this).attr("data-id_records", "");
|
||||
$(this).data("id_records", "");
|
||||
@ -1307,7 +1307,7 @@ function setContrast(backgroundcolor) {
|
||||
}
|
||||
}
|
||||
|
||||
function popup(element) {
|
||||
function message(element) {
|
||||
data = $.extend({}, $(element).data());
|
||||
|
||||
var title = globals.translations.deleteTitle;
|
||||
|
@ -29,12 +29,15 @@ class InvoiceHook extends HookManager
|
||||
$message = tr('Ci sono _NUM_ fatture passive da importare', [
|
||||
'_NUM_' => $count,
|
||||
]);
|
||||
$icon = 'fa fa-file-text-o text-yellow';
|
||||
} else {
|
||||
$message = tr('Nessuna fattura passiva da importare');
|
||||
$icon = 'fa fa-file-text-o text-green';
|
||||
$link = '#';
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => 'fa fa-file-text-o',
|
||||
'icon' => $icon,
|
||||
'link' => $link,
|
||||
'message' => $message,
|
||||
'notify' => !empty($count),
|
||||
|
@ -29,12 +29,15 @@ class ReceiptHook extends HookManager
|
||||
$message = tr('Ci sono _NUM_ ricevute da importare', [
|
||||
'_NUM_' => $count,
|
||||
]);
|
||||
$icon = 'fa fa-ticket text-yellow';
|
||||
} else {
|
||||
$message = tr('Nessuna ricevuta da importare');
|
||||
$icon = 'fa fa-ticket text-green';
|
||||
$link = '#';
|
||||
}
|
||||
|
||||
return [
|
||||
'icon' => 'fa fa-ticket',
|
||||
'icon' => $icon,
|
||||
'link' => $link,
|
||||
'message' => $message,
|
||||
'notify' => !empty($count),
|
||||
|
Loading…
Reference in New Issue
Block a user