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


    <div class="app-content">
        <div class="container-fluid">
            <div class="d-card dc-dash">
                <div class="row">
                    <div class="col-lg-6 col-md-8 col-12">
                        <div class="py-3 px-5">
                            <div class="dch-title">
                                Siparişlerim
                            </div>
                            <div class="dch-text">
                                Sitemiz üzerindeki tüm siparişlerinizi burada görebilirsiniz.
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <section class="neworder">

                <div class="row">
                    <div class="col-lg-12 col-12 mb-5 mb-lg-0">
                        <div class="orders-btn py-3">
                            <ul class="nav nav-pills app-ord-nav">


                                    <li class="mr-2">
										 <a class="<?php  if (!array_key_exists(2,$uri)) {?>active <?php } ?>" href="/orders"><i class="fas fa-filter mr-1"></i>Tüm Siparişler</a>
									  </li>
									  <li class="mr-2">
										 <a class="<?php  if (array_key_exists(2,$uri) && $uri[2] == "pending") {?>active <?php } ?>" href="/orders/pending"><i class="fas fa-file-import mr-1"></i>Sipariş Alındı</a>
									  </li>
									  <li class="mr-2">
										 <a class="<?php  if (array_key_exists(2,$uri) && $uri[2] == "inprogress") {?>active <?php } ?>"href="/orders/inprogress"><i class="fas fa-spinner mr-1"></i>Yükleniyor</a>
									  </li>
									  <li class="mr-2">
										 <a class="<?php  if (array_key_exists(2,$uri) && $uri[2] == "completed") {?>active <?php } ?>" href="/orders/completed"><i class="far fa-check-circle mr-1"></i>Tamamlandı</a>
									  </li>
									  <li class="mr-2"><a class="<?php  if (array_key_exists(2,$uri) && $uri[2] == "partial") {?>active <?php } ?>"href="/orders/partial"><i class="fas fa-hourglass-start mr-1"></i>Kısmen Tamamlandı</a></li>
									  <li class="mr-2">
										 <a class="<?php  if (array_key_exists(2,$uri) && $uri[2] == "processing") {?>active <?php } ?>"href="/orders/processing"><i class="fas fa-sort-numeric-down mr-1"></i>Gönderim Sırasında</a>
									  </li>
									  <li class="mr-2">
										 <a class="<?php  if (array_key_exists(2,$uri) && $uri[2] == "canceled") {?>active <?php } ?>" href="/orders/canceled"><i class="fas fa-ban mr-1"></i>İptal Edildi</a>
									  </li>
                                <li class="pull-right search mr-2">
                                        <div class="app-ord-search">
                                            <input type="text" id="datatable_search"name="search" value="" placeholder="Sipariş Ara"
                                                   class="app-ord-input">
                                            <button type="submit" class="app-ord-submit">
                                                <i class="fas fa-search"></i>
                                            </button>
                                        </div>
                                </li>
                            </ul>
                        </div>

                        <div class="d-card" style="word-break: break-all;">
                            <div class="d-card-body">
                                <table id="datable" class="table app-mtable flexs">

                                    <thead>
                                    <tr class="thead-tr">
                                        <th style="width: 7%;">#</th>
                                        <th style="width: 10%;">{ORDERS_DATE}</th>
                                        <th style="width: 10%;">{ORDERS_LINK}</th>
                                        <th class="nowrap" style="width: 7%;">{ORDERS_AMOUNT}</th>
                                        <th class="nowrap" style="width: 13%;">{ORDERS_START_COUNT}</th>
                                        <th style="width: 7%;">{ORDERS_QUANTITY}</th>
                                        <th class="nowrap" style="width: 17%;">{ORDERS_SERVICE}</th>
                                        <th class="nowrap" style="width: 10%;">{ORDERS_STATUS}</th>
                                        <th class="nowrap" style="width: 8%;">{ORDERS_REMAINS}</th>
                                        <th style="width: 25%;">İşlemler</th>
                                    </tr>
                                    </thead>

                                    <tbody>

                                    {ORDERS_LIST}
                                    </tbody>


                                </table>

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

            </section>

        </div>
    </div>

<?php require view('theme/footer'); ?>
	<script src="//cdn.datatables.net/1.10.24/js/jquery.dataTables.min.js"></script>
	<script>
		$(document).ready( function () {
		    $('table tbody td').addClass('app-col');

    $('table tbody tr').addClass('app-block');
         ul = document.getElementsByClassName("app-block");
    for (e = 0; e < ul.length; e++) {
        li = ul[e].getElementsByTagName("td");
        for (i = 0; i < li.length; i++) {
            a = li[i];
             txtValue = a.innerHTML;
             if(i == 0){
             li[i].setAttribute('data-title', 'ID');
             }else if(i == 1){
             li[i].setAttribute('data-title', 'Tarih');
             }else if (i == 2){
             li[i].setAttribute('data-title', 'Link');
             }else if (i == 3){
             li[i].setAttribute('data-title', 'Ücret');
             }else if (i == 4){
             li[i].setAttribute('data-title', 'Başlangıç');
             }else if (i == 5){
             li[i].setAttribute('data-title', 'Miktar');
             }else if (i == 6){
             li[i].setAttribute('data-title', 'Servis');
             }else if (i == 7){
             li[i].setAttribute('data-title', 'Durum');
             }else if (i == 8){
             li[i].setAttribute('data-title', 'Kalan');
             }else if (i == 9){
             li[i].setAttribute('data-title', 'Telafi');
             }
    }
    }
    var table = $('#datable').DataTable({
          "lengthChange": false,
          "lengthMenu": [[-1], [25]],
          "bPaginate": false,
          "order": [[ 0, "desc" ]],
          "bInfo": false,
              createdRow: function (row, data, index) {

        if (data[1] == "") {
            console.dir(row);
            $(row).addClass('app-block');
        }
    }
    });
    $('#datatable_search').on( 'keyup', function () {
    table
        .search( this.value )
        .draw();
} );
    document.getElementById("datable_filter").style.display = "none";
    $('.dataTables_filter input').addClass('app-ord-input');



})




	</script>

