END;
END;
-%]
+[%- MACRO display_ou_distance(ou) BLOCK;
+ km = ctx.ou_distances.$ou;
+ IF km && km != '-1';
+ IF ctx.get_org_setting(ctx.physical_loc || ctx.search_ou, 'opac.geographic_proximity_in_miles');
+ distance = l('[_1] mi', POSIX.sprintf('%.01f', km / 1.609));
+ ELSE;
+ distance = l('[_1] km', POSIX.sprintf('%.01f', km));
+ END;
+ ELSE;
+ distance = '-';
+ END;
+%]
+[% distance %]
+[%- END %]
[%-
IF has_copies or ctx.foreign_copies;
depth = CGI.param('copy_depth').defined ? CGI.param('copy_depth') : CGI.param('depth').defined ? CGI.param('depth') : ctx.copy_summary.last.depth;
total_copies = ctx.copy_summary.$depth.count;
%]
+[% IF ctx.geo_sort %]
+<form method="GET">
+[% FOREACH p IN CGI.params.keys; NEXT IF p == 'geographic-location' %]
+ <input type="hidden" name="[% p | html %]" value="[% CGI.params.$p | html %]"/>
+[% END %]
+<span with="50%">
+ [% l("Sort by distance from:") %]
+ <input type="text" id="geographic-location-box" name="geographic-location" aria-label="[% l('Enter address or postal code') %]" placeholder="[% l('Enter address/postal code') %]" class="search-box" x-webkit-speech="" value="[% p = 'geographic-location'; CGI.params.$p %]"></input>
+ <button type="submit" class="btn btn-confirm">[% l('Go') %]</button>
+</span>
+[% p = 'geographic-location'; IF CGI.params.$p && !ctx.has_valid_coords %]
+<span class="opac-alert">[% l('Sorry, your address is not recognized') %]</span>
+[% END %]
+</form>
+[% p = 'geographic-location'; IF CGI.params.$p && ctx.has_valid_coords %]
+<form method="GET">
+[% FOREACH p IN CGI.params.keys; NEXT IF p == 'geographic-location' %]
+ <input type="hidden" name="[% p | html %]" value="[% CGI.params.$p | html %]"/>
+[% END %]
+ <button type="submit" class="opac-button">[% l('Use default item sort') %]</button>
+</form>
+[% END %]
+[% END %]
<table class="container-fluid table table-hover mt-4 miniTable copyTable w-100" >
<thead>
<tr>
[%- IF ctx.use_courses %]
<th scope='col'>[% l("Courses") %]</th>
[%- END %]
+ [%- IF ctx.geo_sort && ctx.has_valid_coords %]
+ <th scope='col'>[% l("Distance") %]</th>
+ [%- END %]
</tr>
</thead>
<tbody>
<td>[% bib.target_copy.location.name | html %]</td>
<td>[% bib.target_copy.status.name | html %]</td>
<td>[% date.format(ctx.parse_datetime(copy_info.due_date, copy_info.circ_circ_lib),DATE_FORMAT) %]</td>
+ [%- IF ctx.geo_sort && ctx.has_valid_coords %]
+ <td>[% display_ou_distance(bib.target_copy.circ_lib) %]</td>
+ [%- END %]
</tr>
[%- END; # FOREACH peer
END; # FOREACH bib
<div>[% course.course_number %]</div>
[% END %]</td>
[% END %]
+ [%- IF ctx.geo_sort && ctx.has_valid_coords %]
+ <td>[% display_ou_distance(copy_info.circ_lib) %]</td>
+ [%- END %]
</tr>
[% IF copy_info.notes; %]