<?php
require("../connection.php");
include("../user.php");
$user_id = $_SESSION['user'];
$username = $_SESSION['user_name'];
$branch_id = $_SESSION['branch_id'];
$ho_access = $_SESSION['ha'];
$branch = $_SESSION['division_name'];
?>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo TITLE; ?></title>
    <meta name="description" content="Ela Admin - HTML5 Admin Template">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="apple-touch-icon" href="../images/bluebase.png">
    <link rel="shortcut icon" href="../images/bluebase.png">

    <link rel="stylesheet" href="../css/normalize.min.css">
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/themify-icons.css">
    <link rel="stylesheet" href="../css/pe-icon-7-stroke.min.css">
    <link rel="stylesheet" href="../css/flag-icon.min.css">
    <link rel="stylesheet" href="../assets/css/cs-skin-elastic.css">
    <link rel="stylesheet" href="../assets/css/style.css">
    <link href="../css/chartist.min.css" rel="stylesheet">
    <link href="../css/jqvmap.min.css" rel="stylesheet">

    <link href="../css/weather-icons.css" rel="stylesheet" />
    <link href="../css/fullcalendar.min.css" rel="stylesheet" />

    <script src="../js/jquery-1.12.4.min.js"></script>
<script src="../js/jquery-3.3.1.js"></script>
<script src="../js/jquery.dataTables.min.js"></script>


    <script src="../js/popper.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/jquery.matchHeight.min.js"></script>
    <script src="../assets/js/main.js"></script>
    <script src="../js/jquery-3.3.1.min.js"></script>
    <style>
        #weatherWidget .currentDesc {
            color: #ffffff !important;
        }

        .traffic-chart {
            min-height: 335px;
        }

        #flotPie1 {
            height: 150px;
        }

        #flotPie1 td {
            padding: 3px;
        }

        #flotPie1 table {
            top: 20px !important;
            right: -10px !important;
        }

        .chart-container {
            display: table;
            min-width: 270px;
            text-align: left;
            padding-top: 10px;
            padding-bottom: 10px;
        }

        #flotLine5 {
            height: 105px;
        }

        #flotBarChart {
            height: 150px;
        }

        #cellPaiChart {
            height: 160px;
        }

        th {
            text-transform: uppercase;
        }

        td {
            text-transform: uppercase;
        }

        .profile-photo {
            width: 100px !important;
            height: 100px !important;
            object-fit: cover;
            position: inherit !important;
            /* or 'relative', 'absolute' as needed */
            border-radius: 5px;
            /* optional */
        }
    </style>

    <link rel="stylesheet" href="/asset_temp/datatable/css/jquery.dataTables.min.css">
    <script src="/asset_temp/datatable/js/jquery.dataTables.min.js"></script>
    <!-- button -->
    <link rel="stylesheet" type="text/css" href="/asset_temp/button/css/buttons.css" /><!-- button -->

    <script>
        $(document).ready(function () {
            $('#example').DataTable();
        });
    </script>
</head>

<body>
    <?php require('../sidemenu.php'); ?>
    <!-- /#left-panel -->
    <!-- Right Panel -->
    <div id="right-panel" class="right-panel">
        <!-- Header-->
        <?php require('../header.php'); ?>
        <div class="content">
            <!-- Animated -->

            <div class="animated fadeIn">
                <div style="background-color:white;margin-bottom:10px;">
                    <strong style="color:blue">
                        <center>EMPLOYEE DETAILS BULK UPLOAD LOG REPORT</center>
                    </strong>
                </div>
                <button class="button button--moema button--text-thick button--text-upper button--size-s"
                    style="padding:1.5px;" onclick="newemp()"><i class="fa fa-user-plus">CREATE</i></button>
                <button class="button button--moema button--text-thick button--text-upper button--size-s"
                    style="padding:1.5px;" onclick="empupload()"><i class="fa fa-upload">Employee Upload</i></button>

                <table id="example" class="table table-striped table-bordered">

                    <thead>
                        <tr>
                            <th>S.No</th>
                            <th>Employee Name</th>
                            <th>Branch</th>
                            <th>Employee Code</th>
                            <th>Profile</th>
                            <th>Father's Name</th>
                            <th>Date Of Birth</th>
                            <th>Department</th>
                            <th>Gender</th>
                            <th>Email ID</th>
                            <th>Mobile</th>
                            <th>Aadhar No</th>
                            <th>Blood Group</th>
                            <th>Address</th>
                            <th>Action</th>
                        </tr>
                    </thead>

                    <tbody>


                        <?php

                        if ($ho_access == "yes") {
                            $emp = mysqli_query($con, "select em.branch_id,em.profile_photo,em.id as eid,em.emp_no,em.employee_name,em.fathers_name,em.dob,em.gender,em.department,em.mail_id,em.mobile,em.adhar_no,em.address,em.blood_group,bm.id,bm.branch_name from employee_master em join branch_master bm on bm.id=em.branch_id order by em.id asc");
                        } else {
                            $emp = mysqli_query($con, "select em.branch_id,em.profile_photo,em.id as eid,em.emp_no,em.employee_name,em.fathers_name,em.dob,em.gender,em.department,em.mail_id,em.mobile,em.adhar_no,em.address,em.blood_group,bm.id,bm.branch_name from employee_master em join branch_master bm on bm.id=em.branch_id  where em.branch_id='$branch_id' order by em.id asc");
                        }
                        $s = 1;
                        while ($type = mysqli_fetch_array($emp)) {
                            ?>
                            <tr>
                                <td><?php echo $s++; ?></td>
                                <td><?php echo $type['employee_name']; ?></td>
                                <td><?php echo $type['branch_name']; ?></td>

                                <td><?php echo $type['emp_no']; ?></td>
                                <td>
                                    <?php if ($type['profile_photo']) { ?>
                                        <img src="<?php echo $type['profile_photo']; ?>" class="profile-photo"
                                            alt="Profile Photo" />
                                    <?php } else { ?>-
                                    <?php } ?>
                                </td>
                                <td><?php echo $type['fathers_name']; ?></td>
                                <td><?php echo date("d-m-Y", strtotime($type['dob'])); ?></td>
                                <td><?php echo $type['department']; ?></td>
                                <td><?php echo $type['gender']; ?></td>
                                <td><?php echo $type['mail_id']; ?></td>
                                <td><?php echo $type['mobile']; ?></td>
                                <td><?php echo $type['adhar_no']; ?></td>
                                <td><?php echo $type['blood_group']; ?></td>
                                <td><?php echo $type['address']; ?></td>
                                <td class="">
                                    <button type="button" class="btn btn-link btn-round" id="<?php echo $type['eid']; ?>"
                                        title="Edit employee" onclick="editemp(this.id)">
                                        <i class="fa fa-edit"></i>
                                    </button>
                                    <button type="button" class="btn btn-link btn-round" onclick="deleterow(this.id)"
                                        title="delete" id="<?php echo $type['eid']; ?>">
                                        <i class="fa fa-trash"></i>
                                    </button>
                                </td>
                            </tr>
                            <?php
                        }
                        ?>

                    </tbody>
                </table>

            </div>
        </div>
        <div class="clearfix"></div>
    </div>
</body>

</html>

<?php require("../mainjavascript.js"); ?>