keep current slot time (if any) in the drop-down of available times
authorGalen Charlton <gmc@equinoxinitiative.org>
Wed, 3 Jun 2020 19:38:47 +0000 (15:38 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 3 Jun 2020 19:38:47 +0000 (15:38 -0400)
Applies to the staff interface and is meant to avoid making it appear
that a slot time had never been chosen.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/circ/curbside/directives/schedule_pickup.js

index 6b4a738..a3247c6 100644 (file)
@@ -245,6 +245,9 @@ function($scope , $q , egCurbsideCoreSvc , egCore , patronSvc ,
             hash.slot.substring(0, 10),
         ).then(function(times) {
             hash.available_times = times.map(function(t) { return t[0]; });
+            if (hash.slot_time !== null && hash.available_times.indexOf(hash.slot_time) === -1) {
+                hash.available_times.unshift(hash.slot_time);
+            }
         });
         return hash;
     }
@@ -276,6 +279,9 @@ function($scope , $q , egCurbsideCoreSvc , egCore , patronSvc ,
             dateStr,
         ).then(function(times) {
             hash.available_times = times.map(function(t) { return t[0]; });
+            if (hash.slot_time !== null && hash.available_times.indexOf(hash.slot_time) === -1) {
+                hash.available_times.unshift(hash.slot_time);
+            }
         });
     }