<div class="container mt-3 mb-3 bg-white pt-3 pb-3">
    <div class="row">
        <div class="col-sm-8">
            
            <ul class="breadcrumb">
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Welcome">Home</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Transport">Transport</a></li>
                <li class="breadcrumb-item"><a href="<?php echo base_url();?>Transport/add_new_vehicle_driver">Add New Driver</a></li>
                <li class="breadcrumb-item"><a href="#">Vehicle Drivers</a></li>
            </ul>
            
            
            <ul class="nav nav-tabs tab-item-1">
                    <li class="nav-item ">
                        <a class="nav-link active" href="#">Vehicle Drivers</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="<?php echo base_url(); ?>Transport/add_new_vehicle_driver">Add New Vehicle Driver</a>
                    </li>
                    
            </ul>
                
            <!--<a href="" class="btn btn-sm btn-success mb-3">Add New Vehicle Driver</a>-->
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Name</th>
                            <th>Father's Name</th>
                            <th>D.O.B.</th>
                            <th>Mob. No.</th>
                            <th>D.L. No.</th>
                            <th>Staff Type</th>
                            <th>D.L. Renewal Date</th>
                            <th>Action</th>
                            <th>View</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
                        $table='vehicle_driver';
                        $get_all_drivers=$this->TransportModel->get_data($table);
                        $count=0;
                        if($get_all_drivers){
                            foreach($get_all_drivers as $list_drivers){
                                $count=$count + 1;
                                if($list_drivers['is_deleted'] !=1){
                        ?>
                        <tr>
                            <td><?php echo $count;?></td>
                            <td><?php echo $list_drivers['driver_name'];?></td>
                            <td><?php echo $list_drivers['driver_father_name'];?></td>
                            <td><?php echo date('d-M-Y',strtotime($list_drivers['dob']));?></td>
                            <td><?php echo $list_drivers['driver_contact_no'];?></td>
                            <td><?php echo strtoupper($list_drivers['driver_license_no']);?></td>
                            <td><?php echo $list_drivers['staff_type'];?></td>
                            <td><?php echo date('d-M-Y',strtotime($list_drivers['dl_renewal_date']));?></td>
                            
                            <td>
                                
                                <form method="post" action="<?php echo base_url();?>Transport/add_new_vehicle_driver">
                                    <!--<button class="btn btn-sm btn-warning" name="edit" value="<?php echo $data['id']; ?>" type="submit">Edit</button>-->
                                
                                    <button class="btn btn-sm btn-warning" type="submit" name="edit" value="<?php echo $list_drivers['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>
                                <a href="#" class="btn btn-sm btn-info">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-fill" viewBox="0 0 16 16">
                                        <path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
                                        <path d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
                                    </svg>
                                </a>
                                
                                <button class="btn btn-sm btn-danger delete-item" value="<?php echo $list_drivers['id']; ?>">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash2-fill" viewBox="0 0 16 16">
                                        <path d="M2.037 3.225A.703.703 0 0 1 2 3c0-1.105 2.686-2 6-2s6 .895 6 2a.702.702 0 0 1-.037.225l-1.684 10.104A2 2 0 0 1 10.305 15H5.694a2 2 0 0 1-1.973-1.671L2.037 3.225zm9.89-.69C10.966 2.214 9.578 2 8 2c-1.58 0-2.968.215-3.926.534-.477.16-.795.327-.975.466.18.14.498.307.975.466C5.032 3.786 6.42 4 8 4s2.967-.215 3.926-.534c.477-.16.795-.327.975-.466-.18-.14-.498-.307-.975-.466z"/>
                                    </svg>
                                </button>
                            </td>
                             
                            <td></td>
                        </tr>
                        <?php
                                }
                            }
                        }
                        ?>

                    </tbody>
                </table>
            </div>
        </div>
        
        <div class="col-sm-4">
            <?php $this->load->view('erp/transport/quick-links');?>
        </div>
        
    </div>
</div>

<script>
    $(document).ready(function(){
        $(".delete-item").click(function(){
            var item_id=$(this).val();
            // alert(item_id);
            // $(this).attr("month");
            var item_block='vehicle_driver';
        
            $.ajax({
                url: '<?php echo base_url() ?>Transport/delete_item_data',
                type: 'POST', 
                data: {item_id:item_id,item_block:item_block},
                success: function(data){
                    // alert(data);
                    // swal("Fee Submitted Successfully");
                    location.reload(); 
                }
            });
       });
    });
</script>