@@ -, +, @@ show unresolved claims - If necessary, Enable claims returned functionality by defining a value in the ClaimReturnedLostValue system preference. - Open for checkout a patron who has items checked out. - From the table of checkouts, click "Claim returned" for one or more items. - As you mark items "Clamed returned," the the items should appear under the "Claims" tab. The corresonding filter links should be updated accordingly, "Show all X claims." - Mark one or more claims resolved. As you do so they should disappear from the list of claims. The filter links should be updated to reflect that there are some resolved and some unresolved claims. - Clicking each filter link should trigger the correct filter. - Test this process when the count of unresolved claims is zero and when the cound of resolved claims is zero. - Update a translation, e.g. fr-FR: > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for JavaScript strings, e.g. misc/translator/po/fr-FR-messages-js.po - Locate strings pulled from koha-tmpl/intranet-tmpl/prog/js/checkouts.js for translation, e.g.: #: koha-tmpl/intranet-tmpl/prog/js/checkouts.js:1086 msgid "Show 1 claim" msgid_plural "Show all {count} claims" msgstr[0] "" msgstr[1] "" - Edit the "msgstr" strings however you want (it's just for testing). - Install the updated translation: > perl translate install fr-FR - Switch to your newly translated language in the staff client and repeat the test plan above. The translated strings should appear. --- .../prog/css/src/staff-global.scss | 5 +- .../prog/en/includes/patron-return-claims.inc | 12 +++- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 59 +++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -70,7 +70,6 @@ a { } } - &.csv { background-image: url("../img/famfamfam/silk/page_white_excel.png"); } @@ -133,6 +132,10 @@ a { } } +a.ctrl_link { + display: inline-block; + padding-right: 1rem; +} aside { h5 { --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc @@ -1,14 +1,24 @@
+

+ [% IF ( patron.return_claims.resolved.count > 0 || patron.return_claims.unresolved.count > 0 ) %] + Show all [% patron.return_claims.count | html %] claim(s) + Show [% patron.return_claims.unresolved.count | html %] unresolved claims + [% ELSE %] + + + [% END %] +

+ - +
Claim IDResolved? Title Notes Created on Updated on Resolution  
--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -954,11 +954,25 @@ $(document).ready(function() { "bAutoWidth": false, "sDom": "rt", "aaSorting": [], + "aoColumnDefs": [ + { "bSortable": false, "bSearchable": false, 'aTargets': ['NoSort'] }, + { "sType": "anti-the", "aTargets": ["anti-the"] }, + ], "aoColumns": [ { "mDataProp": "id", "bVisible": false, }, + { + "mDataProp": function (oObj) { + if (oObj.resolution) { + return "is_resolved"; + } else { + return "is_unresolved"; + } + }, + "bVisible": false, + }, { "mDataProp": function ( oObj ) { let title = '' @@ -1068,10 +1082,41 @@ $(document).ready(function() { fnCallback(json) } ); }, + "search": { "search": "is_unresolved" }, + "footerCallback": function (row, data, start, end, display) { + var api = this.api(); + // Total over all pages + var colData = api.column(1).data(); + var is_unresolved = 0; + var is_resolved = 0; + colData.each(function( index, value ){ + if( index == "is_unresolved" ){ is_unresolved++; } + if (index == "is_resolved") { is_resolved++; } + }); + // Update footer + $("#return-claims-controls").html( showClaimFilter( is_unresolved, is_resolved ) ) + } }); } } + function showClaimFilter( is_unresolved, is_resolved ){ + var showAll, showUnresolved; + var total = Number( is_unresolved ) + Number( is_resolved ); + if( total > 0 ){ + showAll = __nx("Show 1 claim", "Show all {count} claims", total, { count: total }); + } else { + showAll = ""; + } + if( is_unresolved > 0 ){ + showUnresolved = __nx("Show 1 unresolved claim", "Show {count} unresolved claims", is_unresolved, { count: is_unresolved }) + } else { + showUnresolved = ""; + } + $("#show_all_claims").html( showAll ); + $("#show_unresolved_claims").html( showUnresolved ); + } + $('body').on('click', '.return-claim-tools-editnotes', function() { let id = $(this).data('return-claim-id'); $('#return-claim-notes-static-' + id).parent().dblclick(); @@ -1182,4 +1227,18 @@ $(document).ready(function() { }); + $("#show_all_claims").on("click", function(e){ + e.preventDefault(); + $(".ctrl_link").removeClass("disabled"); + $(this).addClass("disabled"); + $("#return-claims-table").DataTable().search("").draw(); + }); + + $("#show_unresolved_claims").on("click", function (e) { + e.preventDefault(); + $(".ctrl_link").removeClass("disabled"); + $(this).addClass("disabled"); + $("#return-claims-table").DataTable().search("is_unresolved").draw(); + }); + }); --