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