<?php require view('theme/header'); ?>

<main class="app-main">
    <div class="page-content">
        <div class="container-fluid">
		
			<div class="hp-bbox mt-5 mb-5">
                <div class="row">
                    <div class="col-lg-6">
                        <div class="hpbb-body">
                            <h2 class="hp-title">Destek Merkezine Hoş Geldiniz.</h2>
                            <p class="hpbb-text">
								Para yatırmadan önce hüküm ve koşullarımızı okuduğunuzdan emin olun.<br /> 
								Bonusları olan ödeme yöntemlerini kullanmayı öneririz.
							</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row mt-2">
                <div class="col-lg-6">
                    <div class="card mb-5">
                        <div class="py-4 px-lg-3 px-4">
						
									<div class="t-head th-3">
										<div class="d-flex align-items-center">
											<div class="col-lg-2">
												<div class="t-icon">
													<i class="fal fa-comment-medical"></i>
												</div>
											</div>
											<div class="col-lg-10 col-12">
												<h2>Destek Bileti Oluştur</h2>
												<p>Destek biletinizi buradan oluşturabilirsiniz.</p>
											</div>
										</div>
									</div>
									
							<form id="create_ticket" onsubmit="return false;">
                                <ul class="nav pay-methods-nav mb-3" id="pills-tab" role="tablist">
                                    <li class="nav-item">
                                        <input type="radio" class="cc-input subject tckt-opt" id="subjectOrder" name="title" value="Sipariş" checked="checked">
                                        <label for="subjectOrder" class="nav-link">
                                            <div class="onav-text"><i class="far fa-box-open"></i> Sipariş</div>   
                                        </label>
                                    </li>
                                    <li class="nav-item">
                                        <input type="radio" class="cc-input subject tckt-opt" id="subjectPayments" name="title" value="Ödeme">
                                        <label for="subjectPayments" class="nav-link">
                                            <div class="onav-text"><i class="far fa-credit-card"></i> Ödeme</div>   
                                        </label>
                                    </li>
                                    <li class="nav-item">
                                        <input type="radio" class="cc-input subject tckt-opt" id="subjectService" name="title" value="Servis">
                                        <label for="subjectService" class="nav-link">
                                            <div class="onav-text"><i class="far fa-server"></i> Servis</div>   
                                        </label>
                                    </li>
                                    <li class="nav-item">
                                        <input type="radio" class="cc-input subject tckt-opt" id="subjectOther" name="title" value="Diğer">
                                        <label for="subjectOther" class="nav-link">
                                            <div class="onav-text"><i class="far fa-blanket"></i> Diğer</div>   
										</label>
									</li>
                                </ul>


									<div class="fga ordernumbers mt-3" style="display: block;">
										<label for="ordernumbers">Sipariş No: </label>
										<div class="fg mt-2">
											<div class="fg-icon"><i class="far fa-hashtag"></i></div>
											<input id="ordernumbers" type="text" class="fg-control" placeholder="Birden fazla sipariş için lütfen virgül kullanarak ayırın. (örnek: 12345,12345,12345)">
										</div>
									</div>
									
									<div class="fga transactionid mt-3" style="display:none;">
										<label for="transactionid">Ödeme No: </label>
										<div class="fg mt-2">
											<div class="fg-icon"><i class="far fa-hashtag"></i></div>
											<input id="transactionid" type="text" class="fg-control" placeholder="Ödeme Numarasını Giriniz">
										</div>
									</div>

									<div class="fga mt-3">
										<label for="message">Mesaj: </label>
										<div class="fg mt-2">
										  <textarea class="fg-control" rows="7" id="message" name="message" style="min-height: 150px"></textarea>
										</div>
									</div>
									<input name="_csrf" value="{{csrftoken}}" type="hidden">
                                    <input id="hmessage" name="message" type="hidden">
									<input type="hidden" name="message" id="alldata">
									<button id="submit" type="submit" class="btn btn-primary btn-lg btn-block mt-4 mb-3">Destek Talebi Gönder</button>
							</form>
							

								  
                        </div>
                    </div><!-- card -->
                </div><!-- col -->
                <div class="col-lg-6">
                    <div class="card">
                        <div class="py-4 px-lg-3 px-4">
						
									<div class="t-head th-3">
										<div class="d-flex align-items-center">
											<div class="col-lg-2">
												<div class="t-icon">
													<i class="fal fa-ticket-alt"></i>
												</div>
											</div>
											<div class="col-lg-10 col-12">
												<h2>Destek Taleplerim</h2>
												<p>Yaptığınız talepleri buradan görebilirsiniz.</p>
											</div>
										</div>
									</div>
									
									
                            <div class="old-tickets">
                                
								<?php 
								if ($tickets != NULL) {
								foreach($tickets as $ticket) { ?>	
                              		<div class="old-ticket">
									<a href="<?=site("tickets/$ticket[ticket_id]")?>">
										<div class="card mb-3">
											<div class="py-4 px-lg-3 px-4">
												<div class="row">
													<div class="col-lg-3 col-6">
														<h4 class="op-title">Talep No</h4>
														<div id="ticket-id" class="op-id <?php if($ticket['ticket_status'] == 1) {if($ticket['ticket_ans'] == 1){echo "pending";}elseif($ticket['ticket_ans'] == 2){echo "answered";}else{echo "pending";}} elseif($ticket["ticket_status"] == 0){echo "";}elseif($ticket["ticket_status"] == 2){echo "pending";}?>"><?=$ticket["ticket_id"]?></div>
														
													</div>
													<div class="col-lg-5 col-6">
														<h4 class="op-title">
															<span>Konu Başlığı</span>
														</h4>
														<div class="op-date"><?=$ticket["ticket_title"] ?></div>
													</div>
													<div class="col-lg-4 col-12 text-center">
															<div class="op-status op-<?php if($ticket['ticket_status'] == 1) {if($ticket['ticket_ans'] == 1){echo "waiting";}elseif($ticket['ticket_ans'] == 2){echo "answered";}else{echo "waiting";}} elseif($ticket["ticket_status"] == 0){echo "closed";}elseif($ticket["ticket_status"] == 2){echo "waiting";}?>">
															<?php if($ticket['ticket_status'] == 1) {if($ticket['ticket_ans'] == 1){echo "Beklemede";}elseif($ticket['ticket_ans'] == 2){echo "Yanıtlandı";}else{echo "Beklemede";}} elseif($ticket["ticket_status"] == 0){echo "Kapandı";}elseif($ticket["ticket_status"] == 2){echo "Beklemede";}?>
															</div>
													</div>
												</div>
											</div>
										</div>
									</a>
                                </div>
							   <?php }}else {?>
				<div class="card mt-3">
				<div class="card-body">
					<div class="noorders text-center">
							<img src="<?= theme("assets/images/smiley.svg"); ?>" class="img-fluid smiley my-5" />
							<p>Merhaba <strong>{USER_USERNAME}</strong>, daha önce hiç destek talebi açmadın.</p>
							<p>yandaki kısımdan destek talebi açabilirsin.</p>
					</div>
				</div>
			</div>
				<?php } ?>
							   
                           </div>

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

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


 

<?php require view('theme/footer'); ?>