{% extends "withnav_template.html" %}
{% from "components/banner.html" import banner_wrapper %}
{% from "components/textbox.html" import textbox %}
{% from "components/checkbox.html" import checkbox %}
{% from "components/page-header.html" import page_header %}
{% from "components/page-footer.html" import page_footer %}
{% from "components/form.html" import form_wrapper %}

{% block service_page_title %}
  Change text message sender
{% endblock %}

{% block maincolumn_content %}

  {{ page_header(
    'Change text message sender',
    back_link=None if request.args.get('from_template') else url_for('.service_sms_senders', service_id=current_service.id)
  ) }}
  {% call form_wrapper() %}
    {% if inbound_number %}
      <p>
        <span class="bottom-gutter-1-3"> {{ sms_sender.sms_sender }} </span>
        <span class="hint"> This phone number receives replies and can’t be changed </span>
      </p>
    {% else %}
      {{ textbox(
        form.sms_sender,
        width='1-4',
        hint='Up to 11 characters, letters, numbers and spaces only'
      ) }}
    {% endif %}
    {% if form.is_default.data %}
      <p class="form-group">
        This is the default text message sender.
      </p>
      {{ page_footer('Save') }}
    {% else %}
      <div class="form-group">
        {{ checkbox(form.is_default) }}
      </div>
      {% if inbound_number %}
        {{ page_footer('Save') }}
      {% else %}
        {{ page_footer(
          'Save',
          delete_link=url_for('.service_confirm_delete_sms_sender', service_id=current_service.id, sms_sender_id=sms_sender_id),
          delete_link_text='Delete'
        ) }}
      {% endif %}
    {% endif %}
  {% endcall %}

{% endblock %}
