<div class="breadcrumb">
    <h1>Clinic Point Transactions</h1>
    <ul>
        <li><a href="<?php echo SITE_URL.ADMIN_DIR ?>">Dashboard</a></li>
        <li>Clinic Point Transactions List</li>
    </ul>
</div>
<div class="separator-breadcrumb border-top"></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-3 mt-3 mt-md-0" id="div_clinic_id">
                        <label>Clinic</label>
                        <select id="clinic_id" class="form-control">
                            <option value="">Select Clinic</option>
                            <?php
                            $clinicObj = new clinic();
                            $clinics = $clinicObj->getAllRecords([]);
                            if($clinics){
                                foreach($clinics as $c){
                                    echo "<option value='".$c->clinic_id."'>".$c->clinic_name."</option>";
                                }
                            }
                            ?>
                        </select>
                    </div>

                    <div class="col-md-3 mt-3 mt-md-0" id="div_pointmaster_id">
                        <label>Point Title</label>
                        <select id="pointmaster_id" class="form-control">
                            <option value="">Select Point Title</option>
                            <?php
                            // Assuming a pointmaster class exists
                            $pointmasterObj = new pointmaster(); 
                            $points = $pointmasterObj->getAllRecords([]);
                            if($points){
                                foreach($points as $p){
                                    echo "<option value='".$p->pointmaster_id."'>".$p->pointmaster_title."</option>";
                                }
                            }
                            ?>
                        </select>
                    </div>
                    
                    <div class="col-md-2 mt-3 mt-md-0">
                        <label>&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>&nbsp;</label>
                        <button type="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">
                    <table id="list" class="display table table-striped table-bordered" style="width:100%">
                        <thead>
                            <tr>
                                <th>Clinic Name</th>
                                <th>Point Title</th>
                                <th>Points Details</th>
                                <th>Description</th>
                                <th>Transaction</th>
                                <th>Agency User</th>
                                <th>User</th>
                                <th>Created At</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>


<script type="application/javascript">
$(document).ready(function() {
    $('#list').DataTable({ 
        "ajax": "clinicPointsTrans.php?act=load",
        "processing": true,
        "serverSide": true,
        "pageLength": 25,
        "language": {
            "processing" : "<div class='loader-bubble loader-bubble-primary m-5'></div>",
            "sEmptyTable" :  "No records found."
        }
    });

    // $("form").on("submit", function(e) {
    //     e.preventDefault();

    //     var clinic_id = $("#clinic_id").val();
    //     var pointmaster_id = $("#pointmaster_id").val();

    //     $('#list').DataTable().destroy();
    //     $('#list').DataTable({ 
    //         "ajax": "clinicPointsTrans.php?act=load"
    //                 +"&clinic_id="+clinic_id
    //                 +"&pointmaster_id="+pointmaster_id,
    //         "processing": true,
    //         "serverSide": true,
    //         "pageLength": 25,
    //         "aaSorting": [[10, "desc"]], 
    //         "language": {
    //             "processing" : "<div class='loader-bubble loader-bubble-primary m-5'></div>",
    //             "sEmptyTable" :  "No records found."
    //         }
    //     });
    // });
});
</script>