Bug 29519: Allow resolution of claims return at checkin
Add a 'Resolve' button in the alert dialogue that is displayed when a lost item with a return claim is checked in. The button will trigger the usual resolution modal allowing the user to pick their resolution. This patch splits the resolution modal out of checkouts.js and checkouts-table.inc so it can be used outside of the checkouts table. We then reload it, optionally based upon the presence of the claims preference, where needed. This has the added benefit that it saves a little bit of page load data in cases where the feature is not enabled. Test plan 1. As we alter the file locations of the resolution handling code we need to test that normal claims functionality continue to work as expected. 2. Test the new functoinality by checking in an item that has been claimed as returned (but not yet resolved). The dialogue box should now contain a 'resolve' button next to each claimant and clicking upon it should trigger the resolution modal where the librarian can subsequently pick the resolution and submit it. Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
2d19bfb052
commit
1f746a585e
7 changed files with 108 additions and 85 deletions
|
@ -127,45 +127,3 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Resolve Return Claim Modal -->
|
||||
<div class="modal fade" id="claims-returned-resolved-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-resolved-modal-label">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="claims-returned-resolved-modal-label">Resolve return claim</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="claims-returned-resolved-code">Resolution</label>
|
||||
[% SET resolutions = AuthorisedValues.GetAuthValueDropbox('RETURN_CLAIM_RESOLUTION') %]
|
||||
<select class="form-control" id="claims-returned-resolved-modal-resolved-code">
|
||||
[% FOREACH r IN resolutions %]
|
||||
<option value="[% r.authorised_value | html %]">[% r.lib | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
|
||||
<label for="new_lost_status">New item lost value:</label>
|
||||
[% SET itemlost = AuthorisedValues.GetAuthValueDropbox('LOST') %]
|
||||
<select class="form-control" id="new_lost_status">
|
||||
<option value="0">(Not lost)</option>
|
||||
[% FOREACH lost IN itemlost %]
|
||||
<option value="[% lost.authorised_value | html %]">[% lost.lib | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="claims-returned-resolved-modal-id"/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="claims-returned-resolved-modal-btn-submit" type="button" class="btn btn-primary">
|
||||
<i id="claims-returned-resolved-modal-btn-submit-icon" class="fa fa-exclamation-circle"></i>
|
||||
<i id="claims-returned-resolved-modal-btn-submit-spinner" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i>
|
||||
Resolve claim
|
||||
</button>
|
||||
<button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<!-- Resolve Return Claim Modal -->
|
||||
<div class="modal fade" id="claims-returned-resolved-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-resolved-modal-label">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="claims-returned-resolved-modal-label">Resolve return claim</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="claims-returned-resolved-code">Resolution</label>
|
||||
[% SET resolutions = AuthorisedValues.GetAuthValueDropbox('RETURN_CLAIM_RESOLUTION') %]
|
||||
<select class="form-control" id="claims-returned-resolved-modal-resolved-code">
|
||||
[% FOREACH r IN resolutions %]
|
||||
<option value="[% r.authorised_value | html %]">[% r.lib | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
|
||||
<label for="new_lost_status">New item lost value:</label>
|
||||
[% SET itemlost = AuthorisedValues.GetAuthValueDropbox('LOST') %]
|
||||
<select class="form-control" id="new_lost_status">
|
||||
<option value="0">(Not lost)</option>
|
||||
[% FOREACH lost IN itemlost %]
|
||||
<option value="[% lost.authorised_value | html %]">[% lost.lib | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="claims-returned-resolved-modal-id"/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="claims-returned-resolved-modal-btn-submit" type="button" class="btn btn-primary">
|
||||
<i id="claims-returned-resolved-modal-btn-submit-icon" class="fa fa-exclamation-circle"></i>
|
||||
<i id="claims-returned-resolved-modal-btn-submit-spinner" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i>
|
||||
Resolve claim
|
||||
</button>
|
||||
<button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -932,6 +932,10 @@
|
|||
</div> <!-- /.row -->
|
||||
</main>
|
||||
|
||||
[% IF Koha.Preference('ClaimReturnedLostValue') %]
|
||||
[% INCLUDE 'modals/resolve_return_claim.inc' %]
|
||||
[% END %]
|
||||
|
||||
<!-- Modal -->
|
||||
<div id="barcodeSubmittedModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="barcodeSubmittedModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
|
@ -978,6 +982,9 @@
|
|||
</script>
|
||||
[% Asset.js("js/pages/circulation.js") | $raw %]
|
||||
[% Asset.js("js/checkouts.js") | $raw %]
|
||||
[% IF Koha.Preference('ClaimReturnedLostValue') %]
|
||||
[% Asset.js("js/resolve_claim_modal.js") | $raw %]
|
||||
[% END %]
|
||||
[% Asset.js("js/holds.js") | $raw %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
<script>
|
||||
|
|
|
@ -192,7 +192,7 @@
|
|||
<ul>
|
||||
[% FOREACH rc IN ReturnClaims %]
|
||||
<li>
|
||||
[% INCLUDE 'patron-title.inc' patron=rc.patron hide_patron_infos_if_needed=1 invert_name=1 %]
|
||||
[% INCLUDE 'patron-title.inc' patron=rc.patron hide_patron_infos_if_needed=1 invert_name=1 %] <a class="btn btn-default btn-xs return-claim-tools-resolve" role="button" data-return-claim-id="[% rc.id | html %]" data-current-lost-status="0"><i class="fa fa-check-square"></i> Resolve</a>
|
||||
</li>
|
||||
[% END %]
|
||||
</ul>
|
||||
|
@ -983,12 +983,23 @@
|
|||
</div> <!-- /.col-sm-12 -->
|
||||
</div> <!-- /.row -->
|
||||
|
||||
[% IF ( ReturnClaims ) %]
|
||||
[% INCLUDE 'modals/resolve_return_claim.inc' %]
|
||||
[% END %]
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
[% INCLUDE 'columns_settings.inc' %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
[% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
|
||||
[% Asset.js("js/pages/circulation.js") | $raw %]
|
||||
[% IF ( ReturnClaims ) %]
|
||||
<script>
|
||||
/* Set a variable needed by resolve_claim_modal.js */
|
||||
var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
|
||||
</script>
|
||||
[% Asset.js("js/resolve_claim_modal.js") | $raw %]
|
||||
[% END %]
|
||||
[% INCLUDE 'timepicker.inc' %]
|
||||
|
||||
<script>
|
||||
|
|
|
@ -853,6 +853,10 @@
|
|||
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
||||
</div> <!-- /.row -->
|
||||
|
||||
[% IF Koha.Preference('ClaimReturnedLostValue') %]
|
||||
[% INCLUDE 'modals/resolve_return_claim.inc' %]
|
||||
[% END %]
|
||||
|
||||
[% MACRO jsinclude BLOCK %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
[% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
|
||||
|
@ -885,6 +889,9 @@
|
|||
</script>
|
||||
[% Asset.js("js/pages/circulation.js") | $raw %]
|
||||
[% Asset.js("js/checkouts.js") | $raw %]
|
||||
[% IF Koha.Preference('ClaimReturnedLostValue') %]
|
||||
[% Asset.js("js/resolve_claim_modal.js") | $raw %]
|
||||
[% END %]
|
||||
[% Asset.js("js/holds.js") | $raw %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
[% INCLUDE 'str/members-menu.inc' %]
|
||||
|
|
|
@ -1185,48 +1185,6 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
// Handle return claim resolution
|
||||
$('body').on('click', '.return-claim-tools-resolve', function() {
|
||||
let id = $(this).data('return-claim-id');
|
||||
let current_lost_status = $(this).data('current-lost-status');
|
||||
|
||||
$('#claims-returned-resolved-modal-id').val(id);
|
||||
$("#new_lost_status").val(current_lost_status);
|
||||
let selected_option = $("#new_lost_status option:selected");
|
||||
$(selected_option).text(_("%s (current status)").format($(selected_option).text()));
|
||||
$('#claims-returned-resolved-modal').modal()
|
||||
});
|
||||
|
||||
$(document).on('click', '#claims-returned-resolved-modal-btn-submit', function(e) {
|
||||
let resolution = $('#claims-returned-resolved-modal-resolved-code').val();
|
||||
let new_lost_status = $('#new_lost_status').val();
|
||||
let id = $('#claims-returned-resolved-modal-id').val();
|
||||
|
||||
$('#claims-returned-resolved-modal-btn-submit-spinner').show();
|
||||
$('#claims-returned-resolved-modal-btn-submit-icon').hide();
|
||||
|
||||
params = {
|
||||
resolution: resolution,
|
||||
resolved_by: logged_in_user_borrowernumber,
|
||||
new_lost_status: new_lost_status
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '/api/v1/return_claims/' + id + '/resolve',
|
||||
type: 'PUT',
|
||||
data: JSON.stringify(params),
|
||||
success: function( data ) {
|
||||
$('#claims-returned-resolved-modal-btn-submit-spinner').hide();
|
||||
$('#claims-returned-resolved-modal-btn-submit-icon').show();
|
||||
$('#claims-returned-resolved-modal').modal('hide')
|
||||
|
||||
refreshReturnClaimsTable();
|
||||
},
|
||||
contentType: "json"
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$("#show_all_claims").on("click", function(e){
|
||||
e.preventDefault();
|
||||
$(".ctrl_link").removeClass("disabled");
|
||||
|
|
40
koha-tmpl/intranet-tmpl/prog/js/resolve_claim_modal.js
Normal file
40
koha-tmpl/intranet-tmpl/prog/js/resolve_claim_modal.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
$('body').on('click', '.return-claim-tools-resolve', function() {
|
||||
let id = $(this).data('return-claim-id');
|
||||
let current_lost_status = $(this).data('current-lost-status');
|
||||
|
||||
$('#claims-returned-resolved-modal-id').val(id);
|
||||
$("#new_lost_status").val(current_lost_status);
|
||||
let selected_option = $("#new_lost_status option:selected");
|
||||
$(selected_option).text(_("%s (current status)").format($(selected_option).text()));
|
||||
$('#claims-returned-resolved-modal').modal()
|
||||
});
|
||||
|
||||
$(document).on('click', '#claims-returned-resolved-modal-btn-submit', function(e) {
|
||||
let resolution = $('#claims-returned-resolved-modal-resolved-code').val();
|
||||
let new_lost_status = $('#new_lost_status').val();
|
||||
let id = $('#claims-returned-resolved-modal-id').val();
|
||||
|
||||
$('#claims-returned-resolved-modal-btn-submit-spinner').show();
|
||||
$('#claims-returned-resolved-modal-btn-submit-icon').hide();
|
||||
|
||||
params = {
|
||||
resolution: resolution,
|
||||
resolved_by: logged_in_user_borrowernumber,
|
||||
new_lost_status: new_lost_status
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: '/api/v1/return_claims/' + id + '/resolve',
|
||||
type: 'PUT',
|
||||
data: JSON.stringify(params),
|
||||
success: function(data) {
|
||||
$('#claims-returned-resolved-modal-btn-submit-spinner').hide();
|
||||
$('#claims-returned-resolved-modal-btn-submit-icon').show();
|
||||
$('#claims-returned-resolved-modal').modal('hide')
|
||||
|
||||
refreshReturnClaimsTable();
|
||||
},
|
||||
contentType: "json"
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in a new issue