Skip to content
Snippets Groups Projects
Commit 0897036c authored by Robert Lange's avatar Robert Lange
Browse files

refs #21668 [finc] fix menu itemcount

* use solution from de_15 money_formatter.js
parent d3f5816b
No related merge requests found
...@@ -251,30 +251,27 @@ $(document).ready(function registerAccountAjax() { ...@@ -251,30 +251,27 @@ $(document).ready(function registerAccountAjax() {
}); });
/* finc specific */ /* finc specific */
$('.itemCount').each(function() { $(document).ready(function () {
let selector = $(this).attr('id'); countables = new Array;
if(!selector) $('.itemCount').each(function() {
return; countables.push($(this).attr('id'));
});
VuFind.account.register("itemCount", { $.ajax({
selector: "#" + selector, dataType: 'json',
ajaxMethod: "getAdditionalAccountInfo", method: 'GET',
data: {'views':[selector]}, url: VuFind.path + '/AJAX/JSON?method=getAdditionalAccountInfo',
render: function render($element, status, ICON_LEVELS) { data: {'views':countables}
var level = ICON_LEVELS.NONE; })
var html = ''; .done(function(response) {
$.each(status, function (i, result) { if (response.data.countFines != undefined && response.data.countFines != 0) {
$.each(result, function (id, itemCount) { $('#getFinesTotal').text(response.data.countFines);
if ($element.attr("id") === id && itemCount > 0) { $('.fines').addClass('red-alert');
level = ICON_LEVELS.GOOD; }
html += '<span class="badge ok">' + itemCount + '</span>'; $.each(response.data.countViewItems, function (id, itemCount) {
} $('#'+id).text('('+itemCount+')');
});
}); });
$element.html(html); });
return level;
}
});
}); });
/* finc specific - END */ /* finc specific - END */
}); });
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment