PINES - fix merge issues with OPAC notification prefs page
authorTerran McCanna <tmccanna@georgialibraries.org>
Tue, 27 Dec 2022 17:37:06 +0000 (12:37 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Wed, 4 Jan 2023 15:25:26 +0000 (10:25 -0500)
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/templates-bootstrap/opac/myopac/prefs_notify.tt2

index 00f324f..688e629 100755 (executable)
@@ -2,15 +2,11 @@
     WRAPPER "opac/parts/myopac/base.tt2";
     myopac_page = "prefs_notify";
     parent="prefs";
-    prefs_page = 'prefs_notify';
-    can_call_action_trigger = 'true' %]
+    prefs_page = 'prefs_notify'
+%]
 
 <h3>[% l('Notification Preferences') %]</h3>
 <div style="padding-bottom:10px;">[% l("PINES Account Tips") %]</div>
-<form method='post'>
-    [% setting = 'opac.hold_notify' %]
-    <input name='[% setting %]' type="hidden"
-        [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
 
     [% IF ctx.affectedChgs %]
         [% # get hash of sms cariers keyed by id:
             [% setting = 'opac.hold_notify' %]
             <input name='[% setting %]' type="hidden"
                 [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
-                <td><label for='[% setting %].email'>[% email_label %]</label></td>
-                <td>
-                    <input id='[% setting %].email' name='[% setting %].email'
-                        type="checkbox" title="[% email_label %]"
-                        [% IF (matches = ctx.user_setting_map.$setting.match('email')); %] checked='checked' [% END %]/>
-                </td>
-            </tr>
-            [%- IF allow_phone_notifications == 'true';
-                setting = 'opac.hold_notify';
-            -%]
-            <tr>
-                [% phone_label = l('Notify by Phone by default when a hold is ready for pickup?') %]
-                <td><label for='[% setting %].phone'>[% phone_label %]</label></td>
-                <td>
-                    <input id='[% setting %].phone' name='[% setting %].phone'
-                        type="checkbox" title="[% phone_label %]"
-                        [% IF (matches = ctx.user_setting_map.$setting.match('phone')); %] checked='checked' [% END %]/>
-                </td>
-            </tr>
-            [% setting = 'opac.default_phone' %]
-            <tr>
-                <td><label for='[% setting %]'>[% l('Default Phone Number') %]</label></td>
-                <td>
-                    <input id='[% setting %]' name='[% setting %]' type="text"
-                        [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %] class="form-control"/>
-                </td>
-            </tr>
-            [%- END %]
-            [%- IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1;
-               setting = 'opac.hold_notify';
-            -%]
-            <tr>
-                [% sms_label = l('Notify by Text by default when a hold is ready for pickup?') %]
-                <td><label for='[% setting %].sms'>[% sms_label %]</label></td>
-                <td>
-                    <input id='[% setting %].sms' name='[% setting %].sms'
-                        type="checkbox" title="[% sms_label %]"
-                        [% IF (matches = ctx.user_setting_map.$setting.match('sms')); %] checked='checked' [% END %]/>
-                </td>
-            </tr>
-            <tr>
-                <td>[% l('Default Mobile Carrier') %]</td>
-                <td>[% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %]</td>
-            </tr>
-            [% setting = 'opac.default_sms_notify' %]
-            <tr>
-                <td><label for='[% setting %]'>[% l('Default Mobile Number') %]</label></td>
-                <td>
-                    <input id='[% setting %]' name='[% setting %]' type="text"
-                        [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
-                    [% l('Hint: use the full 10 digits of your phone number, no spaces, no dashes'); %]
-                </td>
-            </tr>
-            [% END %]
-            [% FOR optin IN ctx.opt_in_settings %]
-            <tr>
-                <td><label for='[% optin.cust.name | uri %]'>[% optin.cust.label | html %]</label></td>
-                <td>
-                    <input type='checkbox' name='setting'
-                        value='[% optin.cust.name | uri %]'
-                        id='[% optin.cust.name | uri %]'
-                        title="[% optin.cust.label | html %]"
-                        [% IF optin.value %] checked='checked' [% END %]/>
-                </td>
-            </tr>
-            [% END %]
-        </tbody>
-    </table>
+
+            <table class="full-width table" id="acct_search_main" 
+                title="[% l('Notification Preferences') %]">
+                <tbody>
+
+                    [% IF ctx.updated_user_settings %]
+                    <tr><td colspan='2'>
+                        <div class='renew-summary'>
+                            [% l('Account Successfully Updated') %]
+                        </div>
+                    </td></tr>
+                    [% END %]
+
+                    [% setting = 'opac.hold_notify' %]
+                    <tr>
+                        [%# WCAG insists that labels for checkboxes contain the input
+                            or directly follow the input, which would not look right
+                            with the rest of the table.  As an alternative, we can
+                            repeat the label as a title attr.
+                            http://www.w3.org/TR/WCAG20-TECHS/H44.html %]
+                        [% email_label = l('Notify by Email by default when a hold is ready for pickup?') %]
+
+                        <td><label for='[% setting %].email'>[% email_label %]</label></td>
+                        <td>
+                            <input onchange="record_change(event)" id='[% setting %].email' name='[% setting %].email'
+                                type="checkbox" title="[% email_label %]"
+                                [% IF (matches = ctx.user_setting_map.$setting.match('email')); %] checked='checked' [% END %]/>
+                        </td>
+                    </tr>
+                    [%- IF allow_phone_notifications == 'true';
+                        setting = 'opac.hold_notify'; 
+                    -%]
+                    <tr>
+                        [% phone_label = l('Notify by Phone by default when a hold is ready for pickup?') %]
+                        <td><label for='[% setting %].phone'>[% phone_label %]</label></td>
+                        <td>
+                            <input onchange="record_change(event)" id='[% setting %].phone' name='[% setting %].phone'
+                                type="checkbox" title="[% phone_label %]"
+                                [% IF (matches = ctx.user_setting_map.$setting.match('phone')); %] checked='checked' [% END %]/>
+                        </td>
+                    </tr>
+                    [% setting = 'opac.default_phone' %]
+                    <tr>
+                        <td><label for='[% setting %]'>[% l('Default Phone Number') %]</label></td>
+                        <td>
+                            <input onchange="record_change(event)" id='[% setting %]' name='[% setting %]' type="text"
+                                [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
+                        </td>
+                    </tr>
+                    [%- END %]
+                    [%- IF ctx.get_org_setting(ctx.search_ou, 'sms.enable') == 1;
+                       setting = 'opac.hold_notify';
+                    -%]
+                    <tr>
+                        [% sms_label = l('Notify by Text by default when a hold is ready for pickup?') %]
+                        <td><label for='[% setting %].sms'>[% sms_label %]</label></td>
+                        <td>
+                            <input onchange="record_change(event)" id='[% setting %].sms' name='[% setting %].sms'
+                                type="checkbox" title="[% sms_label %]"
+                                [% IF (matches = ctx.user_setting_map.$setting.match('sms')); %] checked='checked' [% END %]/>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>[% l('Default Mobile Carrier') %]</td>
+                        <td>[% INCLUDE "opac/parts/sms_carrier_selector.tt2" sms_carrier_hide_label="true" %]</td>
+                    </tr>
+                    [% setting = 'opac.default_sms_notify' %]
+                    <tr id="test_notification_banner" style="display:none">
+                        <td colspan="4">
+                            [% INCLUDE "opac/myopac/test_notification.tt2" message_type = "sms" %]
+                        </td>
+                    </tr>
+                    <tr>
+                        <td><label for='[% setting %]'>[% l('Default Mobile Number') %]</label></td>
+                        <td>
+                            <input onchange="record_change(event)" id='[% setting %]' name='[% setting %]' type="text"
+                                [% IF ctx.user_setting_map.$setting; %] value='[% ctx.user_setting_map.$setting | html %]' [% END %]/>
+                            [% IF ctx.user_setting_map.$setting; %]
+                            <a href="#" onclick="sendTestSMS(
+                            [% ctx.user.id %], '[% ctx.authtoken %]'
+                            )"
+                            title="[% l('Send Test Text Message') %]">[% l('Send Test Text Message') %]</a><br />
+                            [% l('Hint: use the full 10 digits of your phone #, no spaces, no dashes'); %]
+                            [% END %]
+                        </td>
+                    </tr>
+                    [% END %]
+                    [% FOR optin IN ctx.opt_in_settings %]
+                    <tr>
+                        <td><label for='[% optin.cust.name | uri %]'>[% optin.cust.label | html %]</label></td>
+                        <td>
+                            <input type='checkbox' name='setting' 
+                                value='[% optin.cust.name | uri %]' 
+                                id='[% optin.cust.name | uri %]' 
+                                title="[% optin.cust.label | html %]"
+                                [% IF optin.value %] checked='checked' [% END %]/>
+                        </td>
+                    </tr>
+                    [% END %]
+                </tbody>
+            </table>
 
     <button type='submit' class="btn btn-confirm"><i class="fas fa-save"></i> [% l('Save') %]</button>
 </form>
   [% END %]
-[% END %]
-
-
+[% END %]
\ No newline at end of file