<?php
/**
 * @copyright 2021 Double Bastion LLC <www.doublebastion.com>
 *
 * @author Double Bastion LLC
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

declare(strict_types=1);

script('sms_relentless', 'adminsettings');
style('sms_relentless', 'style');

?>

<div id="sms_relentless_adm">

        <div class="section">
           <h2><?php p($l->t('SMS Relentless'));?></h2>
           <p id="settings-dscr"><h3><?php p($l->t('Enter your credentials and options in the fields from below. As SMS service provider you can use Telnyx, Plivo, Twilio or 
               Flowroute, or all of them:')); ?></h3></p><br>
           <div class="sms_followupsection">

                <form id="admin_conf" action="#" >

                   <div class="providerSettings">
                   <p class="providerName">Telnyx Settings</p>
                   <p><label for="telapi_key" class="setlabeltext"><b>Telnyx API Secret Key</b> (Log in to Telnyx, then, on the 'Home' page, in the 'API Keys' section from the upper 
                          right corner, click on 'Manage Keys'. If you already have an API key, just copy it by clicking the 'Copy to clipboard' icon. Otherwise, to create an API key, 
                          click the 'Create API Key' button, on the pop up message click 'Create', then enter it in the field from below.):</label></p>
                   <input type="password" class="smsr_textbox" id="telapi_key" name="telapi_key" autocomplete="false"
                          placeholder="e.g. d6f172ce92e4f2 ..." /><br>

                   <p><label for="tel_pub_key" class="setlabeltext"><b>Telnyx Account Public Key</b> (While logged in to Telnyx, on the 'Home' page, in the 'API Keys' section from the 
                          upper right corner, click on 'Manage Keys', then click on 'Public Key' on the upper bar, then copy the key from the 'Key' field and enter it in the field from 
                          below.):</label></p>
                   <input type="password" class="smsr_textbox" id="tel_pub_key" name="tel_pub_key" autocomplete="false"
                          placeholder="e.g. KLCnMsTSp8utW3RRHx0FiXxbf5BxK2Y5q8mMTCn0jgv=" /><br>

                   <p><label for="messaging_profile_id" class="setlabeltext"><b>Messaging Profile ID</b> (While logged in to Telnyx, click on 'Messaging', then on 'Programmable 
                       Messaging' on the left panel, click on the name of the messaging profile that you want to use, then under 'Profile ID' you will find the messaging profile ID. 
                       Copy it and enter it in the field from below.):
                   </label></p>
                   <input type="password" class="smsr_textbox" id="messaging_profile_id" name="messaging_profile_id" autocomplete="false"
                          placeholder="e.g. 9d4f47b6-26c9-d25c-c2f5 ..." /><br>

                   <p><label for="telapi_url_rec" class="setlabeltext"><b>Telnyx webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your Telnyx
                       account, so that Telnyx knows where to deliver the SMS/MMS messages received by your Telnyx phone number(s). First generate the URL by pressing the button from
                       below, copy it, then, in your Telnyx account click on 'Messaging' then on 'Programmable Messaging' on the left panel, click on the name of the messaging profile 
                       that you associated with your phone number(s), then, under 'Inbound Settings', enter the webhook URL generated here in the field 'Send a webhook to this URL' and 
                       click the 'Save' button. Don't forget to also click the 'Save' button at the bottom of this page after entering all the credentials, to save all the settings to 
                       the database.)</label></p>
                   <input type="button" id="generate_tel_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
                   <input type="text" class="smsr_textboxspec" id="telapi_url_rec" name="telapi_url_rec" autocomplete="false" />
                   <span id="copyToClipboardtel" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>

                   <p><label for="telapi_url" class="setlabeltext"><b>Telnyx webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
                       requests, so that Telnyx will know where to send the delivery receipts. Just generate it by pressing the button from below.
                       You don't have to enter this URL into your Telnyx account. Also, after entering all the credentials, click the 'Save' button at the bottom of this page, 
                       to save all the settings to the database.)</label></p>
                   <input type="button" id="generate_tel_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
                   <input type="text" id="telapi_url" name="telapi_url" autocomplete="false" /><br><br>

                   <p><label for="tel_sender_name" class="setlabeltext"><b>Telnyx alphanumeric Sender ID</b> (If you intend to use an alphanumeric Sender ID, enter an alphanumeric 
                          sequence of up to 11 characters in the range of a-z, A-Z, 0-9 and space. In certain countries there are regulations that accept only shorter alphanumeric 
                          Sender IDs, such as up to 6 characters. You cannot send SMS/MMS messages with alphanumeric Sender IDs to USA or Canada. There are even 
                          <a href="https://support.plivo.com/hc/en-us/articles/360041448032" style="color:#1b60ba" target="_blank" rel="noreferrer noopener">countries</a> that require
                          preregistration of alphanumeric Sender IDs. Before sending SMS/MMS messages to a country, it's recommended to read the
                          <a href="https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID" style="color:#1b60ba" target="_blank"
                          rel="noreferrer noopener">country specific features and restrictions.</a> Some carriers won't accept messages with an alphanumeric Sender ID): </label></p>
                   <input type="text" class="smsr_textbox" id="tel_sender_name" name="tel_sender_name" autocomplete="false"
                          placeholder="e.g. Smart Inc" /><br><br>

                   <p><label for="tnxKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Telnyx API Secret Key, 
                          Public Key, messaging profile ID and alphanumeric Sender ID mentioned above (to be able to use them properly, the users with whom these credentials are shared 
                          will have to access their app Settings page, generate the two webhook URLs for Telnyx by clicking the corresponding 'Generate new webhook URL ...' buttons, and
                          then click the 'Save' button at the bottom of that page):</b></label></p><br>

                   <table id="tnxKeysAccessTbl">

                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th><th></th></tr>
                      <tr><td><div id="alwdakeyGrps-tnx" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-tnx" class="showAllGroupsak">
                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td><td><div id="alwdakeyUsrs-tnx" class="alwdKeysUsers"></div>
                      </td><td><div id="showakeyUsrs-tnx" class="showAllUsersak"><img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
                      <td><input type="submit" id="alwdrstsave-tnx" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>

                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-tnx" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelGrps-tnx">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
                      </label></div></td><td></td>
                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-tnx" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelUsrs-tnx">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
                      </div></td><td></td><td></td></tr>

                   </table><br>

                   </div><br><br><br>

                   <div class="providerSettings">
                   <p class="providerName">Plivo Settings</p>
                   <p><label for="nexapi_key" class="setlabeltext"><b>Plivo Auth ID</b> (Log in to Plivo. On the first page, which is the Overview page, under Account, copy the 'Auth ID'
                          and enter it in the field from below.):</label></p>
                   <input type="password" class="smsr_textbox" id="nexapi_key" name="nexapi_key" autocomplete="false"
                          placeholder="e.g. r5g974cb92e4t1 ...'" /><br>

                   <p><label for="nexapi_secret" class="setlabeltext"><b>Plivo Auth Token</b> (While logged in to Plivo, on the Overview page, under Account, copy the 'Auth Token' and
                          enter it in the field from below.):</label></p>
                   <input type="password" class="smsr_textbox" id="nexapi_secret" name="nexapi_secret" autocomplete="false"
                          placeholder="e.g. k6f489d8awn4p9 ..." /><br>

                   <p><label for="nexapi_url_rec" class="setlabeltext"><b>Plivo webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your Plivo
                       account, so that Plivo knows where to deliver the SMS/MMS messages received by your Plivo phone number(s). First generate the URL by pressing the button from
                       below, copy it, then, in your Plivo account click on 'Messaging' on the left vertical bar, click on 'Applications', then, under 'Application name' click on
                       'Inbound SMS Messages', next, under 'Message', enter the webhook URL generated here in the field 'Message URL' and select 'POST' next to it, then click the
                       'Update Application' button. Don't forget to also click the 'Save' button at the bottom of this page after entering all the credentials, to save all the settings 
                       to the database.)</label></p>
                   <input type="button" id="generate_nex_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
                   <input type="text" class="smsr_textboxspec" id="nexapi_url_rec" name="nexapi_url_rec" autocomplete="false" />
                   <span id="copyToClipboardnex" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>

                   <p><label for="nexapi_url" class="setlabeltext"><b>Plivo webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
                       requests, so that Plivo will know where to send the delivery receipts. Just generate it by pressing the button from below.
                       You don't have to enter this URL into your Plivo account. Also, after entering all the credentials, click the 'Save' button at the bottom of this page, 
                       to save all the settings to the database.)</label></p>
                   <input type="button" id="generate_nex_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
                   <input type="text" id="nexapi_url" name="nexapi_url" autocomplete="false" /><br><br>

                   <p><label for="nex_sender_name" class="setlabeltext"><b>Plivo alphanumeric Sender ID:</b> (If you intend to use an alphanumeric Sender ID, enter an alphanumeric 
                          sequence of up to 11 characters in the range of a-z, A-Z, 0-9 and space. In certain countries there are regulations that accept only shorter alphanumeric 
                          Sender IDs, such as up to 6 characters. You cannot send SMS/MMS messages with alphanumeric Sender IDs to USA or Canada. There are even 
                          <a href="https://support.plivo.com/hc/en-us/articles/360041448032" style="color:#1b60ba" target="_blank" rel="noreferrer noopener">countries</a> that require
                          preregistration of alphanumeric Sender IDs. Before sending SMS/MMS messages to a country, it's recommended to read the
                          <a href="https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID" style="color:#1b60ba" target="_blank"
                          rel="noreferrer noopener">country specific features and restrictions.</a> Some carriers won't accept messages with an alphanumeric Sender ID): </label></p>
                   <input type="text" class="smsr_textbox" id="nex_sender_name" name="nex_sender_name" autocomplete="false"
                          placeholder="e.g. Global Inc" /><br><br>

                   <p><label for="plvKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Plivo Auth ID, Auth 
                          Token and alphanumeric Sender ID mentioned above (to be able to use them properly, the users with whom these credentials are shared will have to access their 
                          app Settings page, generate the two webhook URLs for Plivo by clicking the corresponding 'Generate new webhook URL ...' buttons, and then click the 'Save' 
                          button at the bottom of that page):</b></label></p><br>

                   <table id="plvKeysAccessTbl">

                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th></th><th></tr>
                      <tr><td><div id="alwdakeyGrps-plv" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-plv" class="showAllGroupsak">
                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td><td><div id="alwdakeyUsrs-plv" class="alwdKeysUsers"></div>
                      </td><td><div id="showakeyUsrs-plv" class="showAllUsersak"><img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
                      <td><input type="submit" id="alwdrstsave-plv" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>

                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-plv" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelGrps-plv">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
                      </label></div></td><td></td>
                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-plv" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelUsrs-plv">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
                      </div></td><td></td><td></td></tr>

                   </table><br>

                   </div><br><br><br>

                   <div class="providerSettings">
                   <p class="providerName">Twilio Settings</p>
                   <p><label for="twilapi_key" class="setlabeltext"><b>Twilio Account SID</b> (Log in to Twilio. On the first page, under Account Info, copy the 'Account SID'
                          and enter it in the field from below.):</label></p>
                   <input type="password" class="smsr_textbox" id="twilapi_key" name="twilapi_key" autocomplete="false"
                          placeholder="e.g. r5g974cb92e4t1 ..." /><br>

                   <p><label for="twilapi_secret" class="setlabeltext"><b>Twilio Auth Token</b> (While logged in to Twilio, on the first page, under Account Info, copy the 'Auth Token'
                          and enter it in the field from below.):</label></p>
                   <input type="password" class="smsr_textbox" id="twilapi_secret" name="twilapi_secret" autocomplete="false"
                          placeholder="e.g. k6f489d8awn4p9 ..." /><br>

                   <p><label for="twilapi_url_rec" class="setlabeltext"><b>Twilio webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your 
                       Twilio account, so that Twilio knows where to deliver the SMS/MMS messages received by your Twilio phone number(s). First generate the URL by pressing the button 
                       from below, copy it, then, in your Twilio account click on 'Phone Numbers' on the left panel > 'Manage' > 'Active numbers', click on the phone number you want to 
                       use for SMS/MMS, scroll down to the 'Messaging' section, then under 'A MESSAGE COMES IN' select 'Webhook', then paste in the webhook URL that you have just 
                       generated and select 'HTTP POST' as the request type. Enter the same data under 'PRIMARY HANDLER FAILS', then click the 'Save' button. If you have multiple 
                       SMS/MMS enabled phone numbers, do the same for each number. Don't forget to also click the 'Save' button at the bottom of this page after entering all the 
                       credentials, to save all the settings to the database.)</label></p>
                   <input type="button" id="generate_twil_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
                   <input type="text" class="smsr_textboxspec" id="twilapi_url_rec" name="twilapi_url_rec" autocomplete="false" />
                   <span id="copyToClipboardtwil" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>

                   <p><label for="twilapi_url" class="setlabeltext"><b>Twilio webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
                       requests, so that Twilio will know where to send the delivery receipts. Just generate it by pressing the button from below.
                       You don't have to enter this URL into your Twilio account. Also, after entering all the credentials, click the 'Save' button at the bottom of this page, 
                       to save all the settings to the database.)</label></p>
                   <input type="button" id="generate_twil_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
                   <input type="text" id="twilapi_url" name="twilapi_url" autocomplete="false" /><br><br>

                   <p><label for="twil_sender_name" class="setlabeltext"><b>Twilio alphanumeric Sender ID:</b> (If you intend to use an alphanumeric Sender ID, enter an alphanumeric 
                          sequence of up to 11 characters in the range of a-z, A-Z, 0-9 and space. In certain countries there are regulations that accept only shorter alphanumeric 
                          Sender IDs, such as up to 6 characters. You cannot send SMS/MMS messages with alphanumeric Sender IDs to USA or Canada. There are even 
                          <a href="https://support.plivo.com/hc/en-us/articles/360041448032" style="color:#1b60ba" target="_blank" rel="noreferrer noopener">countries</a> that require
                          preregistration of alphanumeric Sender IDs. Before sending SMS/MMS messages to a country, it's recommended to read the
                          <a href="https://support.twilio.com/hc/en-us/articles/223133767-International-support-for-Alphanumeric-Sender-ID" style="color:#1b60ba" target="_blank"
                          rel="noreferrer noopener">country specific features and restrictions.</a> Some carriers won't accept messages with an alphanumeric Sender ID): </label></p>
                   <input type="text" class="smsr_textbox" id="twil_sender_name" name="twil_sender_name" autocomplete="false"
                          placeholder="e.g. Global Inc" /><br><br>

                   <p><label for="twlKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Twilio Account SID, 
                          Auth Token and alphanumeric Sender ID mentioned above (to be able to use them properly, the users with whom these credentials are shared will have to access 
                          their app Settings page, generate the two webhook URLs for Twilio by clicking the corresponding 'Generate new webhook URL ...' buttons, and then click the 
                          'Save' button at the bottom of that page):</b></label></p><br>

                   <table id="twlKeysAccessTbl">

                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th></th><th></tr>
                      <tr><td><div id="alwdakeyGrps-twl" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-twl" class="showAllGroupsak">
                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td>
                      <td><div id="alwdakeyUsrs-twl" class="alwdKeysUsers"></div></td><td><div id="showakeyUsrs-twl" class="showAllUsersak">
                      <img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
                      <td><input type="submit" id="alwdrstsave-twl" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>

                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-twl" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelGrps-twl">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
                      </label></div></td><td></td>
                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-twl" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelUsrs-twl">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
                      </div></td><td></td><td></td></tr>

                   </table><br>

                   </div><br><br><br>

                   <div class="providerSettings">
                   <p class="providerName">Flowroute Settings</p>
                   <p><label for="flowapi_key" class="setlabeltext"><b>Flowroute Access Key</b> (Log in to Flowroute. On the left panel, click on 'Preferences', then on the 'API Control'
                          tab. Scroll down to the 'API Keys' section. If you already have a pair of keys listed in that section, just copy the Access Key to the field from below. If you
                          haven't created any keys yet, to create a key pair, under 'Add new API Key', in the 'Name' field, enter a name for the new key pair. In the 'Description' field 
                          enter a short description, then click 'Add new'. A new pair of keys will be created and you will be prompted to copy the Secret Key. After you copy the Secret 
                          Key to a safe location, copy the Access Key that has just been created to the field from below.):</label></p>
                   <input type="password" class="smsr_textbox" id="flowapi_key" name="flowapi_key" autocomplete="false"
                          placeholder="e.g. r5g974cb92e4t1 ..." /><br>

                   <p><label for="flowapi_secret" class="setlabeltext"><b>Flowroute Secret Key</b> (Enter the Secret Key created earlier and copied to a safe place, in the field from 
                          below.):</label></p>
                   <input type="password" class="smsr_textbox" id="flowapi_secret" name="flowapi_secret" autocomplete="false"
                          placeholder="e.g. k6f489d8awn4p9 ..." /><br>

                   <p><label for="flowapi_url_rec" class="setlabeltext"><b>Flowroute webhook URL for incoming SMS/MMS</b> (You have to first generate and then copy this URL into your 
                          Flowroute account, so that Flowroute knows where to deliver the SMS/MMS messages received by your Flowroute phone number(s). First generate the URL by pressing 
                          the button from below, copy it, then, in your Flowroute account click on 'Preferences' on the left panel, then click on the 'API Control tab', turn on the 'SMS' 
                          switch and in the field that shows up enter the URL that you have just generated. Click 'Save URL'. If you have an MMS enabled phone number, turn on the 'MMS' 
                          switch, enter the same URL in the URL field and save it. Also, under 'SMS Webhook Version' choose 'v2.1'. Don't forget to also click the 'Save' button at the 
                          bottom of this page after entering all the credentials, to save all the settings to the database.)</label></p>
                   <input type="button" id="generate_flow_rcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for incoming SMS/MMS')) ?>" />
                   <input type="text" class="smsr_textboxspec" id="flowapi_url_rec" name="flowapi_url_rec" autocomplete="false" />
                   <span id="copyToClipboardflow" class="icon icon-clippy" title="Copy to clipboard"></span><br><br>

                   <p><label for="flowapi_url" class="setlabeltext"><b>Flowroute webhook URL for delivery receipts</b> (This URL will be included by SMS Relentless in message sending 
                          requests, so that Flowroute will know where to send the delivery receipts. Just generate it by pressing the button from below. You don't have to enter this URL 
                          into your Flowroute account. Also, after entering all the credentials, click the 'Save' button at the bottom of this page, 
                          to save all the settings to the database.)</label></p>
                   <input type="button" id="generate_flow_delrcpt" class="generateUrl" value="<?php p($l->t('Generate new webhook URL for delivery receipts')) ?>" />
                   <input type="text" id="flowapi_url" name="flowapi_url" autocomplete="false" /><br><br>
                   <span style='color:#272727'>Flowroute only supports sending/receiving SMS/MMS messages within USA and Canada and it doesn't support Alphanumeric Sender IDs.</span><br><br>

                   <p><label for="flrKeysAccessTbl" class="setlabeltext"><b>Allow the following groups and non-admin users to send and receive messages using the Flowroute Access Key 
                          and Secret Key mentioned above (to be able to use them properly, the users with whom these credentials are shared will have to access their app Settings page, 
                          generate the two webhook URLs for Flowroute by clicking the corresponding 'Generate new webhook URL ...' buttons, and then click the 'Save' button at the 
                          bottom of that page):</b></label></p><br>

                   <table id="flrKeysAccessTbl">

                      <tr><th style="padding-bottom:3px">Groups Allowed</th><th style="max-width: 40px !important"></th><th style="padding-bottom:3px">Users Allowed</th><th style="max-width: 40px !important"></th></th><th></tr>
                      <tr><td><div id="alwdakeyGrps-flr" class="alwdKeysGroups"></div></td><td><div id="showakeyGrps-flr" class="showAllGroupsak">
                      <img class="srGroupImg" style="cursor:pointer" title="Show all groups"></div></td><td>
                      <div id="alwdakeyUsrs-flr" class="alwdKeysUsers"></div></td><td><div id="showakeyUsrs-flr" class="showAllUsersak">
                      <img class="srUserImg" style="cursor:pointer" title="Show all users"></div></td>
                      <td><input type="submit" id="alwdrstsave-flr" class="savealwdKeys" value="Edit" title="Edit Row" /></td></tr>

                      <tr><td class="topLeftCorner"><div class="alwdDelGroups"><input type="checkbox" id="alwDelGrps-flr" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelGrps-flr">Allow the users in these groups to delete the messages sent from or received on the numbers shared with them.
                      </label></div></td><td></td>
                      <td class="topLeftCorner"><div class="alwdDelUsrs"><input type="checkbox" id="alwDelUsrs-flr" class="alwDelCkbx" autocomplete="false" />
                      <label for="alwDelUsrs-flr">Allow these users to delete the messages sent from or received on the numbers shared with them.</label>
                      </div></td><td></td><td></td></tr>

                   </table><br>

                   </div><br><br><br>


                   <p><label for="showallmessages" class="setlabeltext"><b>In my message tables, list not only my messages but also the messages of all the Nextcloud users 
                   with whom I share the access keys mentioned above:</b></label></p>
                   <input type="checkbox" class="sms_rel_checkbox" id="showallmessages" name="showallmessages" autocomplete="false" /><br>

                   <p><div class="setlabeltext"><b>Restrict access to the following phone numbers:</b><div class="tooltiprestrict">
                        <div id="inforestrict">i</div><div class="restricttooltext">After you allow non-admin users to use your API keys for a provider, to send and
                        receive messages, they will be able to see and use all the phone numbers associated with those API keys. However, if you restrict shared phone 
                        numbers to specific non-admin users, they will be able to see and use only those numbers and won't be able to see and use the other numbers 
                        associated with those shared API keys.</div></div></p><br>

                   <table id="phoneNmbrRestr">

                        <tr><th>Restriction Author</th><th id="phoneNumberTh">Phone Number</th><th>Groups Allowed</th><th style="max-width: 40px !important"></th><th>Users Allowed</th>
                        <th style="max-width: 40px !important"></th><th></th><th></th></tr>

                   </table><br>

                   <input type="hidden" id="user_id" name="user_id" />

                   <input id="save_admin_settings" type="submit" value="<?php p($l->t('Save')) ?>" />

                   <span id="smsr_save_msg"></span>

               </form>
           </div>
        </div>
</div>

