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