{{ header }}
{% if journal3.get('pageTitlePosition') == 'top' %}
  <h1 class="title page-title {{ journal3.get('title_color_scheme') }}"><span class="page-title-text">{{ heading_title }}</span></h1>
{% endif %}
<div class="container">
  {% if error_warning %}
    <div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i>{{ error_warning }}</div>
  {% else %}
    {{ journal3_top }}
    <div class="row">{{ column_left }}
      {% if column_left and column_right %}
        {% set class = 'col-sm-6' %}
      {% elseif column_left or column_right %}
        {% set class = 'col-sm-9' %}
      {% else %}
        {% set class = 'col-sm-12' %}
      {% endif %}
      <div id="content" class="{{ class }}">
        {% if journal3.get('pageTitlePosition') == 'default' %}
          <h1 class="title page-title {{ journal3.get('title_color_scheme') }}">{{ heading_title }}</h1>
        {% endif %}
        {{ content_top }}
        <form class="form-horizontal">
          <fieldset>
            <div class="form-group required">
              <label class="col-sm-2 control-label" for="input-name">{{ entry_name }}</label>
              <div class="col-sm-10">
                <input type="text" name="name" value="{{ name }}" id="input-name" class="form-control"/>
              </div>
            </div>
            <div class="form-group required">
              <label class="col-sm-2 control-label" for="input-email">{{ entry_email }}</label>
              <div class="col-sm-10">
                <input type="text" name="email" value="{{ email }}" id="input-email" class="form-control"/>
              </div>
            </div>
            <div class="form-group required">
              <label class="col-sm-2 control-label" for="input-enquiry">{{ entry_enquiry }}</label>
              <div class="col-sm-10">
                <textarea name="enquiry" rows="10" id="input-enquiry" class="form-control">{{ enquiry }}</textarea>
              </div>
            </div>
          </fieldset>
          <div class="buttons">
            <div class="pull-right">
              <button class="btn btn-primary" type="submit"><span>{{ button_submit }}</span></button>
            </div>
          </div>
        </form>
        {{ content_bottom }}</div>
      {{ column_right }}</div>
  {% endif %}
</div>
<script>
  $('.btn-primary').on('click', function (e) {
    e.preventDefault();

    var $this = $(this);

    $.ajax({
      url: 'index.php?route=journal3/mail' + Journal['route_separator'] + 'test',
      type: 'post',
      dataType: 'json',
      data: $this.closest('form').serialize(),
      beforeSend: function () {
        $this.button('loading');
      },
      complete: function () {
        $this.button('reset');
      },
      success: function (json) {
        alert(JSON.stringify(json, null, 2));
      },
      error: function (xhr, ajaxOptions, thrownError) {
        alert(thrownError + '\r\n' + xhr.statusText + '\r\n' + xhr.responseText);
      }
    })
  });
</script>
{{ footer }}
