<div class="row">
    <div class="col-sm-12">
        <div class="panel panel-bd">

            <div class="panel-heading">
                <div class="panel-title">
                    <h4>
                    </h4>
                </div>
            </div>

            <div class="panel-body">

                <div class="panel-title bulk_add_emp_btn float-right">
                    <a style="color: #fff;" href="<?php base_url() ?>reports_list" class="btn btn-success" id="reportLists">Reports List</a>
                </div>

                <div class="row">


                    <div class="form-group row">
                        <?php echo form_open('reports/Employee_controller/employee_by_department',array('class' => '', 'id' => 'validate'));?>
                        <label class="select col-sm-2"><?php echo display('search') ?>:</label>
                        <div class="col-sm-4">
                            <select name="custdpt" id="division" class="form-control">
                                <option value=""> Select Department</option>
                                <?php
                                foreach ($dropdowndept as $dpts) {
                                    echo '<option value="' . $dpts['dept_id'] . '">' . $dpts['department_name'] . '</option>';
                                }
                                ?>
                            </select>
                        </div>
                        <div class="col-sm-2">
                            <button type="submit" class="btn btn-primary"><?php echo display('search') ?></button>
                            <input type="button" class="btn btn-warning" name="btnPrint" id="btnPrint" value="Print" onclick="printDiv();"/>
                            <a href="<?php base_url() ?>employee_by_department_export/<?php echo $dpt; ?>" class="btn btn-warning" id="exportReport">Export</a>
                        </div>
                        <?php echo form_close()?>
                    </div>


                </div>
            </div>
        </div>

    </div>
</div>
<div class="row">
    <!--  table area -->

    <div class="panel panel-bd">

        <div class="panel-heading">
            <div class="panel-title">
                <h4>
                    <?php echo "Employee Info" ?>
                </h4>
            </div>
        </div>

        <div class="panel-body" id="printArea">
            <div class="table-responsive">
                <table class="table table-bordered table-hover">
                    <thead>
                    <tr>
                        <th><?php echo display('cid') ?></th>
                        <th><?php echo "Employee Name" ?></th>
                        <th><?php echo "Start Date" ?></th>
                        <th><?php echo "Worked" ?></th>
                        <th><?php echo "Status" ?></th>

                    </tr>
                    </thead>
                    <tbody>
                    <?php if (!empty($employee_list)) { ?>
                        <?php $sl = 1; ?>
                        <?php foreach ($employee_list as $row) { ?>
                            <tr class="<?php echo ($sl & 1)?"odd gradeX":"even gradeC" ?>">
                                <td><?php echo $sl; ?></td>
                                <td><?php echo $row->first_name . ' ' . $row->last_name ?></td>
                                <td><?php echo $row->hire_date ?></td>
                                <td>
                                    <?php
                                    $start_date = $row->hire_date;
                                    $current_date = date("Y-m-d");

                                    $diff = abs(strtotime($current_date) - strtotime($start_date));
                                    $years = floor($diff / (365*60*60*24));
                                    $months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
                                    echo $years . " Year " . $months . " Months";
                                    ?>
                                </td>
                                <td>
                                    <?php
                                    if ($row->employee_status == 0){
                                        echo "Cancelled";
                                    }
                                    else if ($row->employee_status == 1){
                                        echo "Active";
                                    }
                                    else if ($row->employee_status == 2){
                                        echo "On Leave";
                                    }
                                    else if ($row->employee_status == 3){
                                        echo "Not Started";
                                    }
                                    else if ($row->employee_status == 4){
                                        echo "Inactive";
                                    }
                                    ?>
                                </td>
                            </tr>
                            <?php $sl++; ?>
                        <?php } ?>
                    <?php } ?>
                    </tbody>
                </table>  <!-- /.table-responsive -->

            </div>
            <div class="biopagination">  <?php echo  $links ?></div>
        </div>
    </div>

</div>
