<label i18n>Pickup Location: </label>
</div>
<div class="col-lg-6">
- <eg-org-select (onChange)="pickupLib = $event ? $event.id() : null;if(suspendTilOpen)nextOpenTime();"
+ <eg-org-select (onChange)="setPickuplib($event)"
[disableOrgs]="disableOrgs" [applyOrgId]="pickupLib"></eg-org-select>
</div>
</div>
<eg-date-select [(ngModel)]="activeDate" name='active-date'
(onChangeAsYmd)="activeDateYmd = $event"
(onChangeAsDate)="setActiveDate($event)"
- (onChangeAsIso)="activeDateSelected($event)" [disabled]="!suspend && !suspendTilOpen">
+ (onChangeAsIso)="activeDateSelected($event)" [disabled]="!suspend || suspendTilOpen">
</eg-date-select>
</div>
</div>
nextOpenTime(){
this.net.request('open-ils.actor',
'open-ils.actor.org_unit.next_operating_hour',this.pickupLib
- ).subscribe(resp => {
- console.log(resp);
- this.activeDateSelected(resp);
- });
+ ).subscribe(
+ resp => {
+ console.log(resp);
+ if(resp){
+ this.activeDateSelected(resp);
+ }
+ else{
+ this.suspend = false;
+ this.suspendTilOpen = false;
+ }
+ },
+ error => {
+ this.suspend = false;
+ this.suspendTilOpen = false;
+ }
+ );
}
+
+ setPickuplib($event){
+ this.pickupLib = $event ? $event.id() : null;
+ if(this.suspendTilOpen)this.nextOpenTime();
+ }
}
}
else{
# default to current time if none defined
- $start_time = DateTime->now();
+ $start_time = DateTime->now(time_zone => 'local');
}
my $h = $e->search_actor_org_unit_hours_of_operation({id => $org_id})->[0];
return $e->event unless defined $h;
$start_time->add(days => 1);
$start_time->set(hour => 0,minute => 0, second=> 0);
}
- my $day_of_week = $start_time->wday;
+ # DateTime DOW index starts at 1, Evergreen starts at 0
+ my $day_of_week = $start_time->wday - 1;
my $open_time_f = 'dow_'.$day_of_week.'_open';
my $close_time_f = 'dow_'.$day_of_week.'_close';
my $open_time_st = $h->$open_time_f;
# create open/close datetimes based on current thaw date
my $open_time = $start_time->clone->set(hour => $open_times[0],minute => $open_times[1],second => $open_times[2]);
my $close_time = $start_time->clone->set(hour => $close_times[0],minute => $close_times[1],second => $close_times[2]);
+ $logger->info("operating hours $open_time - $close_time current time: $start_time, day of week: $day_of_week");
if(DateTime->compare($start_time,$open_time) >= 0 && DateTime->compare($start_time,$close_time) < 0){
- # we found a good time, end loop
- return $start_time->iso8601;
+ if($dow){
+ # we found a good time, end loop
+ return $start_time->iso8601;
+ }
+ else{
+ # there is no "next" open time because the library
+ # was open at the time API call is placed
+ return $e->event;
+ }
}
elsif(DateTime->compare($start_time,$open_time) <= 0){
# our start is before opening time
my $thaw_date_str = $U->simplereq(
'open-ils.actor',
'open-ils.actor.org_unit.next_operating_hour', $cgi->param('pickup_lib') || $self->ctx->{search_ou});
- my $thaw_dt = DateTime::Format::ISO8601->parse_datetime($thaw_date_str);
- $ctx->{thaw_date} = $thaw_dt->ymd;
+ #my $thaw_dt = DateTime::Format::ISO8601->parse_datetime($thaw_date_str);
+ $ctx->{thaw_date} = $thaw_date_str;
$ctx->{frozen} = 1;
};
if ($@) {
PROCESS "opac/parts/metarecord_hold_filters.tt2";
%]
<script>
+
// Toggle the activation date input and check the suspend checkbox.
// If JavaScript is disabled, the CSS will handle the former, but
// the latter will not happen.
<div>
[% IF ctx.hold_data.size > 0; %]
+ <span class="font-weight-bold">
+ [% l('Hold Suspension'); %]
+ <a href="#" aria-label="[% l('A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.') %]" title="[% l('A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.') %]" data-toggle="tooltip">
+ <i class="fas fa-question-circle" aria-hidden="true"></i>
+ </a>
+ </span>
+ <div class="form-group">
<div class="form-check m-2">
- <input class="form-check-input" type="radio" value="t" id="no_hold_suspend" name="hold_suspend" />
+ <input class="form-check-input" type="radio" value="f" id="no_hold_suspend" name="hold_suspend" checked />
<label class="form-check-label" for="no_hold_suspend">
[% l('Do not suspend this hold'); %]
</label>
+ </div>
+ <div class="form-check m-2">
<input class="form-check-input" type="radio" value="t" id="hold_suspend" name="hold_suspend" />
<label class="form-check-label" for="hold_suspend">
[% IF ctx.hold_data.size == 1;
ELSE;
l('Suspend these holds?');
END %]
- <a href="#" aria-label="[% l('A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.') %]" title="[% l('A suspended hold will retain its place in the queue, but will not be fulfilled until it has been activated.') %]" data-toggle="tooltip">
- <i class="fas fa-question-circle" aria-hidden="true"></i>
- </a>
</label>
- <input class="form-check-input" type="radio" value="p" id="auto_hold_suspend" name="hold_suspend" checked />
+ </br>
+ <a class="btn btn-sm btn-action m-2" id="actDateToggle" href="#toggled-block-suspend" onclick="return toggleActivationDate();"><i class="fas fa-calendar" aria-hidden="true"></i> [% l('Set activation date') %]</a>
+ <blockquote id="toggled-block-suspend">
+ <label for="thaw_date">[% l('Activate on') %]
+ <div class="input-group date" data-provide="datepicker">
+ <input type="text" class="form-control" name="thaw_date" id="thaw_date" value="[% thaw_date | html %]" data-date-format="mm/dd/yyyy" />
+ <div class="input-group-addon">
+ <span class="glyphicon glyphicon-th"></span>
+ </div>
+ </div>
+ </blockquote>
+ </div>
+ <div class="form-check m-2">
+ <input class="form-check-input" type="radio" value="p" id="auto_hold_suspend" name="hold_suspend" />
<label class="form-check-label" for="auto_hold_suspend">
[% l('Suspend until Pickup Library Open'); %]
</label>
</div>
+ </div>
[% END %]
- <a class="btn btn-sm btn-action m-2" id="actDateToggle" href="#toggled-block-suspend" onclick="return toggleActivationDate();"><i class="fas fa-calendar" aria-hidden="true"></i> [% l('Set activation date') %]</a>
- </div>
- <blockquote id="toggled-block-suspend">
- <label for="thaw_date">[% l('Activate on') %]
- <div class="input-group date" data-provide="datepicker">
- <input type="text" class="form-control" name="thaw_date" id="thaw_date" value="[% thaw_date | html %]" data-date-format="mm/dd/yyyy" />
- <div class="input-group-addon">
- <span class="glyphicon glyphicon-th"></span>
- </div>
+
</div>
- </blockquote>
[% IF CGI.param('from_basket') %]