<style>
    table.dataTable > tbody > tr.child ul {
        display: flex;
    !important;
    }

    #DataTables_Table_0 td, #DataTables_Table_0 th {
        display: table-cell !important;
    }

    #DataTables_Table_0 > tbody > tr > td:first-child:before, #DataTables_Table_0 > tbody > tr > th:first-child:before {
        display: none;
    }

    /*#DataTables_Table_0 > tbody > tr > td:first-child {*/
    /*    padding-left: 10px !important;*/
    /*}*/

    /*#DataTables_Table_0 tbody tr td:nth-child(1) {*/
    /*    display: inline-block !important;*/
    /*    width: 200px !important;*/
    /*}*/
</style>
<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')); ?>
                        <button style="margin-left: 20px;" type="button" class="btn btn-primary" data-target="#filter"
                                data-toggle="modal"><?php echo "Select Filters" ?></button>
                        <?php echo form_close() ?>
                    </div>

                    <div class="row">
                        <div class="col-sm-4">
                            <strong>Date Range:</strong>
                            <p><?php echo $from_date . ' to ' . $to_date?></p>
                        </div>

                        <div class="col-sm-4">
                            <strong>Department:</strong>
                            <p><?php echo $dept_name ?></p>
                        </div>

                        <div class="col-sm-4">
                            <strong>Duty Type:</strong>
                            <p><?php echo $duty_type ?></p>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-sm-4">
                            <strong>Employee Status:</strong>
                            <p><?php echo $employee_status ?></p>
                        </div>

                        <div class="col-sm-4">
                            <strong>State:</strong>
                            <p><?php echo $state ?></p>
                        </div>

                    </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 Attendance Report " ?>
                </h4>
            </div>
        </div>

        <div class="panel-body" id="printArea">
            <div class="table-responsive">
                <table width="100%" class="datatable table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <th><?php echo "Employee Name" ?></th>
                        <?php
                        if (isset($date_range)) {
                            foreach ($date_range as $range) {
                                $date = date("d", strtotime($range));
                                $day = date("D", strtotime($range));
                                ?>
                                <th><?php echo $date ?><br><?php echo $day ?></th>
                            <?php }
                        }
                        ?>
                        <th><?php echo "Total Hours" ?></th>

                    </tr>
                    </thead>
                    <tbody>
                    <?php if (!empty($master_data)) { ?>
                        <?php $sl = 1; ?>
                        <?php foreach ($master_data as $row) { ?>
                            <tr class="<?php echo ($sl & 1) ? "odd gradeX" : "even gradeC" ?>">
                                <?php
                                foreach ($row as $k => $v) { ?>
                                    <td><?php echo $v ?></td>
                                <?php }
                                ?>
                                <?php $sl++; ?>
                            </tr>
                        <?php } ?>
                    <?php } ?>
                    </tbody>
                </table>  <!-- /.table-responsive -->

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

</div>

<div id="filter" class="modal fade" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <center><strong><h4><i class='fa fa-book' aria-hidden='true'></i>Filter Reports</h4></strong></center>
            </div>
            <div class="modal-body">


                <div class="row">
                    <div class="col-sm-12 col-md-12">
                        <div class="panel">
                            <div class="panel-heading">
                                <div class="panel-title">

                                </div>
                            </div>
                            <div class="panel-body">

                                <?php echo form_open_multipart('reports/Employee_controller/attendance_report') ?>

                                <div class="row">
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label for="employee_id" class="">
                                                <?php echo "Employee Name" ?></label>
                                            <select name="employee_id" class="form-control">
                                                <option value="">All</option>
                                                <?php foreach ($dropdownemp as $emp) { ?>
                                                    <option value="<?php echo $emp['employee_id'] ?>"><?php echo $emp['first_name'] . ' ' . $emp['last_name'] ?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-sm-3" id="start_date_div">
                                        <div class="form-group">
                                            <label for="from_date" class="">
                                                <?php echo "From Date" ?></label>
                                            <input type="text" name="from_date"
                                                   placeholder="<?php echo "Enter Start Date" ?>"
                                                   class="form-control datepicker">
                                        </div>

                                    </div>
                                    <div class="col-sm-3" id="end_date_div">
                                        <div class="to_date">
                                            <label for="to_date" class="">
                                                <?php echo "To Date" ?></label>
                                            <input type="text" name="to_date"
                                                   placeholder="<?php echo "Enter End date" ?>"
                                                   class="form-control datepicker">
                                        </div>

                                    </div>

                                </div>

                                <div class="row">
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label for="employee_id" class="">
                                                <?php echo "Department Name" ?></label>
                                            <select name="dept_id" class="form-control">
                                                <option value="">All</option>
                                                <?php foreach ($dropdowndept as $dept) { ?>
                                                    <option value="<?php echo $dept['dept_id'] ?>"><?php echo $dept['department_name'] ?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label for="employee_id" class="">
                                                <?php echo "Duty Type" ?></label>
                                            <select name="duty_type" class="form-control">
                                                <option value=""> Select</option>
                                                <option value="1"> Intern</option>
                                                <option value="2"> Full Time</option>
                                                <option value="3"> Part Time</option>
                                                <option value="4"> Contractual</option>
                                                <option value="5"> Other</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="row mb-5">
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label for="employee_id" class="">
                                                <?php echo "Employee Status" ?></label>
                                            <select name="employee_status" class="form-control">
                                                <option value="">Select Status</option>
                                                <option value="4">Cancelled
                                                </option>
                                                <option value="3">Not Started
                                                </option>
                                                <option value="2">On Leave
                                                </option>
                                                <option value="1">Active
                                                </option>
                                                <option value="5">Inactive
                                                </option>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label for="state" class="">
                                                <?php echo "Work Location" ?></label>

                                            <select name="state" class="form-control">
                                                <option value="">All</option>
                                                <?php foreach ($country_list as $list) {
                                                    ?>
                                                    <option value="<?php echo $list ?>"><?php echo $list ?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group form-group-margin text-right">
                                    <button type="submit"
                                            class="btn btn-success w-md m-b-5"><?php echo 'View Report' ?></button>
                                </div>
                                <?php echo form_close() ?>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">

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