]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/record/copy_table.tt2
TPAC: Improve display of holds/copy counts on record details
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / record / copy_table.tt2
1 <table cellpadding="0" cellspacing="0" border="0" width="100%" id="rdetails_status">
2     <thead>
3         <tr>
4             <th id='copy_header_library'>[% l("Location") %]</th>
5             <th id='copy_header_callnmber'>[% l("Call Number") %]</th>
6             <th id='copy_header_barcode'>[% l("Barcode") %]</th>
7             <th id='copy_header_shelfloc'>[% l("Shelving Location") %]</th>
8             [%- IF ctx.is_staff %]
9             <th id='copy_header_age_hold'>[% l("Age Hold Protection") %]</th>
10             <th id='copy_header_create_date'>[% l("Create Date") %]</th>
11             <th id='copy_header_holdable'>[% l("Holdable?") %]</th>
12             [%- END %]
13             <th id='copy_header_status'>[% l("Status") %]</th>
14             <th id='copy_header_due_date'>[% l("Due Date") %]</th>
15         </tr>
16     </thead>
17     <tbody class="copy_details_table">
18         [%- last_cn = 0;
19         FOR copy_info IN ctx.copies;
20             callnum = copy_info.call_number_label;
21             NEXT IF callnum == '##URI##';
22
23             callnum_prefix = copy_info.call_number_prefix_label;
24             IF callnum_prefix != "";
25                 callnum = callnum_prefix _ " " _ callnum;
26             END;
27
28             callnum_suffix = copy_info.call_number_suffix_label;
29             IF callnum_suffix != "";
30                 callnum = callnum  _ " " _ callnum_suffix;
31             END;
32         -%]
33         <tr>
34             <td header='copy_header_library'>
35             [%-
36                 org_name = ctx.get_aou(copy_info.circ_lib).name;
37                 org_name | html
38             -%]
39             </td>
40             <td header='copy_header_callnumber'>[% callnum | html %]</td>
41             <td header='copy_header_barcode'>[% copy_info.barcode | html %]</td>
42             <td header='copy_header_shelfloc'>[% copy_info.copy_location | html %]</td>
43             [%- IF ctx.is_staff %]
44             <td header='copy_header_age_hold'>
45                 [% copy_info.age_protect ?
46                     ctx.get_crahp(copy_info.age_protect).name : l('None') | html %]
47             </td>
48             <td header='copy_header_date_format'>[% date.format(
49                 ctx.parse_datetime(copy_info.create_date),
50                 DATE_FORMAT
51             ) %]</td>
52             <td header='copy_header_holdable'>[%  # Show copy/volume hold links to staff (without
53                     # checking whether they have permissions to do those).
54                     overall_holdable = (copy_info.holdable == 't' AND
55                         copy_info.location_holdable == 't' AND
56                         copy_info.status_holdable == 't');
57                     IF overall_holdable;
58                         l("Place on"); %]
59                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
60                     {hold_target => copy_info.id, hold_type => 'C', hold_source_page => mkurl()}) %]">[% l("copy") %]</a>
61                 [%-      IF copy_info.call_number != last_cn;
62                             last_cn = copy_info.call_number;
63                             l(" / "); %]
64                 <a href="[% mkurl(ctx.opac_root _ '/place_hold', 
65                     {hold_target => copy_info.call_number, hold_type => 'V', hold_source_page => mkurl()}) %]">[% l("volume") %]</a>
66                 [%-      END;
67                     ELSE;
68                         l("No");
69                     END %]</td>
70             [%- END %]
71             <td header='copy_header_status'>[% copy_info.copy_status | html %]</td>
72             <td header='due_date'>[%
73                 IF copy_info.due_date;
74                     date.format(
75                         ctx.parse_datetime(copy_info.due_date),
76                         DATE_FORMAT
77                     );
78                 ELSE;
79                     '-';
80                 END %]</td>
81         </tr>
82         [%- END %]
83         <tr>
84         [%- IF ctx.copy_offset > 0;
85             new_offset = ctx.copy_offset - ctx.copy_limit;
86             IF new_offset < 0; new_offset = 0; END %]
87             <td>
88                 <a href="[% mkurl('', {copy_offset => new_offset, copy_limit => ctx.copy_limit}) %]">&laquo; [%
89                     l('Previous [_1]', ctx.copy_offset - new_offset) %]</a>
90             </td>
91         [%- END %]
92         [%- IF ctx.copies.size >= ctx.copy_limit %]
93             <td>
94                 <a href="[% mkurl('', {copy_offset => ctx.copy_offset + ctx.copy_limit, copy_limit => ctx.copy_limit}) %]">[%
95                     l('Next [_1]', ctx.copy_limit) %] &raquo;</a>
96             </td>
97         [%- END %]
98         </tr>
99         <tr>
100             <td>
101                 [%- more_copies_limit = 50 %] [%# TODO: config %]
102                 [%- IF  ctx.copy_limit != more_copies_limit AND ctx.copies.size >= ctx.copy_limit %]
103                     <div class="rdetail_show_copies">
104                         <img src="[% ctx.media_prefix %]/images/plus_sign.png" />
105                         <a href="[% mkurl('', {copy_limit => more_copies_limit, copy_offset => 0}) %]">[% l('Show more copies') %]</a>
106                     </div>
107                 [%- ELSIF ctx.copy_limit == more_copies_limit %]
108                     <div  class="rdetail_show_copies">
109                         <img src="[% ctx.media_prefix %]/images/minus_sign.png" />
110                         <a href="[% mkurl('', {copy_limit => 0, copy_offset => 0}) %]">[% l('Show fewer copies') %]</a>
111                     </div>
112                 [%- END %]
113             </td>
114         </tr>
115     </tbody>
116 </table>
117