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