<div class="container-fluid">
        <!--  Row 1 -->
      
        <div class="row">
       
          <div class="col-lg-12 d-flex align-items-stretch">
            <div class="card w-100">
              <div class="card-body p-4">
                <div style="display: flex; justify-content: space-between; align-items: center;">
                  <h2 class="mb-4">Store</h2>
                 <a href="<?= site_url('/admin/store/create') ?>"><button type="button" class="btn btn-primary ">Create+</button></a> 
              </div>
                
                <div class="table-responsive mt-3 ">
                  <table id="example" class="table text-nowrap  text-center">
                    <thead class="text-dark fs-4">
                      <tr class="">
                      
                        <th class="border-bottom-0">
                           # 
                        </th>
                        <th class="border-bottom-0">
                           Credits 
                        </th>
                        <th class="border-bottom-0">
                           Price 
                        </th>
                        <th class="border-bottom-0">
                             Discount 
                        </th>
                        <th class="border-bottom-0">
                             Action 
                        </th>
                      </tr>
                    </thead>
                    <tbody class="text-start">
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      
 

      
<script>
  $(document).ready(function() {
    $('[data-toggle="tooltip"]').tooltip();
  });


  $('#example').DataTable({
    ajax: {
      url: '<?= site_url() ?>/admin/store/get_store_credit_list',
      type: 'POST',
      data: function(d) {
        // d.order = [{
        //   column: 0, // Specify the column index for sorting (0 represents the first column)
        //   dir: 'desc' // Set the sorting direction to 'desc' for descending order
        // }];
      },
    },
    processing: true,
    serverSide: true
  });
</script>


<script>
    function delete_credit(creditId){
        $.ajax({
            url: "<?= site_url(); ?>/admin/store/delete_credit?credit_id="+creditId,
            method: 'delete',
            dataType: 'json',
            success: function(response){
                success(response.message);
                setTimeout(function(){
                    location.reload();
                }, 3000);
            },error: function(error){
                error(response.message);
            }
        })
    }

    function reload_table(){
        $('#example').DataTable().ajax.reload();
    }

</script>