LP#1879983: Don't allow arrival until the scheduled time
authorMike Rylander <mrylander@gmail.com>
Tue, 16 Jun 2020 21:04:10 +0000 (17:04 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 16 Jun 2020 21:07:33 +0000 (17:07 -0400)
To avoid confusion and mis-clicks, disable the arrival button for
patrons until the appointment requested time.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/templates/opac/myopac/holds_curbside.tt2

index 379ca94..e18cc45 100644 (file)
                 [% ELSE %] &nbsp;
                 [% END %]
             </span>
-            <span class="egtd">
+            <span class="egtd">[%
+                disable_arrival_button = 1; # assume arrival is not yet allowed
+                IF appointment && appointment.slot;
+                    stime = date.format(appointment.slot, '%s');
+                    now_time = date.format(date.now, '%s');
+                    IF now_time >= stime;
+                        disable_arrival_button = 0; # if 'now' is after the slot time, allow arrival
+                    END;
+                END %]
                 [% IF no_patron_input %]
                     [% l('Please contact the library to update or cancel your appointment.') %]
                 [% ELSIF appointment.staged && !appointment.arrival; # relevant submit action %]
-                    <button type="submit" name="cs_action" value="arrive" class="opac-button">
+                    <button type="submit" name="cs_action" value="arrive" class="opac-button" [% IF disable_arrival_button %]disabled="disabled"[% END %]>
                         [% l('Alert staff of your arrival') %]
                     </button><br/>
                     <button type="submit" name="cs_action" value="cancel" class="opac-button">
                         [% l('Cancel appointment') %]
                     </button>
                 [% ELSIF appointment.slot %]
-                    <button type="submit" name="cs_action" value="arrive" class="opac-button">
+                    <button type="submit" name="cs_action" value="arrive" class="opac-button" [% IF disable_arrival_button %]disabled="disabled"[% END %]>
                         [% l('Alert staff of your arrival') %]
                     </button><br/>
                     <button type="submit" name="cs_action" value="save" class="opac-button">