<?php
session_start();


?>
<!DOCTYPE html>
<html lang="en">
<head>
    <?php
    include "include/meta.php";
    ?>
    <title>بیمه توانا-مدیریت کاربران</title>
    <?php
    include "include/styles.php";
    ?>


    <!-- Bootstrap RTL stylesheet min version -->
    <link href="css/bootstrap-rtl.min.css" rel="stylesheet">
    <!-- /bootstrap rtl stylesheet min version -->
    <!-- Mouldifi RTL core stylesheet -->
    <link href="css/mouldifi-rtl-core.css" rel="stylesheet">
    <!-- /mouldifi rtl core stylesheet -->
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="js/html5shiv.min.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
    <!--[if lte IE 8]>
    <script src="js/plugins/flot/excanvas.min.js"></script>
    <![endif]-->
</head>
<body>

<!-- Page container -->
<div class="page-container">

    <!-- Page Sidebar -->
    <?php

    include "include/slider_menu.php";

    ?>
    <!-- /page sidebar -->
    <!-- Main container -->
    <div class="main-container gray-bg">

        <!-- Main header -->
        <?php

        include "include/header.php";

        ?>
        <!-- /main header -->
        <!-- Main content -->
        <div class="main-content">
            <h1 class="page-title"> مدیریت کاربران</h1>
            <div class="row">
                <div class="col-lg-12 animatedParent animateOnce z-index-50">
                    <div class="panel panel-default animated fadeInUp">
                        <div class="panel-heading clearfix">
                            <h3 class="panel-title">فهرست کاربران</h3>
                            <ul class="panel-tool-options">
                                <li><a data-rel="collapse" href="#"><i class="icon-down-open"></i></a></li>
                                <li><a data-rel="reload" href="#"><i class="icon-arrows-ccw"></i></a></li>
                                <li><a data-rel="close" href="#"><i class="icon-cancel"></i></a></li>
                            </ul>
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-border table-hover dataTables-example" >
                                    <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>نام کاربری</th>
                                        <th>شماره موبایل</th>
                                        <th>سطح دسترسی</th>
                                        <th>وضعیت حساب کاربری</th>
                                        <th>تصویر</th>
                                    </tr>
                                    </thead>
                                    <tbody>



                                    <?php

                                    $sql = "SELECT * FROM  tbl_users ";

                                    $rs_result = mysqli_query($db, $sql);
                                    //print_r($row = mysqli_fetch_array($rs_result));
                                    //exit();

                                    while ($row = mysqli_fetch_array($rs_result)) {

                                    ?>

                                    <tr class="gradeX">
                                        <td><?php echo $row["id"]; ?></td>
                                        <td><?php echo $row["username"]; ?></td>
                                        <td><?php echo $row["mobile"]; ?></td>
                                        <td><?php


                                            $role =  $row["role"];

                                            if($role==1){
                                                echo 'مدیر';
                                            }else {
                                                echo 'کاربر عادی';
                                            }


                                            ?></td>
                                        <td><?php

                                            $status =  $row["status"];

                                            if($status==1){
                                                echo 'فعال';
                                            }else {
                                                echo 'غیرفعال';
                                            }



                                            ?></td>
                                        <td><?php echo $row["image"]; ?></td>
                                    </tr>

                                        <?php

                                    };
                                    ?>


                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <th>ID</th>
                                        <th>نام کاربری</th>
                                        <th>شماره موبایل</th>
                                        <th>سطح دسترسی</th>
                                        <th>وضعیت حساب کاربری</th>
                                        <th>تصویر</th>
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Footer -->
            <?php

            include 'include/footer.php';

            ?>
            <!-- /footer -->

        </div>
        <!-- /main content -->

    </div>
    <!-- /main container -->

</div>
<!-- /page container -->
<!--Load JQuery-->

<!--Load JQuery-->
<script src="js/jquery.min.js"></script>
<!-- Load CSS3 Animate It Plugin JS -->
<script src="js/plugins/css3-animate-it-plugin/css3-animate-it.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins/metismenu/jquery.metisMenu.js"></script>
<script src="js/plugins/blockui-master/jquery-ui.js"></script>
<script src="js/plugins/blockui-master/jquery.blockUI.js"></script>
<script src="js/functions.js"></script>

<script src="js/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="js/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="js/plugins/datatables/extensions/Buttons/js/dataTables.buttons.min.js"></script>
<script src="js/plugins/datatables/jszip.min.js"></script>
<script src="js/plugins/datatables/pdfmake.min.js"></script>
<script src="js/plugins/datatables/vfs_fonts.js"></script>
<script src="js/plugins/datatables/extensions/Buttons/js/buttons.html5.js"></script>
<script src="js/plugins/datatables/extensions/Buttons/js/buttons.colVis.js"></script>
<script>
    $(document).ready(function () {
        $('.dataTables-example').DataTable({
            dom: '<"html5buttons" B>lTfgitp',
            buttons: [
                {
                    extend: 'copyHtml5',
                    exportOptions: {
                        columns: [ 0, ':visible' ]
                    }
                },
                {
                    extend: 'excelHtml5',
                    exportOptions: {
                        columns: ':visible'
                    }
                },
                {
                    extend: 'pdfHtml5',
                    exportOptions: {
                        columns: [ 0, 1, 2, 3, 4 ]
                    }
                },
                'colvis'
            ]
        });
    });


</body>
</html>
