{% extends 'admin.twig' %}

{% import '@MobileMessaging/macros.twig' as macro %}

{% block content %}

    {% if isSuperUser %}
        <h2>{{ 'General_Settings'|translate }}</h2>
        <table class='adminTable' style='width:650px;'>
            <tr>
                <td style="width:400px;">{{ 'MobileMessaging_Settings_LetUsersManageAPICredential'|translate }}</td>
                <td style="width:250px;">
                    <fieldset>
                        <input  type='radio'
                                value='false'
                                name='delegatedManagement' {% if not delegatedManagement %} checked='checked'{% endif %}
                                id="delegatedManagement" />
                        <label for="delegatedManagement">{{ 'General_No'|translate }}</label><br/>
                        <span class='form-description'>
                            ({{ 'General_Default'|translate }}) {{ 'MobileMessaging_Settings_LetUsersManageAPICredential_No_Help'|translate }}
                        </span>
                        <br/>
                        <br/>
                        <input
                                type='radio'
                                value='true'
                                name='delegatedManagement' {% if delegatedManagement %} checked='checked'{% endif %}
                                id="delegatedManagement" />
                        <label for="delegatedManagement">{{ 'General_Yes'|translate }}</label><br/>
                        <span class='form-description'>{{ 'MobileMessaging_Settings_LetUsersManageAPICredential_Yes_Help'|translate }}</span>

                    </fieldset>
            </tr>
        </table>
    {% endif %}

    {% if accountManagedByCurrentUser and delegatedManagement %}

        <h2 piwik-enriched-headline
                >{{ 'MobileMessaging_Settings_SMSProvider'|translate }}</h2>
        To manage your SMS provider go to your <a href="{{ linkTo({'action':'userSettings'}) }}">personal mobile messaging settings</a>.

    {% elseif accountManagedByCurrentUser %}

        <h2 piwik-enriched-headline
                >{{ 'MobileMessaging_Settings_SMSProvider'|translate }}</h2>

        {{ macro.manageSmsApi(credentialSupplied, creditLeft, smsProviders, provider) }}
    {% endif %}

    {% import 'ajaxMacros.twig' as ajax %}

    <div style="margin-top:10px">
        {{ ajax.errorDiv('ajaxErrorMobileMessagingSettings') }}
    </div>

    <h2>{{ 'MobileMessaging_PhoneNumbers'|translate }}</h2>
    To manage your phone numbers go to your <a href="{{ linkTo({'action':'userSettings'}) }}">personal mobile messaging settings</a>.

    {{ ajax.loadingDiv('ajaxLoadingMobileMessagingSettings') }}

    <div class='ui-confirm' id='confirmDeleteAccount'>
        <h2>{{ 'MobileMessaging_Settings_DeleteAccountConfirm'|translate }}</h2>
        <input role='yes' type='button' value='{{ 'General_Yes'|translate }}'/>
        <input role='no' type='button' value='{{ 'General_No'|translate }}'/>
    </div>

{% endblock %}
