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
Branches
Tags
No related merge requests found
......@@ -251,30 +251,27 @@ $(document).ready(function registerAccountAjax() {
});
/* finc specific */
$('.itemCount').each(function() {
let selector = $(this).attr('id');
if(!selector)
return;
$(document).ready(function () {
countables = new Array;
$('.itemCount').each(function() {
countables.push($(this).attr('id'));
});
VuFind.account.register("itemCount", {
selector: "#" + selector,
ajaxMethod: "getAdditionalAccountInfo",
data: {'views':[selector]},
render: function render($element, status, ICON_LEVELS) {
var level = ICON_LEVELS.NONE;
var html = '';
$.each(status, function (i, result) {
$.each(result, function (id, itemCount) {
if ($element.attr("id") === id && itemCount > 0) {
level = ICON_LEVELS.GOOD;
html += '<span class="badge ok">' + itemCount + '</span>';
}
});
$.ajax({
dataType: 'json',
method: 'GET',
url: VuFind.path + '/AJAX/JSON?method=getAdditionalAccountInfo',
data: {'views':countables}
})
.done(function(response) {
if (response.data.countFines != undefined && response.data.countFines != 0) {
$('#getFinesTotal').text(response.data.countFines);
$('.fines').addClass('red-alert');
}
$.each(response.data.countViewItems, function (id, itemCount) {
$('#'+id).text('('+itemCount+')');
});
$element.html(html);
return level;
}
});
});
});
/* 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