{% extends 'admin.twig' %}

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

{% set title %}{{ 'MobileMessaging_SettingsMenu'|translate }}{% endset %}

{% block content %}

    {% if isSuperUser %}
        <h2>{{ title }}</h2>

        <div class="form-group">
            <label>{{ 'MobileMessaging_Settings_LetUsersManageAPICredential'|translate }}</label>

            <label class="radio">
                <input type='radio' value='false' id="delegatedManagement" name='delegatedManagement'
                        {% if not delegatedManagement %} checked='checked'{% endif %}/>
                {{ 'General_No'|translate }}

                <span class='form-description'>{{ 'General_Default'|translate }}.
                    {{ 'MobileMessaging_Settings_LetUsersManageAPICredential_No_Help'|translate }}</span>
            </label>

            <label class="radio">
                <input type='radio' value='true' id="delegatedManagement" name='delegatedManagement'
                        {% if delegatedManagement %} checked='checked'{% endif %}/>
                {{ 'General_Yes'|translate }}

                <span class='form-description'>{{ 'MobileMessaging_Settings_LetUsersManageAPICredential_Yes_Help'|translate }}</span>
            </label>
        </div>
    {% 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 %}
