{% include 'header.twig' %}
<style>
/* Import Google Fonts */
{{ settings.user_font_import|raw }}

/* Wrapper content */
.wrapper-sidebar-navbar .wrapper-content{
 margin-top:20px;
 font-family: '{{ settings.user_font }}', {{ settings.user_font_type }}  ;
}


</style>
<div class="wrapper-content">
  <div class="wrapper-content__header"></div>
  <div class="wrapper-content__body">
    <!-- Main variables *content* -->
    <div id="block_95">
      <div class="ticket-form">
        <div class="bg"></div>
        <div class="divider-top"></div>
        <div class="divider-bottom"></div>
        <div class="container">
          <div class="row ticket-form__alignment">
            <div class="col-lg-8 offset-lg-2">
              <div class="component_card">
                <div class="card mt-2 mb-4">
                  {% if error %}
                    <div class="alert alert-dismissible alert-danger">
                      <button type="button" class="close" data-dismiss="alert">×</button>
                      {{ errorText }}
                    </div>
                  {% endif %}
                  {% if success %}
                    <div class="alert alert-dismissible alert-success">
                      <button type="button" class="close" data-dismiss="alert">×</button>
                      {{ successText }}
                    </div>
                  {% endif %}

                  <div class="ticket-dialog__title">
                    <h3>{{ messageList['ticket']['subject'] }}</h3>
                    {% if messageList["ticket"]["canmessage"] == 1 %}
                      <span class="badge"> This request has been closed by the administrator</span>
                    {% endif %}
                  </div>

                  {% if messageList %}
                    {% for message in messageList %}
                      {% if message["support"] == 1 %}
                        <div class="ticket-dialog__body component_ticket_messages">
                          <div class="ticket-dialog__row ticket-dialog__row-admin">
                            <div class="ticket-dialog__row-message">{{ message["message"] }}</div>
                            <div class="ticket-dialog__row-bottom">
                              <div class="ticket-dialog__row-bottom-name">{{ user["username"] }}</div>
                              <div class="ticket-dialog__row-bottom-date">{{ message["time"] }}</div>
                            </div>
                          </div>
                        </div>
                      {% elseif message["subject"] %}
                        {# skip header-only message #}
                      {% else %}
                        <div class="ticket-dialog__body component_ticket_messages">
                          <div class="ticket-dialog__row ticket-dialog__row-user">
                            <div class="ticket-dialog__row-message">{{ message["message"] }}</div>
                            <div class="ticket-dialog__row-bottom">
                              <div class="ticket-dialog__row-bottom-name">Support</div>
                              <div class="ticket-dialog__row-bottom-date">{{ message["time"] }}</div>
                            </div>
                          </div>
                        </div>
                      {% endif %}
                    {% endfor %}
                  {% endif %}

                  {% if messageList['ticket']['canmessage'] == 2 %}
                    <form method="post" action="tickets/{{ messageList['ticket']['ticket_id'] }}">
                      <div class="form-group panel-border-top mt-4">
                        <label for="message" class="control-label">Message</label>
                        <textarea id="message" rows="5" class="form-control" name="message">{{ data["message"] }}</textarea>
                      </div>
                      <button type="submit" class="btn btn-block btn-primary">Submit</button>
                    </form>
                  {% endif %}
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>  
    </div>
  </div>
</div>

{% include 'new-footer.twig' %}
