<?php
$filename=basename($_SERVER['SCRIPT_FILENAME']);
$adminlogObj = new admin_log();

if($filename == 'adminlist.php')
{
    $module_id = $adminlogObj->getModuleId($filename);
}
?>

<div class="breadcrumb">
    <h1>Order List</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Order List</li>
    </ul>
</div>
<div class="separator-breadcrumb border-top"></div>

<!-- <form action="" method="post" id="searchFrm" name="searchFrm">
<div class="row">
    <div class="col-lg-12 col-md-12">
        <div class="card mb-5">
            <div class="card-body">
                <div class="row row-xs">
                    
                    <div class="col-md-2 mt-3 mt-md-0"  id="div_admin_name">
                        <label for="admin_name">Name</label>
                        <input type="text" class="form-control" name="admin_name" id="admin_name"  />
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_admin_email">
                        <label for="admin_email">Email</label>
                        <input type="text" class="form-control" name="admin_email" id="admin_email"  />
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0"  id="div_admin_role_type">
                        <label for="admin_role_type">Role Type</label>
 

                        <select class="form-control" id="admin_role_type" name="admin_role_type">
                            <option value="">Select Role</option>
                            <?php
                                  $roleobj = new role;
                                  $fields = array('role_id,role_name');
                                  $roleArg = array("fields"=>$fields);
                                  $roledata = $roleobj->getAllRecords($roleArg);
                                  foreach ($roledata as $ckey => $role_value) 
                                    { 
                                      ?>
                                        <option value="<?php echo $role_value->role_id; ?>"><?php echo $role_value->role_name; ?></option>
                              <?php }
                            ?>

                        </select>
                    </div>
                    
                    <div class="col-md-2  mt-3 mt-md-0">
                        <label for="admin_status">Status</label>
                        <select class="form-control" id="admin_status" name="admin_status">
                            <option value="">Select Status</option>
                            <option value="1">Active</option>
                            <option value="0">Inactive</option>
                        </select>
                    </div>

                    <div class="col-md-2 mt-3 mt-md-0">
                        
                        <label for="">&nbsp;</label>
                        <button type="submit" name="submit" class="btn btn-primary btn-block">Search</button>
                    </div>
                    <div class="col-md-2 mt-3 mt-md-0">
                        
                        <label for="">&nbsp;</label>
                        <button type="reset" name="reset" class="btn btn-primary btn-block" onClick="window.location.reload()">Reset</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</form> -->


<!-- <div class="row mb-4">
  <div class="col-md-6">
        <select id="act" name="act" class="form-control maction">
          <option value="">Multiple action</option>              
          <option value="activate_all">Activate selected</option>
          <option value="inactivate_all">De-activate selected</option>
          
        </select>
        <button type="button" class="btn btn-primary m-1" onclick="return validate_all();">Apply</button>
  </div>
  <div class="col-md-6 pull-right">
        <div class="button-group">
            <a href="pointadd.php" class="btn btn-dark m-1"><i class="i-Add-User"></i> Add New</a>
      </div>    
  </div>  
</div> -->
<div class="widget-body">
    <div class="portlet-body">
                        
    <?php echo (isset($successMsg) && $successMsg!='') ? "<div class='alert alert-success'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($successMsg)."</div>" : '' ; ?>
    <?php echo (isset($failedMsg) && $failedMsg!='') ? "<div class='alert alert-danger'><button data-dismiss='alert' class='close' type='button'>×</button>".base64_decode($failedMsg)."</div>" : '' ?>
   
    <div id="status_msg" style="display: none;"><div class="alert alert-success"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>
    <div id="alert_msg" style="display: none;"><div class="alert alert-danger"><button data-dismiss='alert' class='close' type='button'>×</button>&nbsp;</div></div>

    </div>
