]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/templates/opac/parts/place_hold_result.tt2
d158e869414073e034535258003f3f58eda524e7
[working/Evergreen.git] / Open-ILS / src / templates / opac / parts / place_hold_result.tt2
1 [%  PROCESS "opac/parts/misc_util.tt2";
2     PROCESS "opac/parts/hold_error_messages.tt2";
3     override_possible = 0;
4     any_failures = 0;
5 %]
6
7 <!-- TODO: CSS for big/strong-->
8
9 <div id='holds_box' class='canvas' style='margin-top: 6px;'>
10     <h1>[% l('Place Hold') %]</h1>
11
12     <form method="post">
13         <input type="hidden" name="override" value="1" />
14         [% FOR k IN ctx.orig_params.keys %]
15         <input type="hidden" name="[% k %]" value="[% ctx.orig_params.$k | html %]" />
16         [% END %]
17
18         <table id='hold-items-list'>
19
20         [% FOR hdata IN ctx.hold_data;
21             attrs = {marc_xml => hdata.marc_xml};
22             PROCESS get_marc_attrs args=attrs %]
23             <tr>
24                 <td>
25                     [% 
26                         override = 0;
27                         IF hdata.could_override || hdata.hold_local_alert;
28                             override_possible = 1;
29                             override = 1;
30                         END;
31                     %]
32                     <input 
33                         type="checkbox" name="hold_target" value="[% hdata.target.id | html %]"
34                         [% IF override %] checked='checked' [% ELSE %] disabled='disabled' [% END %]/>
35                 </td>
36                 <td>
37                     [%
38                         title = attrs.title_extended;
39                         IF hdata.selected_part AND hdata.parts AND hdata.parts.size > 0;
40                             FOREACH part IN hdata.parts;
41                                 IF hdata.selected_part == part.id;
42                                     title = l('[_1] ([_2])', title, part.label);
43                                 END;
44                             END;
45                         END;
46                     %]
47                         
48                     <div class='hold-items-list-title'>[% title | html %]</div>
49                     [% IF hdata.parts %]
50                         <input type='hidden' name='part' value='[% hdata.selected_part || '' %]'/>
51                     [% END %]
52                     <div>
53                         [% IF hdata.hold_success %]
54
55                         <div class='success'>[% l("Hold was successfully placed"); %]</div>
56
57                         [% IF ctx.is_staff %]
58                             <script>
59                                 window.addEventListener(
60                                     'load',
61                                     function() {
62                                         setTimeout( // we want this to run _after_ other onload handlers (such as from eframe.js)
63                                             function() {
64                                                 try {
65                                                     if (typeof xulG != 'undefined' && xulG.opac_hold_placed) {
66                                                         xulG.opac_hold_placed([% hdata.hold_success %]);
67                                                     }
68                                                 } catch(E) {
69                                                     alert('Error updating Work Log with hold placement: ' + E);
70                                                 }
71                                             }, 0
72                                         );
73                                     },
74                                     false
75                                 );
76                             </script>
77                         [% END %]
78
79                         [% ELSIF hdata.hold_failed; any_failures = 1 %]
80
81                             <div><big><strong>[% l("Hold was not successfully placed"); %]</strong></big></div>
82                             [% IF hdata.hold_local_block %]
83                                 <div>[% l("There is already a copy available at your local library.") %]</div>
84                             [% ELSIF hdata.hold_failed_event || hdata.hold_local_alert %]
85                                 <div>
86                                     <span class='hold-items-list-problem'>[% l('Problem:') %]</span>
87                                     <span title="[% hdata.hold_failed_event.textcode | html %]">
88                                         <em>[%
89                                                 fail_part_key = hdata.hold_failed_event.payload.fail_part;
90                                                 event_key = hdata.hold_failed_event.textcode;
91
92                                                 # display:
93                                                 (hdata.age_protect ?
94                                                     l("All available copies are temporarily unavailable at your pickup library. Placing this hold could result in longer wait times.") :
95                                                     EVENT_MSG_MAP.$event_key ||
96                                                     FAIL_PART_MSG_MAP.$fail_part_key ||
97                                                     (hdata.hold_failed_event.desc ? l(hdata.hold_failed_event.desc) : '') ||
98                                                     hdata.hold_failed_event.payload.fail_part ||
99                                                     hdata.hold_failed_event.textcode ||
100                                                     (hdata.hold_local_alert ?
101                                                         l("There is already a copy available at your local library.") :
102                                                         l("Unknown problem"))) | html
103                                             %]</em>
104                                             [% IF event_key == 'PERM_FAILURE' %]
105                                             <div>[% l('Permission: "[_1]"', hdata.hold_failed_event.ilsperm) | html %]</div>
106                                             [% END %]
107                                     </span>
108                                     [% IF hdata.hold_copy_available %]
109                                         <p>[%  l('Find a copy in the shelving location, "[_1]."', locname) | html %]</p>
110                                     [% END %]
111                                 </div>
112                             [% END;
113                         END %]
114                     </div>
115                 </td>
116             </tr>
117         [% END %]
118         </table>
119         [% IF override_possible %]
120             <br/>
121             <hr/>
122             <div class='big-strong'>
123                 [% |l %]You have permission to override some of the failed holds. Click Submit to override and place your hold on the selected items.[% END %]
124             </div>
125             <span style='padding-right: 10px;'>
126                 <input type="submit" name="submit" value="[% l('Submit') %]"
127                     title="[% l('Submit') %]" alt="[% l('Submit') %]"
128                     class="opac-button" />
129             </span>
130         [% END %]
131         <span>
132         [% IF any_failures OR ctx.general_hold_error %]
133         <a href="[% CGI.param('redirect_to') || CGI.referer | html %]">[% l('Cancel') %]</a>
134         [% ELSE %]
135         <div class='hold_success_links'>
136           <span><a href="[% CGI.param('redirect_to') || CGI.referer | html %]">[% l('Continue') %]</a></span>
137            [% IF ctx.is_staff %]
138              [% IF CGI.param('hold_type') == 'C';
139                   hold_type_label = l('copy');
140                 ELSIF CGI.param('hold_type') == 'V';
141                   hold_type_label = l('volume');
142                 ELSE;
143                   hold_type_label = l('title');
144               END %]
145                <span><a href="[% mkurl(ctx.opac_root _ '/place_hold', {hold_source_page => CGI.param('hold_source_page'), bre_id => CGI.param('bre_id')}) %]">
146                [% l('Place another hold for this ') %] [% hold_type_label %]</a>
147                </span>
148           [% END %]
149         [% END %]
150         </span>
151     </form>
152 </div>
153