<!DOCTYPE html>
<html>

<head>

<?php   include('include/common.php');?>  
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.13/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.13/datatables.min.js"></script>



                <script language="JavaScript">
                function checkall(source) {
                   
                checkboxes = document.getElementsByName('admincheck');
                    for(var i=0, n=checkboxes.length;i<n;i++) {
                        checkboxes[i].checked = source.checked;
                    }
                }
                </script>
</head>

<body>

    <!-- admin javascript -->
    
    


    <?php   include('include/header.php');?>
    <div class="wrapper" >
        
        <?php   include('include/sidebar.php');?>
        <!-- Page Content  -->
        <div id="content" style="background-color: #e5e5e5;">

            <!-- add button -->

            <a href="/at-cms/employeeadmin/add">新增</a>
            <!-- end add button -->

            <!-- test datatable -->
            <table id="book-table" class="table table-bordered table-striped table-hover ">
         
            <!-- <table id="book-table" class="display responsive nowrap"  width="100%"> -->
            <thead>
            <tr><td>中文姓名</td><td>英文姓</td><td>英文名</td><td>性別</td><td>薪酬種類</td><td>創建日期</td><td>更新日期</td><td>詳情</td><td>編輯</td><td>啟用</td><td>删除 <input type="checkbox" class="" id="admincheck" name="admincheck" value="" onclick="checkall(this)">
                          </td></tr>

            </thead>
            <tbody>
         
            <?php  

                    // foreach ($employee as $employeerow) {    
                    foreach ($employeedata as $employeerow) {
            ?>
                    <tr><td>
                        <?php
                            // echo 'userroleid';
                            // echo $employeerow['userroleid'];

                        ?>
                        <?php echo $employeerow['username'];?>（
                            <?php  foreach ($shop as $shoprow) {
                                    if($shoprow->id==$employeerow['tenant_no']){
                                        echo $shoprow->name;
                                    }
                            ?>
                            <?php
                                }
                            ?>
                    ）</td><td>
                        

                        <?php echo $employeerow['eng_firstname'];?></td><td><?php echo $employeerow['eng_lastname'];?></td><td><?php
                        if($employeerow['gender']==0){
                            echo "女";
                        }
                        if($employeerow['gender']==1){
                            echo "男";
                        }
                    ?>
                    </td><td>



                            <?php  


                            foreach ($employeeincometype as $employeeincometyperow) {
                                    if($employeerow['employee_income_type_id']==$employeeincometyperow->id){
                                        echo $employeeincometyperow->name;
                                    }
                            ?>
                            <?php
                                }
                            ?></td><td><?php echo date("Y-m-d H:i:s", $employeerow['create_time']);?></td><td><?php echo date("Y-m-d H:i:s", $employeerow['update_time']);?></td><td><a href="/at-cms/employeeadmin/view/<?php echo $employeerow['id'];?>">詳情</a></td><td><a href="/at-cms/employeeadmin/edit/<?php echo $employeerow['id'];?>">編輯</a></td><td><a href="/at-cms/employeeadmin/status/<?php echo $employeerow['id'];?>">啟用</a></td><td>删除
                            <input type="checkbox" class="checkbox" id="admincheck" name="admincheck" value="<?php echo  $employeerow['id']; ?>">    
                            </td></tr>



            <?php 
                   }//foreach ($employee as $row) {
            ?>


                        
            </tbody>
            </table>

            <script type="text/javascript">
$(document).ready(function() {
    $('#book-table').DataTable();
});
</script>
            <!-- end test datatable -->
        </div>
    </div>


    <script type="text/javascript">
        $(document).ready(function () {
            $('#sidebarCollapse').on('click', function () {
                $('#sidebar').toggleClass('active');
            });

            // password click
            bootstrapRevealPassword();

// Plugin to integrate in your javascript file
            function bootstrapRevealPassword() {
            $('[data-password]').closest('.form-group').addClass('position-relative').append('<span class="form-password-icon"><i class="material-icons">visibility_off</i></span>');

            $('.form-password-icon').on('click', function() {
                var clicks = $(this).data('clicks');
                if (clicks) {
                // odd clicks
                $(this).html('<span class="input-group-text "><i class="fas fa-eye-slash"></i></span>').prevAll(':input').attr('type', 'password');
                } else {
                // even clicks
                $(this).html('<span class="input-group-text "><i class="fas fa-eye"></i></span>').prevAll(':input').attr('type', 'text');
                }
                $(this).data("clicks", !clicks);
            });
            }

            // end password click

        });
    </script>
</body>

</html>