{##
 # HTTPS settings page template 
 #}

<div class="https-settings-dialog">

  {## top messages *#}

  {% if not this.isEnabledHTTPS() %}
    {% if this.isAvailableHTTPS() %}
      {% if this.isValidSSL() %}
        <div class="alert alert-warning">
          {{ t('The secure protocol for your website is disabled.') }}
        </div>
      {% endif %}
      {% if not this.isValidSSL() %}
        <div class="alert alert-danger">
          {{ t('X-Cart could not find a valid SSL certificate on your server X.', {'domain': this.getDomain()})|raw }}
          {{ t('Before enabling HTTPS protocol read this article:', {'articleUrl': this.getArticleUrl()})|raw }}
        </div>
      {% endif %}
    {% else %}
      <div class="alert alert-danger">
        {{ t('X-Cart could not find a valid SSL certificate on your server X.', {'domain': this.getDomain()})|raw }}
        {{ t('Before enabling HTTPS protocol read this article:', {'articleUrl': this.getArticleUrl()})|raw }}
      </div>
    {% endif %}
  {% else %}

    {% if this.isValidSSL() %}
      <div class="alert alert-success">
        {{ t('The secure protocol for your website is enabled.') }}
      </div>
    {% endif %}

    {% if this.isAvailableHTTPS() and not this.isValidSSL() %}
      <div class="alert alert-warning">
        {{ t('The HTTPS protocol is enabled for your website') }}
      </div>
    {% endif %}

  {% endif %}

  {## buttons *#}

  {% if this.areButtonsEnabled() %}

    {% if not this.isEnabledHTTPS() %}
      {% if not (this.isAvailableHTTPS() and this.isValidSSL()) %}
        {{ widget('\\XLite\\View\\Button\\ConfirmRegular', confirmText=t('Are you sure you want to enable https anyway?'), label='Enable HTTPS', jsCode='self.location=\'' ~ url('https_settings', 'enable_HTTPS') ~ '\'', style=this.getButtonStyle()) }}
      {% else %}
        {{ widget('\\XLite\\View\\Button\\Regular', label='Enable HTTPS', jsCode='self.location=\'' ~ url('https_settings', 'enable_HTTPS') ~ '\'', style=this.getButtonStyle()) }}
      {% endif %}
    {% endif %}

    {% if this.isEnabledHTTPS() %}
      <div class="full-customer-security-wrapper">
        {{ widget('\\XLite\\View\\FormField\\Input\\Checkbox\\FullCustomerSecurity', fieldName='force_customers_to_https') }}
      </div>
      {{ widget('\\XLite\\View\\Button\\Regular', label='Disable HTTPS', jsCode='self.location=\'' ~ url('https_settings', 'disable_HTTPS') ~ '\'', style='regular-main-button action disable-https') }}
    {% endif %}

  {% endif %}

  {## bottom messages *#}

  {% if this.isEnabledHTTPS() and this.isValidSSL() %}
    <div class="note">
      {{ t('Your store is configured to use the secure protocol for the store back-end and checkout, sign-in and profile pages.') }}
    </div>
  {% endif %}

  {% if this.isAvailableHTTPS() and this.isValidSSL() and not this.isEnabledHTTPS() %}
    <div class="note">
      {{ t('We have found a valid SSL certificate installed on the server. Now you can switch the store to use the secure protocol for the store back-end and checkout, sign-in and profile pages.') }}
    </div>
  {% endif %}

  {% if this.isAvailableHTTPS() and not this.isValidSSL() %}
    <div class="note">
      <div>
        {{ t('X-Cart could not find a valid SSL certificate on your server X.', {'domain': this.getDomain()})|raw }}
        {{ t('Although you can switch the store to use the secure protocol for the website pages, most Internet browsers will likely display a warning message scaring your website visitors away.') }}
        <br>
        {{ t('You can get more information using this service: ', {'url': this.getReadMoreLink()})|raw }}
      </div>
    </div>
  {% endif %}

  {% if not this.isAvailableHTTPS() %}
    <p class="help-block purchase">
      {{ t('To enable secure protocol for your website pages you need a valid SSL certificate purchased for the website domain and installed on your server.', {'domain': this.getDomain()})|raw }}
    </p>
  {% endif %}

  {% if not (this.isAvailableHTTPS() and this.isValidSSL()) %}
    {{ widget('\\XLite\\View\\Button\\Regular', label='Purchase SSL certificate', jsCode='window.open(\'' ~ this.getPurchaseURL() ~ '\',\'_blank\')', style='regular-main-button action') }}
  {% endif %}
</div>
