LP1908616 Add email display to hold edit
[Evergreen.git] / Open-ILS / src / templates-bootstrap / opac / myopac / holds / edit.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     PROCESS "opac/parts/misc_util.tt2";
3     PROCESS "opac/parts/hold_status.tt2";
4     PROCESS "opac/parts/org_selector.tt2";
5     PROCESS "opac/parts/metarecord_hold_filters.tt2";
6     WRAPPER "opac/parts/myopac/base.tt2";
7     myopac_page = "holds"; # in this case, just for tab coloring.
8
9     hold = ctx.holds.0;
10     ahr = hold.hold.hold;
11     attrs = {marc_xml => hold.marc_xml};
12     PROCESS get_marc_attrs args=attrs;
13     hold.human_status = PROCESS get_hold_status hold=hold;
14
15     # Do this up front to avoid verbosity later
16     expire_time = ahr.expire_time ? date.format(ctx.parse_datetime(ahr.expire_time), DATE_FORMAT) : '';
17     thaw_date = ahr.thaw_date ? date.format(ctx.parse_datetime(ahr.thaw_date), DATE_FORMAT) : '';
18 %]
19
20 <div>
21     <div class="header_middle">
22         <h3>[% l('Edit Hold') %]</h3>
23         <a href="[% ctx.opac_root %]/myopac/holds" class="float-right"><i class="fas fa-list"></i> [% l('List all holds') %]</a>
24     </div>
25     <form method="post">
26     <div id="hold_editor" class="mt-4">
27         [%  IF hold; title = attrs.title;
28                 IF ahr.hold_type == 'P';
29                     title = l('[_1] ([_2])', title, hold.hold.part.label);
30                 END
31         %]
32         <div class="my-4">
33             <h1>[% title | html %]</h1>
34             <h2>[% attrs.author | html %]</h2>
35             [% IF attrs.format_icon %]
36                 <strong>[% l('Format:') %]</strong>
37                 <img src="[% attrs.format_icon %]" alt="[% attrs.format_label | html %]" title="[% attrs.format_label | html %]" />
38             [% END %]
39         </div>
40
41         <div class="row">
42             <div class="col-12 mb-3">
43             <strong>[% l('Status') %]</strong>: [% hold.human_status %]
44             </div>
45             <div class="col-12">
46              <input type="hidden" name="action" value="edit" />
47                             <input type="hidden" name="hold_id"
48                                 value="[% ahr.id %]" />
49                             <div class="form-group">
50                             <label for="pickup_lib">[% l('Pickup library') %]</library>
51
52                             [% INCLUDE build_org_selector
53                                 name='pickup_lib' id='pickup_lib' value=ahr.pickup_lib
54                                 can_have_vols_only=1 hold_pickup_lib=1 %]
55                             </div>
56             </div>
57             <div class="col-sm-6">
58             [% IF hold.hold.status < 3 OR hold.hold.status == 7 %]
59                     [%# The following actions cannot be performed on holds that
60                         have already been captured... %]
61                             
62                             <label for="expire_time">[% l('Cancel unless filled by') %]</label>
63                             <div class="input-group date" data-provide="datepicker">
64                                 <input type="text" class="form-control" id="expire_time" name="expire_time"
65                                     value="[% expire_time | html %]" data-date-format="mm/dd/yyyy">
66                                 <div class="input-group-addon">
67                                     <span class="glyphicon glyphicon-th"></span>
68                                 </div>
69                             </div>
70  
71                             <div class="form-group mt-2">
72                                 <label for="frozen">[% l('Active?') %]</label>
73                                 <select class="form-control" name="frozen" id="frozen">
74                                     <option value="f"[% ahr.frozen == 't' ? '' :' selected="selected"' %]>
75                                         [% l('Yes, this hold is active now') %]
76                                     </option>
77                                     <option value="t"[% ahr.frozen == 't' ? ' selected="selected"' : '' %]>
78                                         [% l('No, this hold is suspended') %]
79                                     </option>
80                                 </select>
81                             </div>
82  
83                             <label for="datepicker">[% l('If suspended, activate on') %]</label>
84                             <div class="input-group date" data-provide="datepicker">
85                                 <input type="text" class="form-control" name="thaw_date" id="datepicker" value="[% thaw_date | html %]" data-date-format="mm/dd/yyyy">
86                                 <div class="input-group-addon">
87                                     <span class="glyphicon glyphicon-th"></span>
88                                 </div>
89                             </div>
90
91                         <div class="form-check mt-3">
92                             <input class="form-check-input" type="checkbox" name="email_notify" id="email_notify"
93                                 [% IF ahr.email_notify == 't' %] checked [% END %] />
94                             <label class="form-check-label" for="email_notify">[% l('Email notification') %]</label>:  
95                             [% IF !ctx.user.email; 
96                                 l('<br>No configured Email address. See "My Account" for setting your Email address.'); 
97                             ELSE; ctx.user.email; 
98                             END %]
99                         </div>
100
101                         <div class="form-group">
102                             <label for="phone_notify">[% l('Phone notification - Enter phone number') %]</label>
103                             <input type="text" class="form-control" name="phone_notify" id="phone_notify"
104                                 value="[% ahr.phone_notify | html %]" />
105                         </div>
106
107                         [% IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1%]
108                         <div class="form-group">
109                             <label for="sms_notify">[% l('SMS notification - Enter mobile phone number') %]</label>
110                             <input onblur="check_sms_carrier(event)" type="text" class="form-control" name="sms_notify" id="sms_notify"
111                                 value="[% ahr.sms_notify | html %]" />
112                         </div>
113                         <div class="form-group">
114                             <label for="sms_carrier">[% l('Mobile carrier') %]</label>
115                             [% INCLUDE "opac/parts/sms_carrier_selector.tt2" ahr, sms_carrier_hide_warning="true", sms_carrier_hide_label="true" %]
116                         </div>
117                         [% END %]
118
119                     [% END %]
120
121             </div>
122             <div class="col-12">
123
124                     [% IF hold.metarecord_filters.formats.size OR
125                         (hold.metarecord_filters.langs.size.defined && hold.metarecord_filters.langs.size > 1);
126                             PROCESS metarecord_hold_filters_selector
127                                 hold_data=hold; END %]
128             </div>
129              <div class="col-12">
130                 <a href="[% ctx.opac_root %]/myopac/holds" class="btn btn-deny"><i class="fas fa-arrow-circle-left"></i> [% l('Go Back') %]</a>
131                             <button class="btn btn-confirm m-2" type='submit'><i class="fas fa-save"></i> [% l('Save Changes') %]</button>
132              </div>
133         </div>
134             </form>
135         [% ELSE;
136             l('Hold not found');
137         END %]
138     </div>
139 </div>
140 <script>
141     $('#datepicker').datepicker({
142         weekStart: 1,
143         autoclose: true,
144         todayHighlight: true,
145     });
146     $('#datepicker').datepicker("setDate", new Date());
147 </script>
148 [% END %]
149