]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/templates/opac/myopac/prefs_notify.tt2
a7784256be95bce92da707ea4d38e50fa1eec45c
[Evergreen.git] / Open-ILS / src / templates / opac / myopac / prefs_notify.tt2
1 [%  PROCESS "opac/parts/header.tt2";
2     WRAPPER "opac/parts/myopac/prefs_base.tt2";
3     myopac_page = "prefs";
4     prefs_page = 'prefs_notify'
5     can_call_action_trigger = 'true' %]
6
7 <h3 class="sr-only">[% l('Notification Preferences') %]</h3>
8     [% IF ctx.affectedChgs %]
9
10         [% # get hash of sms carriers keyed by id:
11             temp = ctx.search_csc('active','t');
12             tcos = { '0' => 'None' };
13             FOR o IN temp;
14                 id = o.id;
15                 tcos.$id = o;
16             END;
17         %]
18   <h4 class="">[% l('You have updated notification preferences. Those changes only affect future holds. Would you like to update existing holds to use the new information?') %]</h4>
19     <form id="hold_updates_form" name="hold_updates_form" method='post' action="./prefs_notify_changed_holds" onsubmit='return updateHoldsCheck()'>
20         <table class="full-width data_grid" id="acct_search_main" 
21             title="[% l('Notification Preferences') %]">
22             <tbody>
23         [% SET blnk = l('Blank') %]
24         [% FOR c IN ctx.affectedChgs %]
25             <tr>
26               <td>
27                 [% IF c.2 == 'sms_info' %]
28                 <input type='hidden' name="[% c.2 %][]" value="[% c.0.carrier _ ',' _ c.0.sms | html %]" />
29                 <input type='hidden' name="[% c.2 %][]" value="[% c.1.carrier _ ',' _ c.1.sms | html %]" />
30                 [% ELSE %]
31                 <input type='hidden' name="[% c.2 %][]" value="[% c.0 %]" />
32                 <input type='hidden' name="[% c.2 %][]" value="[% c.1 %]" />
33                 [% END %]
34                 <input type='hidden' name="[% c.2 %][]" value="[% c.2 %]" />
35                 <input type='hidden' name="[% c.2 %][]" value="[% FOREACH i IN c.3 %][% i %],[% END %]" />
36                 <input id="[% c %]" type="checkbox" onchange="canSubmit(event)" name="[% c.2 %][]"/>
37                 [% IF c.2 == 'sms_info' %]
38                     [% SET disp_name = l('SMS carrier/number') %]
39                     <label for="[% c %]">[% c.3.size %] hold(s) currently with [% disp_name %] set to '[% old = c.0.carrier; tcos.$old.name() ? tcos.$old.name() : blnk | html %]/[% c.0.sms ? c.0.sms : blnk | html %]'. Update to '[% new = c.1.carrier; tcos.$new.name()  ? tcos.$new.name() : blnk | html %]/[% c.1.sms ? c.1.sms : blnk | html %]'?</label>
40                 [% ELSIF c.2.match('_notify') %]
41                     [% SET f_name = c.2.replace("_", " "); Y = l('YES'); N = l('NO') %]
42                     <label for="[% c %]">[% c.3.size %] hold(s) currently with [% f_name %] set to [% c.0 == 'false' ? N : Y %]. Update to [% c.1 == 'false' ? N : Y %]?</label>
43                 [% ELSE %]
44                     [% SET f_name = c.2.replace("_", " ") %]
45                     <label for="[% c %]">[% c.3.size %] hold(s) currently with [% f_name %] set to '[% c.0 ? c.0 : blnk %]'. Update to '[% c.1 ? c.1 : blnk %]'?</label>
46                 [% END %]
47               </td>
48             </tr>
49         [% END %]
50             </tbody>
51         </table>
52         <input type='submit' disabled value="[% l('Update') %]" class="opac-button" />
53         <a href='/eg/opac/myopac/prefs_notify'>[% l('Continue without updating') %]</a>
54     </form>
55
56     [% ELSE %]
57         <form id="hold_notify_form" name="hold_notify_form" method='post'>
58             [% setting = 'opac.hold_notify' %]
59             <input name='[% setting %]' type="hidden"
60                 [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
61
62             <table class="full-width data_grid" id="acct_search_main" 
63                 title="[% l('Notification Preferences') %]">
64                 <tbody>
65
66                     [% IF ctx.updated_user_settings %]
67                     <tr><td colspan='2'>
68                         <div class='renew-summary'>
69                             [% l('Account Successfully Updated') %]
70                         </div>
71                     </td></tr>
72                     [% END %]
73
74                     [% setting = 'opac.hold_notify' %]
75                     <tr>
76                         [%# WCAG insists that labels for checkboxes contain the input
77                             or directly follow the input, which would not look right
78                             with the rest of the table.  As an alternative, we can
79                             repeat the label as a title attr.
80                             http://www.w3.org/TR/WCAG20-TECHS/H44.html %]
81                         [% email_label = l('Notify by Email by default when a hold is ready for pickup?') %]
82
83                         <td><label for='[% setting %].email'>[% email_label %]</label></td>
84                         <td>
85                             <input onchange="record_change(event)" id='[% setting %].email' name='[% setting %].email'
86                                 type="checkbox" title="[% email_label %]"
87                                 [% IF (matches = ctx.user_setting_map.$setting.match('email')); %] checked='checked' [% END %]/>
88                         </td>
89                     </tr>
90                     [%- IF allow_phone_notifications == 'true';
91                         setting = 'opac.hold_notify'; 
92                     -%]
93                     <tr>
94                         [% phone_label = l('Notify by Phone by default when a hold is ready for pickup?') %]
95                         <td><label for='[% setting %].phone'>[% phone_label %]</label></td>
96                         <td>
97                             <input onchange="record_change(event)" id='[% setting %].phone' name='[% setting %].phone'
98                                 type="checkbox" title="[% phone_label %]"
99                                 [% IF (matches = ctx.user_setting_map.$setting.match('phone')); %] checked='checked' [% END %]/>
100                         </td>
101                     </tr>
102                     [% setting = 'opac.default_phone' %]
103                     <tr>
104                         <td><label for='[% setting %]'>[% l('Default Phone Number') %]</label></td>
105                         <td>
106                             <input onchange="record_change(event)" id='[% setting %]' name='[% setting %]' type="text"
107                                 [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
108                         </td>
109                     </tr>
110                     [%- END %]
111                     [%- IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1;
112                        setting = 'opac.hold_notify';
113                     -%]
114                     <tr>
115                         [% sms_label = l('Notify by Text by default when a hold is ready for pickup?') %]
116                         <td><label for='[% setting %].sms'>[% sms_label %]</label></td>
117                         <td>
118                             <input onchange="record_change(event)" id='[% setting %].sms' name='[% setting %].sms'
119                                 type="checkbox" title="[% sms_label %]"
120                                 [% IF (matches = ctx.user_setting_map.$setting.match('sms')); %] checked='checked' [% END %]/>
121                         </td>
122                     </tr>
123                     <tr>
124                         <td>[% l('Default Mobile Carrier') %]</td>
125                         <td>[% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %]</td>
126                     </tr>
127                     [% setting = 'opac.default_sms_notify' %]
128                     <tr id="test_notification_banner" style="display:none">
129                         <td colspan="4">
130                             [% INCLUDE "opac/myopac/test_notification.tt2" message_type = "sms" %]
131                         </td>
132                     </tr>
133                     <tr>
134                         <td><label for='[% setting %]'>[% l('Default Mobile Number') %]</label></td>
135                         <td>
136                             <input onchange="record_change(event)" id='[% setting %]' name='[% setting %]' type="text"
137                                 [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
138                             [% IF ctx.user_setting_map.$setting; %]
139                             <a href="#" onclick="sendTestNotification(
140                                 [% ctx.user.id %], [% ctx.user.home_ou.id %], 'sms_text', '[% ctx.authtoken %]'
141                             )"
142                             title="[% l('Send Test Text Message') %]">[% l('Send Test Text Message') %]</a><br />
143                             [% l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); %]
144                             [% END %]
145                         </td>
146                     </tr>
147                     [% END %]
148                     [% FOR optin IN ctx.opt_in_settings %]
149                     <tr>
150                         <td><label for='[% optin.cust.name | uri %]'>[% optin.cust.label | html %]</label></td>
151                         <td>
152                             <input type='checkbox' name='setting' 
153                                 value='[% optin.cust.name | uri %]' 
154                                 id='[% optin.cust.name | uri %]' 
155                                 title="[% optin.cust.label | html %]"
156                                 [% IF optin.value %] checked='checked' [% END %]/>
157                         </td>
158                     </tr>
159                     [% END %]
160                 </tbody>
161             </table>
162
163             <input type='submit' value="[% l('Save') %]" class="opac-button" />
164         </form>
165     [% END %]
166 [% END %]
167
168