{% include 'header.twig' %}

<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="well">
                <form method="post" action="tickets" id="ticketsend">
                    <div class="form-group">
                        <label class="ticket-label">{{ lang['tickets.subject'] }}</label>
                        <div class="select">
                            <select class="form-control" id="Konu" name="subject" onchange="handleOrderType(this)">
                                <option value="Order" selected="">Order</option>
                                <option value="Payment">Payment</option>
                                <option value="Other">Other</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" id="order-grubu">
                        <label class="mt-3">Your Order Number</label>
                        <input type="text" class="form-control" id="orderid" placeholder="For Multiple Orders (Ex: 100,1001)" />
                        <label class="mt-3">State Your Problem</label>
                        <div class="select">
                            <select class="form-control" id="request">
                                <option value="Amount Sent Decreased">Amount Sent Decreased</option>
                                <option value="My Order Failed While Loading">My Order Failed While Loading</option>
                                <option value="My Order Is Not Completed">My Order Is Not Completed</option>
                                <option value="Why Was My Order Canceled?">Why Was My Order Canceled?</option>
                                <option value="Other">Other</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" id="payment-grubu" style="display: none;">
                        <label class="mt-3">State Your Problem</label>
                        <div class="select">
                            <select class="form-control" id="payment">
                                <option value="How Do I Load Balance?" selected="">How Do I Load Balance?</option>
                                <option value="My Balance Is Not Confirmed">My Balance Is Not Confirmed</option>
                                <option value="I can't load my balance">I can't load my balance</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="mt-3">{{ lang['tickets.message'] }}<span id="diger-grubu"></span></label>
                        <textarea name="message" class="form-control mb-3" rows="4" cols="50" id="mesaj" placeholder="Make your description as detailed as possible so that we can assist you."></textarea>
                      	<input type="hidden" id="tmessage" name="message">
                    </div>
                    <div class="form-group">
                      <div id="alertArea" class="flash flash-hata mb-3" role="alert" style=""></div>
                      <div id="successArea" class="flash flash-basarili mb-3" role="alert" style="">Your support has reached us! You will be informed as soon as possible.</div>
                        <button id="send-ticket" type="button" class="btn btn-primary btn-block btn-lg">{{ lang['tickets.button'] }}</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    {% if ticketList %}
    <div class="well">
        <table class="table ">
            <thead>
                <tr>
                    <th>{{ lang['tickets.id'] }}</th>
                    <th>{{ lang['tickets.subject'] }}</th>
                    <th>{{ lang['tickets.status'] }}</th>
                    <th class="nowrap">{{ lang['tickets.updated'] }}</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>
													{% if ticket['status'] == 'answered' %}
													<span style="color: #fff;background-color: #28a745;cursor:text;border-radius:5px; padding: 2px 5px;font-size: 12px">answered</span>
													{% endif %}               
													{% if ticket['status'] == 'Pending' %}
													<span style="color: #fff;background-color: #ffcc29;cursor:text;border-radius:5px; padding: 2px 5px;font-size: 12px">Pending</span>
													{% endif %}
													{% if ticket['status'] == 'Closed' %}
													<span style="color: #fff;background-color: #ec4646;cursor:text;border-radius:5px; padding: 2px 5px;font-size: 12px">Closed</span>
															{% endif %}
															</td>
														  <td><span class="nowrap">{{ ticket['lastupdate_time'] }}</span></td>
														</tr>
													{% endfor %}
            </tbody>
        </table>
        {% endif %}
    </div>
</div>
</div>
</div>

{% include 'footer.twig' %}