<?php

if (!$user->cdp_is_Admin())
    cdp_redirect_to("login.php");

$userData = $user->cdp_getUserData();


include "config.php";

$sql = "SELECT * FROM salaries";

$result = $conn->query($sql);

?>
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="assets/<?php echo $core->favicon ?>">
    <title>Salaries List | <?php echo $core->site_name ?></title>
    <!-- This Page CSS -->
    <!-- Custom CSS -->
    <link rel="stylesheet" href="assets/intl-tel-input/css/intlTelInput.css">

    <link href="assets/css/style.min.css" rel="stylesheet">

    <link href="assets/css_log/front.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="assets/js/jquery.js"></script>
    <script type="text/javascript" src="assets/js/jquery-ui.js"></script>
    <script src="assets/js/jquery.ui.touch-punch.js"></script>
    <script src="assets/js/jquery.wysiwyg.js"></script>
    <script src="assets/js/global.js"></script>
    <script src="assets/js/custom.js"></script>
    <link href="assets/customClassPagination.css" rel="stylesheet">


    <script>
        $(document).ready(function () {
            $('[data-toggle="tooltip"]').tooltip();
        });
    </script>

</head>

<body>
<!-- ============================================================== -->
<!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== -->


<?php include 'views/inc/preloader.php'; ?>
<!-- ============================================================== -->
<!-- Main wrapper - style you can find in pages.scss -->
<!-- ============================================================== -->
<div id="main-wrapper">
    <!-- ============================================================== -->
    <!-- Topbar header - style you can find in pages.scss -->
    <!-- ============================================================== -->

    <!-- ============================================================== -->
    <!-- Preloader - style you can find in spinners.css -->
    <!-- ============================================================== -->

    <?php include 'views/inc/topbar.php'; ?>

    <!-- End Topbar header -->


    <!-- Left Sidebar - style you can find in sidebar.scss  -->

    <?php include 'views/inc/left_sidebar.php'; ?>


    <!-- End Left Sidebar - style you can find in sidebar.scss  -->

    <!-- Page wrapper  -->
    <!-- ============================================================== -->
    <div class="page-wrapper">
        <div class="container-fluid">
            <div class="row justify-content-center">
                <!-- Column -->
                <div class="col-lg-10 col-xlg-12 col-md-12">
                    <div class="card">

                        <div class="card-body">
                            <div class="container">
                                <a href="salaries_add.php"><button type="button" class="btn btn-primary btn"><i class="ti-plus" aria-hidden="true"></i> Add Salary</button></a>
                                <h2>Salary List</h2>

                                <table class="table">

                                    <thead>

                                    <tr>

                                        <th><strong>Employee Name</strong></th>

                                        <th><strong>Employee Designation</strong></th>

                                        <th><strong>Salary Amount</strong></th>

                                        <th><strong>Deduct Amount</strong></th>

                                        <th><strong>Salary Month</strong></th>
                                        
                                        <th><strong>Actions</strong></th>

                                    </tr>

                                    </thead>

                                    <tbody>

                                    <?php

                                    if ($result->num_rows > 0) {

                                        while ($row = $result->fetch_assoc()) {

                                            ?>

                                            <tr>

                                                <td><?php echo $row['emp_name']; ?></td>

                                                <td><?php echo $row['emp_designation']; ?></td>

                                                <td><?php echo $row['salary_amount']; ?></td>

                                                <td><?php echo $row['deduct_amount']; ?></td>

                                                <td><?php echo $row['deduct_month']; ?></td>

                                                <td>
                                                    <a  href="salaries_edit.php?id=<?php echo $row['id']; ?>" data-toggle="tooltip" data-placement="top" title="Edit Record"><i style="color:#343a40" class="ti-pencil"></i></a>
                                                &nbsp;
                                                <?php if ($userData->userlevel == 9) { ?>
                                                <a href="delete_sal.php?id=<?php echo $row['id']; ?>" class="delete" data-toggle="tooltip" data-placement="top" title="Delete Record"><i style="color:#343a40" class="ti-trash"></i></a>
                                                <?php } ?>
                                                </td>

                                            </tr>

                                        <?php       }

                                    }

                                    ?>

                                    </tbody>

                                </table>

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

                </div>
                <!-- Column -->
            </div>


        </div>


    </div>
    <!-- ============================================================== -->
    <!-- End Page wrapper  -->
    <!-- ============================================================== -->
</div>
<!-- ============================================================== -->
<!-- End Wrapper -->
<!-- ============================================================== -->


<!-- ============================================================== -->
<!-- All Jquery -->
<!-- ============================================================== -->
<!-- Bootstrap tether Core JavaScript -->
<script src="assets/libs/popper.js/dist/umd/popper.min.js"></script>
<script src="assets/libs/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- apps -->
<script src="assets/js/app.min.js"></script>
<script src="assets/js/app.init.js"></script>
<script src="assets/js/app-style-switcher.js"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="assets/libs/perfect-scrollbar/dist/perfect-scrollbar.jquery.min.js"></script>
<script src="assets/extra-libs/sparkline/sparkline.js"></script>
<!--Wave Effects -->
<script src="assets/js/waves.js"></script>
<!--Menu sidebar -->
<script src="assets/js/sidebarmenu.js"></script>
<!--Custom JavaScript -->
<script src="assets/js/custom.min.js"></script>

<script src="assets/intl-tel-input/js/intlTelInput.js"></script>


</body>

</html>
