<style>
    .w-25{
        width:25%;
        float:left;
        padding:10px;
    }
</style>
<div class="container bg-white">
    <div class="row">
        <div class="col-sm-12 pt-3 pb-3">
            <ul class="breadcrumb">
                <li class="breadcrumb-item">
                    <a href="<?php echo base_url(); ?>Welcome">Home</a>
                </li>
                
                <li class="breadcrumb-item">
                    Holiday
                </li>
                
                
                
            </ul>
            <form method="post" action="#">
                <h1 class="main-heading">
                    <?php if($success){ echo "<div class='alert alert-success'>".$success."</div>"; } ?>
                    <?php if($error){ echo "<div class='alert alert-danger'>".$error."</div>"; } ?>
                </h1>
                <div class="form-group w-25">
                    <label>Holiday Date</label>
                    <input type="date" name="holiday_date" class="form-control" >
                </div>
                
                <div class="form-group w-25">
                    <label>Holiday Detail</label>
                    <input type="text" name="holiday_detail" class="form-control" placeholder="Holiday Detail">
                </div>
                
                <div class="form-group w-25">
                    <label>Acedemic Session</label>
                    <select name="academic_session" class="form-control" style="">    
                        <option value="">--- Select Academic Session ---</option>
                        <?php 
                        $acedemic_session_table='academic_session_details';
                        $acedemic_session=$this->session->userdata('acedemic_session');
                        $acedemic_session_data=$this->NewFeeModel->get_data($acedemic_session_table);
                        if($acedemic_session_data){
                            foreach($acedemic_session_data as $data){
                        ?>

                        <option value="<?php echo $data['id']; ?>" <?php if($data['id'] == $acedemic_session){ echo "selected"; } ?> ><?php echo $data['year_long'];?></option>

                        <?php
                            }
                        }   
                        ?>
                    </select> 
                </div>
                
                <div class="form-group w-25">
                    <label>&nbsp;&nbsp;</label><br>
                    <button class="btn btn-sm btn-success" type="submit" name="add_holiday">Submit</button>
                </div>
            </form>
            <div class="table-responsive mt-3">
                <table class="table table-bordered" id="mytable">
                    <thead>
                        <tr>
                            <th style="width:35px;">Sl.No.</th>
                            <th>Date</th>
                            <th>Title</th>
                            <th>Edit</th>
                            <th>Delete</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
                        $count=0;
                        $all_holiday=$this->CalenderModel->get_acedemic_session_holidays($acedemic_session);
                        if($all_holiday){
                            foreach($all_holiday as $holiday){
                                $count=$count + 1;
                        ?>
                        <tr>
                            <th style="width:35px;text-align:center;"><?php echo $count; ?></th>
                            <td><?php echo date("d-m-Y",strtotime($holiday['holiday_date'])); ?></td>
                            <td><?php echo $holiday['holiday_detail']; ?></td>
                            <td>
                                <button class="btn btn-sm btn-warning">
                                    <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>
                            </td>
                            <td>
                                <button class="btn btn-sm btn-danger">
                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
                                        <path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"/>
                                    </svg>
                                </button>
                            </td>
                        </tr>
                        <?php
                            }
                        }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>