</div>
<!-- <form action="" method="post">
  <div class="row">
    <div class="col-lg-12 col-md-12">
      <div class="card mb-5">
        <div class="card-body">
          <div class="row row-xs">
            <div class="col-md-2  mt-3 mt-md-0">
                <label for="claimNumber">Claim Number</label>
                <input type="text" class="form-control" name="claimNumber" id="claimNumber" />
            </div>
            <div class="col-md-2  mt-3 mt-md-0">
              <label for="clinic_id">Clinic</label>
              <select class="form-control" id="clinic_id" name="clinic_id">
                <option value="">Select Clinic</option>
                <?php
                      $clinicObj =  new  clinic();
                      $fields  = array('c.clinic_id','c.clinic_name');
                      $data    = array('fields' => $fields);
                      $clinicDetails = $clinicObj->getAllRecords($data);
                  ?>
                  
                  <?php if($clinicDetails && count($clinicDetails) > 0){ 
                        foreach($clinicDetails as $clinicdata){ ?>
                      <option value="<?php echo $clinicdata->clinic_id; ?>"><?php echo $clinicdata->clinic_name; ?></option>
                      <?php } } ?>
              </select>
            </div>
            <div class="col-md-2 mt-3 mt-md-0">
                <label for="">&nbsp;</label>
                <button type="submit" name="submit" class="btn btn-primary btn-block">Search</button>
            </div>
            <div class="col-md-2 mt-3 mt-md-0">
                <label for="">&nbsp;</label>
                <button type="reset" name="reset" class="btn btn-primary btn-block" onClick="window.location.reload()">Reset</button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</form> -->
<div class="row mb-4">
  <div class="col-md-12 mb-4">
    <div class="card text-left">

      <div class="card-body">
          <div class="table-responsive">
            <form id="listFrm" name="listFrm" action="" method="post">       
              <input type="hidden" id="action" name="action" value="">
              <table id="list" class="display table table-striped table-bordered" style="width:100%">
                  <thead>
                    <tr>
                      <th>Order</th>
                      <th>Reward</th>
                      <th>Sender</th>
                      <th>Receiver</th>
                      <th>Amount</th>
                      <th>Status</th>
                    </tr>
                  </thead>
              </table>
            </form>
          </div>
      </div>
    </div>
  </div>
</div>
<!-- <link href="./assets/styles/css/select2.min.css" rel="stylesheet" />
<script src="./assets/js/select2.min.js"></script>

<style type="text/css">
.select2 {
  width: 160px !important;
}
</style> -->
<script type="application/javascript">
    // $("#clinic_id").select2({
    //     tags: true
    // });
    $(document).ready(function() {
      $('#list').DataTable( {
        "ajax": "tango_orderlist.php?act=load&redeemed_id=<?php echo $_GET['redeemed_id'] ?>",
        "processing": true,
        "serverSide": true,
        "pageLength": 25,
              "aaSorting": [],
              "aoColumnDefs": [
                  { 'bSortable': false, 'aTargets': [0] },
                  { 'bSortable': false, 'aTargets': [1] },
                  { 'bSortable': false, 'aTargets': [2] },
                  { 'bSortable': false, 'aTargets': [3] },
                  { 'bSortable': false, 'aTargets': [4] },
                  { 'bSortable': false, 'aTargets': [5] },
                  
              ],
        language: {
            "processing" : "<div class='loader-bubble loader-bubble-primary m-5'></div>",
            "sEmptyTable" :  "No records found."
        }
      });
      // $("form").on("submit", function(e) {
      //   e.preventDefault();
      //   var claimNumber = $("#claimNumber").val();
      //   var clinic_id = $("#clinic_id").val();
        
      //   $('#list').DataTable().destroy();
      //   $('#list').DataTable({ 
      //     "ajax": "loyaltyclaimlist.php?act=load&claimNumber="+claimNumber+"&clinic_id="+clinic_id,
      //     "processing": true,
      //     "serverSide": true,
      //     "pageLength": 25,
      //     "aaSorting": [],
      //     "aoColumnDefs": [
      //         { 'bSortable': false, 'aTargets': [0] },
      //         { 'bSortable': false, 'aTargets': [1] },
      //         { 'bSortable': false, 'aTargets': [2] },
      //         { 'bSortable': false, 'aTargets': [3] },
      //         { 'bSortable': false, 'aTargets': [4] },
      //         { 'bSortable': false, 'aTargets': [5] },
      //     ],
      //     language: {
      //         "processing" : "<div class='loader-bubble loader-bubble-primary m-5'></div>",
      //         "sEmptyTable" :  "No records found."
      //     }
      //   });
      // });
    });
</script>