<div class="container mt-3 mb-3 pt-3 pb-3 bg-white">
    <div  class="row">
        <div class="col-sm-12">
            
            <ul class="breadcrumb">
                <li class="breadcrumb-item">Home</li>
                <li class="breadcrumb-item">Miscellaneous</li>
                <li class="breadcrumb-item">Fee heads</li>
            </ul>
            
            <a href="<?php echo base_url();?>Miscellaneous/add_new_fee_head" class="btn btn-sm btn-info mb-3">Add New Fee Head</a>
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Fee Head</th>
                            <th>Fee Type</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $table='misc_fee_heads';
                        $get_fee_heads=$this->MiscellaneousFeeModel->get_data($table);
                        $count=0;
                        if($get_fee_heads){
                            foreach($get_fee_heads as $fee_heads){
                                $count=$count + 1;
                        ?>
                        <tr>
                            <td><?php echo $count;?></td>
                            <td><?php echo $fee_heads['fee_head'];?></td>
                            <td><?php echo $fee_heads['fee_amount_type'];?></td>
                            <td>
                            <?php
                            if($fee_heads['status'] ==1){
                            ?>
                            <button class="btn btn-sm btn-success status_btn" id="status_btn" item_id="<?php echo $fee_heads['id'];?>" atatus_attr="0">Active</button>
                            <?php
                            }else if($fee_heads['status'] ==0){
                            ?>
                            <button class="btn btn-sm btn-danger status_btn" id="status_btn" item_id="<?php echo $fee_heads['id'];?>" atatus_attr="1">Inactive</button>
                            <?php
                            }
                            
                             ?></td>
                            <td>
                                <form method="post" action="<?php echo base_url();?>Miscellaneous/add_new_fee_head">
                                
                                <button class="btn btn-sm btn-warning" type="submit" value="<?php echo $fee_heads['id']; ?>">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pencil-square" viewBox="0 0 16 16">
                                        <path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
                                        <path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
                                    </svg>
                                </button>
                                </form>
                            </td>
                        </tr>
                        <?php
                            }
                        }
                        
                        ?>
                    </tbody>
                </table>
            </div>
            
        </div>
    </div>
</div>

<script>
    $(document).ready(function (){
        $(document).on("click",".status_btn",function(){
            var item_id=$(this).attr("item_id");
            var atatus_attr=$(this).attr("atatus_attr");
            
            alert(item_id);
            alert(atatus_attr);
            
        });
    })
</script>