From: Galen Charlton Date: Wed, 3 Jun 2020 19:01:34 +0000 (-0400) Subject: add ability to unstage an appointment in the staff interface X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=58df7377d05b85572106c24d806c5a6ee741fcc2;p=working%2FEvergreen.git add ability to unstage an appointment in the staff interface * add open-ils.curbside.mark_unstaged method * add button in 'staged and ready' tab Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm index caa415a0a4..717008a3b9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Curbside.pm @@ -802,6 +802,35 @@ __PACKAGE__->register_method( } ); +sub mark_unstaged { + my ($self, $conn, $authtoken, $appointment) = @_; + my $e = new_editor(xact => 1, authtoken => $authtoken); + return $e->die_event unless $e->checkauth; + return $e->die_event unless $e->allowed("STAFF_LOGIN"); + + my $slot = $e->retrieve_action_curbside($appointment); + return undef unless ($slot); + + $slot->clear_staged(); + $slot->clear_stage_staff(); + $e->update_action_curbside($slot) or return $e->die_event; + $e->commit; + + return $e->retrieve_action_curbside($slot->id); +} +__PACKAGE__->register_method( + method => "mark_unstaged", + api_name => "open-ils.curbside.mark_unstaged", + signature => { + params => [ + {type => 'string', desc => 'Authentication token'}, + {type => 'number', desc => 'Appointment ID'}, + ], + return => { desc => 'Appointment on success, nothing when no appointment found, '. + 'an ILS Event on permission error'} + } +); + sub mark_arrived { my ($self, $conn, $authtoken, $appointment) = @_; my $e = new_editor(xact => 1, authtoken => $authtoken); diff --git a/Open-ILS/src/templates/staff/circ/curbside/index.tt2 b/Open-ILS/src/templates/staff/circ/curbside/index.tt2 index efbf9800f6..822a73bbe9 100644 --- a/Open-ILS/src/templates/staff/circ/curbside/index.tt2 +++ b/Open-ILS/src/templates/staff/circ/curbside/index.tt2 @@ -23,6 +23,9 @@ angular.module('egCoreMod').run(['egStrings', function(s) { s.SUCCESS_CURBSIDE_MARK_ARRIVED = "[% l('Marked curbside appointment {{slot_id}} as patron arrived') %]"; s.NOTFOUND_CURBSIDE_MARK_ARRIVED = "[% l('Could not find curbside appointment {{slot_id}} to mark as patron arrived') %]"; s.FAILED_CURBSIDE_MARK_ARRIVED = "[% l('Failed to mark curbside appointment {{slot_id}} as patron arrived: {{evt_code}}') %]"; + s.SUCCESS_CURBSIDE_MARK_UNSTAGED = "[% l('Marked curbside appointment {{slot_id}} back to to-be-staged') %]"; + s.NOTFOUND_CURBSIDE_MARK_UNSTAGED = "[% l('Could not find curbside appointment {{slot_id}} to mark as to-be-staged') %]"; + s.FAILED_CURBSIDE_MARK_UNSTAGED = "[% l('Failed to mark curbside appointment {{slot_id}} as to-be-staged: {{evt_code}}') %]"; s.SUCCESS_CURBSIDE_MARK_DELIVERED = "[% l('Marked curbside appointment {{slot_id}} as delivered') %]"; s.NOTFOUND_CURBSIDE_MARK_DELIVERED = "[% l('Could not find curbside appointment {{slot_id}} to mark as delivered') %]"; s.FAILED_CURBSIDE_MARK_DELIVERED = "[% l('Failed to mark curbside appointment {{slot_id}} as delivered: {{evt_code}}') %]"; diff --git a/Open-ILS/src/templates/staff/circ/curbside/t_staged_manager.tt2 b/Open-ILS/src/templates/staff/circ/curbside/t_staged_manager.tt2 index 66b5b29fb0..c2a6023b93 100644 --- a/Open-ILS/src/templates/staff/circ/curbside/t_staged_manager.tt2 +++ b/Open-ILS/src/templates/staff/circ/curbside/t_staged_manager.tt2 @@ -43,6 +43,15 @@ +
+
+ +
+
diff --git a/Open-ILS/web/js/ui/default/staff/circ/curbside/directives/staged_manager.js b/Open-ILS/web/js/ui/default/staff/circ/curbside/directives/staged_manager.js index ac6fa90a29..915582da76 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/curbside/directives/staged_manager.js +++ b/Open-ILS/web/js/ui/default/staff/circ/curbside/directives/staged_manager.js @@ -85,6 +85,30 @@ function($scope , $q , egCurbsideCoreSvc , egCore , egGridDataProvider , egProgr $timeout(function() { $scope.refresh_staged() }, 500); }); } + $scope.gridCellHandlers.mark_unstaged = function(id) { + egCurbsideCoreSvc.mark_unstaged(id).then(function(resp) { + if (evt = egCore.evt.parse(resp)) { + ngToast.danger(egCore.strings.$replace( + egCore.strings.FAILED_CURBSIDE_MARK_UNSTAGED, + { slot_id : id, evt_code : evt.code } + )); + return; + } + if (!angular.isDefined(resp)) { + ngToast.warning(egCore.strings.$replace( + egCore.strings.NOTFOUND_CURBSIDE_MARK_UNSTAGED, + { slot_id : id } + )); + return; + } + ngToast.success(egCore.strings.$replace( + egCore.strings.SUCCESS_CURBSIDE_MARK_UNSTAGED, + { slot_id : id } + )); + $scope.wasHandled[id] = true; + $timeout(function() { $scope.refresh_staged() }, 500); + }); + } $scope.gridCellHandlers.mark_delivered = function(id) { egProgressDialog.open(); egCurbsideCoreSvc.mark_delivered(id).then(function(resp) { diff --git a/Open-ILS/web/js/ui/default/staff/circ/curbside/services/core.js b/Open-ILS/web/js/ui/default/staff/circ/curbside/services/core.js index d52b7a3904..dc5faa1ef5 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/curbside/services/core.js +++ b/Open-ILS/web/js/ui/default/staff/circ/curbside/services/core.js @@ -108,6 +108,14 @@ function(egCore , orderByFilter , $q , $filter , $uibModal , ngToast , egConfirm slot_id ); } + service.mark_unstaged = function(slot_id) { + return egCore.net.request( + 'open-ils.curbside', + 'open-ils.curbside.mark_unstaged', + egCore.auth.token(), + slot_id + ); + } service.mark_arrived = function(slot_id) { return egCore.net.request( 'open-ils.curbside',