<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Orders
      </h1>
      <ol class="breadcrumb">
        <li><a href="<?php echo base_url().'admin';?>"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">List</li>
      </ol>
    </section>

    <section class="content">
      <div class="row">
        <?php echo $this->utility->showMsg();?>
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Management</h3>
              
              </div>
               
              <div></div>
            <!-- /.box-header -->
            <div class="box-body table-responsive">
            <form action="<?php echo base_url().'admin/order/all_delete'; ?>" method="post">
              <input type="submit" class="btn btn-success" value="Delete Selected" onclick="return confirm('Are you sure to delete?')">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>#</th>
                  <th>#</th>
                  <th>Order No.</th>
                  <th>Terms Check Date & Time</th>
                  <th>Invoice Date</th>
                  <th>Payment Date</th>
                  <th>Cart Value(&euro;)</th>
                  <th>Total(&euro;)</th>
                  <th>Payment Method</th>
                  <th>Type</th>
                  <?php //if($this->session->userdata('admin_id')=='19624' || $this->session->userdata('admin_id')=='25267'){ ?>
                  <th>Members username</th>
                  <?php //} ?>
        				  <th>CC Ref ID</th>
        				  <th>Transaction ID</th>
                  <th>Status</th>
                  <th>Refund</th>
                  <th>Is Renew</th>
                  <?php //if(chkWritePermission('Manage_Orders',$this->session->userdata('admin_id'))!=0 || $this->session->userdata('admin_id')=='19624' ){ ?>
                  <th>Action</th>
                  <?php //} ?>
                </tr>
                </thead>
              </table>
              </form>
              <p>Total Amount Of Unpaid Party Booking Order: <span class="total_unpaid_booking"></span> (&euro;)</p>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    

    
<script>
  $(function () {
    //$("#example1").DataTable();
    var dataTable = $('#example1').DataTable({
        'processing': true,
        'serverSide': true,
        'serverMethod': 'post',
        'ajax': {
            'url': "<?php echo base_url('admin/order/ajaxOrder') ?>",
            'data': function(data){

            }
        },
        'columns': [
            { data: 'slno' },
            { data: 'check' },
            { data: 'order_id_masked' },
            { data: 'terms_created' },
            { data: 'created' },
            { data: 'payment_date' },
            { data: 'total_base' },
            { data: 'total_sum' },
            { data: 'payment_method_id' },
            { data: 'is_booking' },
            { data: 'username' },
            { data: 'cc_ref_id' },
            { data: 'trn_id' },
            { data: 'payed' },
            { data: 'refund_trn_id' },
            { data: 'is_renewed' },
            { data: 'action' },
        ],
        "drawCallback": function (settings) { 
            // Here the response
            var response = settings.json;
            console.log(response);
            $('.total_unpaid_booking').html(response.total_unpaid_booking);

            <?php if($this->session->userdata('admin_id')=='19624' || $this->session->userdata('admin_id')=='25267'){ ?>
                dataTable.columns(10).visible(true);
            <?php } else { ?>
              dataTable.columns(10).visible(false);
            <?php } ?>
            <?php if(chkWritePermission('Manage_Orders',$this->session->userdata('admin_id'))!=0 || $this->session->userdata('admin_id')=='19624' ){ ?>
                dataTable.columns(16).visible(true);
            <?php } else { ?>
              dataTable.columns(16).visible(false);
            <?php } ?>
        },
        'columnDefs': [ {
          'targets': [16], /* column index */
            'orderable': false,
        }],
        
    });
  });
</script>