{% include 'header.twig' %}


{% if settings['ticket_system'] == 1 %}

    <div class="wrapper-content__body">
      <!-- Main variables *content* -->

          <div class="appContent">
        <div class="hiddenTitle">
    <div id="appTt">Support</div>
    <div id="appTx">
                We're the best!
            </div>
</div>

    <section class="dashboard-head-wrapper">
        <div class="container-fluid">
            <div class="dashboard-head card-border">
                <div class="dhead-body">
                    <h2 class="title">
                                                Create or View Ticket!
                                            </h2>
                    <p class="text">
                                                If you got questions to our support, leave us a support ticket, we will answer as soon as possible.
                                            </p>
                </div>
                <div class="dhead-img-wrapper">
                    <img src="https://cdn.mypanel.link/6f7slz/hjd38x9quo3byspn.png" class="dhead-img" alt="Coin Moin">
                </div>
            </div>
        </div>
    </section>
    <section class="">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-6 mb-4">
                    <div class="card card-border">
                        <div class="card-header">
                            <div class="row align-items-center">
                                <div class="col-md">
                                    <h3 class="card-title">
                                                                                Create Ticket
                                                                            </h3>
                                    <p class="card-h-text">
                                                                                You can create support ticket here.
                                                                            </p>
                                </div>
                            </div>
                        </div>
                        
                        {% if contentText %}
          <div class="card mt-2 mb-2">
{{ contentText }}
            </div>
{% endif %}


                        
                        <!-- ./card-header -->
                        <div class="card-body">
                            <form method="post" action="" id="ticketsend">
                                <div class="alert alert-dismissible alert-danger ticket-danger" style="display: none;">
                                    <button type="button" class="close">×</button>
                                    <div></div>
                                </div>
                                
                                  {% if error %}
        <div class="alert alert-dismissible alert-danger {% if site['rtl'] %} rtl-alert {% endif %}">
          <button type="button" class="close" data-dismiss="alert">×</button>
          {{ errorText }}
        </div>
      {% elseif success %}
        <div class="alert alert-dismissible alert-success {% if site['rtl'] %} rtl-alert {% endif %}">
          <button type="button" class="close" data-dismiss="alert">×</button>
          {{ successText }}
        </div>
      {% endif %}

                                <div class="siginInRow form-group mb-4">
                                    <label class="control-label">Subject</label>
                                    <select  type="text" class="form-control" id="subject" name="subject">
                                  {% for subjects in orders %}
                   <option value"{{ subjects['subject'] }}">{{ subjects['subject'] }}</option>
                  {% endfor %}
                              </select>
                                </div>

                                
                                <div class="siginInRow form-group mb-4">
                                    <label class="control-label">Message<span id="optional"> (optional) </span></label>
                                                  <textarea class="form-control" rows="7" id="message" name="message">{{ data['message'] }}</textarea>

                                </div>
                                
                                <input type="hidden" id="hmessage" name="TicketForm[message]">
                                <button type="submit" class="btn btn-primary btn-block btn-100">Submit ticket</button>
                            </form>
</div></div>
</div>
 <div class="col-lg-6  ">
                   
                <div class="card">
                    <div class="card-header body-top-on-this">
                        <div class="row align-items-center">
                            <div class="col-md">
                                <h3 class="card-title">Support History</h3>
                                <p class="card-h-text">Your Ticket history</p>
                            </div>
                        </div>
                    </div>
                    <!-- ./card-header -->
                            <div class="tickets-list__margin-table">
                                <div class="table-bg component_table mt-2">
                                    <div class="table-wr table-responsive">
                                        <table class="table">
                                            <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>Subject</th>
                                                <th>Status</th>
                                                <th class="nowrap">Last update</th>
                                            </tr>
                                            </thead>
                                            <tbody>

              {% for ticket in ticketList %}
                <tr>
                  <td>{{ ticket['ticket_id'] }}</td>
                  {% if ticket["support_new"] == 2 %}
                    <td><a href="tickets/{{ ticket['ticket_id'] }}"><strong>{{ ticket['subject'] }}</strong></a></td>
                  {% else %}
                    <td><a href="tickets/{{ ticket['ticket_id'] }}">{{ ticket['subject'] }}</a></td>
                  {% endif %}
                  <td>{{ ticket['status'] }}</td>
                  <td><span class="wrap">{{ ticket['lastupdate_time'] }}</span></td>
                </tr>
              {% endfor %}
</td>
            </tbody>
          </table>
        </div>
      </div>
  </div>
</div> </div></div>
        </div>
        </div></div>
      {% endif %}
      
<div id="block_81">
    <div class="tickets-list">
        <div class="bg"></div>
        <div class="divider-top"></div>
        <div class="divider-bottom"></div>
        <div class="container">
            <div class="row tickets-list__alignment">
                

{% if pagination["count"] > 1 %}
        <ul class="pagination">

          {% if pagination["current"] != 1 %}
            <li>
              <a href="tickets/{{ id }}/{{ pagination["previous"] }}{% if search %}?search={{ search }}{% endif %}" aria-label="Previous">
                <span aria-hidden="true">«</span>
              </a>
            </li>
          {% endif %}

          {% set r, l = 3, 3 %}

          {% if pagination['current'] == 1 %}
            {% set r = 7 %}
          {% endif %}

          {% if pagination['current'] == 2 %}
            {% set r = 5 %}
          {% endif %}

          {% if pagination['current'] >= pagination['count'] %}
            {% set l = 5 %}
          {% endif %}

          {% for page in 1..pagination["count"] %}
            {% if page >= (pagination['current']-l) and page <= (pagination['current']+r) %}
              <li{% if page == pagination['current'] %} class="active" {%endif%}><a href="tickets/{{ id }}/{{ page }}{% if search %}?search={{ search }}{% endif %}">{{ page }}</a></li>
            {%endif%}
          {% endfor %}

          {% if pagination['current'] < pagination['count'] %}
            <li>
              <a href="ticket/{{ id }}/{{ pagination['next'] }}{% if search %}?search={{ search }}{% endif %}" aria-label="Next">
                <span aria-hidden="true">»</span>
              </a>
            </li>
          {% endif %}

        </ul>
      

    </div></div></div>    </div>
</div></div>


                        </div>
                        <!-- ./card-body -->
                    </div>
                    <!-- ./card -->
                </div>
                            </div>
        </div>
    </section>

      </div>
    
                          </div>

{% endif %}

  
 <div class="divider-top"></div>
        <div class="divider-bottom"></div>
        <div class="container">
 
		{% if contentText2 %}
          <div class="card mb-4">
{{ contentText2 }}
            </div>
{% endif %}
</div>


{% include 'footer.twig' %}