
<!DOCTYPE html>
<html>
<head>
  <!-- <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> -->
  <script src="<?php echo base_url();?>assets/js/jquery-3.1.1.min.js"></script>
 <?php   include('include/common.php');?>  
  <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/jquery.dataTables.min.css">
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/jquery.dataTables.min.js"></script>
  <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/bootstrap.css">
  <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/dataTables.bootstrap4.min.css">
  <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/responsive.dataTables.min.css">
  <script type="text/javascript" src="<?php echo base_url();?>assets/js/responsive.dataTables.min.js"></script>
  <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/responsive.bootstrap.css">
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/responsive.bootstrap.min.css">
<!-- <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.bootstrap4.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.bootstrap4.min.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.foundation.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.foundation.min.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.jqueryui.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.jqueryui.min.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.semanticui.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/responsive/2.2.3/css/responsive.semanticui.min.css">
   -->


  <script type="text/javascript" src="<?php echo base_url();?>assets/js/dataTables.responsive.js"></script>
<!-- <script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/dataTables.responsive.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.bootstrap.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.bootstrap.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.bootstrap4.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.bootstrap4.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.dataTables.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.dataTables.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.foundation.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.foundation.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.jqueryui.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.jqueryui.min.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.semanticui.js"></script>
<script type="text/javascript" src="//cdn.datatables.net/responsive/2.2.3/js/responsive.semanticui.min.js"></script> -->

<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>assets/css/buttons.dataTables.min.css">
<script type="text/javascript" src="<?php echo base_url();?>assets/js/buttons.dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/buttons.colVis.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css" rel="stylesheet">

<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/js/all.min.js"></script>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymous">

  <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.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;
                    }
                }
                function checkalllevel(source){
  
                    alert("clicked");
                    alert(source.className);
                    alert(source.data('clickid'));
                }
                function checkToggle(source){
                    if(source.checked==true){
                    // alert("clicked123");
                    // alert("add");
                        action="add";
                        // check status to 1
                    }
                    else{
                      // alert("remove");  
                    // alert(source.data('clickid'));
                      action="remove";
                      // check status to 0
                    }
                    // alert( $(source).attr('data-clickid'));
                    // alert( $(source).val());
                    var personid=$(source).attr('data-clickid');
                    var postData ={
                    'action':action,
                    'personid':personid
                    // 'currentlevel':currentlevel,
                    // 'level1id':split1[1],
                    // 'level2id':split1[2],
                    // 'level3id':split1[3],
                    // 'level4id':split1[4]
                    }
                     var GlobalVariables ={
                      'csrfToken': '123',
                      'baseUrl':'<?php echo base_url();?>',
                      'destUrl':'<?php echo base_url();?>/api/v1/brservicesend/status',
                      'AJAX_SUCCESS' :'SUCCESS',
                      'AJAX_FAILURE' :'FAILURE'
                     };
                     var postUrl= GlobalVariables.baseUrl +'/api/v1/brservicesend/status';

                     $.ajax({
                      method: "POST",
                      url: postUrl,
                      dataType: "json",
                     data: postData,
                     success : function(data){

                    // alert("posted");
                    // alert('formsubmit');
                    // alert(data);
                    
                    // alert(data['recordstatus']);
                    // alert(data['msg']);
                    if(data['recordstatus']=="SUCCESS"){
                        $('#feedback').remove();
                        $( '#editmsg' ).append('<p class="text-primary" id="feedback">'+data['msg']+'</p>');
                        // setTimeout(function() {
                        //     location.reload();
                        // }, 3000);
                        // location.reload();

                    }
                      if(data['recordstatus']=="FAILURE"){
                        $('#feedback').remove();
                        $( '#editmsg' ).append('<p class="text-danger"  id="feedback">'+data['msg']+'</p>');
                    //   $( '#modal-bodymsg' ).empty();
                    //   $( '#modal-bodymsg' ).append( '<h5 class="text-center" style="color: #a03d49;">客戶不能增加。</h5> <h5 class="text-center" style="color: #a03d49;">請稍後再嘗試。</h5>' );
                    //   $('#finishModal').modal('show');
                    // }
                      // if (data.AJAX_SUCCESS==GlobalVariables.AJAX_SUCCESS){
                      //     window.location.href=GlobalVariables.destUrl;
                      // } else {
                      //     $('.alert').text("登入錯誤");
                      //    $('.alert').removeClass('hidden');
                      }
                  }
                }); 
                   //end ajax module
                }
    //             $('.togglenewclass').change(function() {
    //                  alert("clicked");
    //                         // $('#console-event').html('Toggle: ' + $(this).prop('checked'))
    //             });


    //             function notify(){
    //                 alert("1");
    //                  var $this = $(this);
    //                 $.post('YOUR/API/URL', function(response){
    //         //...
    //                 }).fail(function(response){
    //                 $this.off('change'); //先關閉Change事件。
    //                 $this.bootstrapToggle('off');
    //                 $this.on('change', notify);  //執行完後打開Change 事件，並執行handler
    //                     });
    //             }
    // ​
    // $('.togglenewclass').bootstrapToggle({
    //     on:'開啟', 
    //     off:'關閉',
    //     size:'small', 
    //     onstyle:'success'
    // }).change(notify);

                  //show delete modal
            function showdeletemodal() {
                checkboxes = document.getElementsByName('admincheck');
                var favorite = [];
                $count=0;
                $.each($("input[name='admincheck']:checked"), function(){
                    favorite.push($(this).val());
                    $count=$count+1;
                });
                // alert(1);
                // alert("My favourite sports are: " + favorite.join(", "));
                document.getElementById("deletenum").innerHTML = $count;
                $('#deleteModalCenter').modal({
                                    show: true,
                                }); 
            }//function showdeletemodal() {
            //end show delete modal       

        $( document ).ready(function() {
    
            //delete submit button
        $("#btndeleteSubmit").click(function(event) {
            // alert("1");
          var forcusitem="";
          var passCheck=true;
            //check delete have value
            // var checkboxvalue = $('.checkbox').val();   

            var checkboxvalue =  [];    
            // $("input.checkbox[type=checkbox]:checked").each(function(i){
            //     alert(i.value );
            // checkboxvalue.push( i.value );
            // }); 

            $('input.checkbox:checkbox:checked').each(function () {

                // alert($(this).val());
                checkboxvalue.push( $(this).val() );

            });
            var postData ={
                'inputdeletecheckboxvalue':checkboxvalue
            }
            var GlobalVariables ={
                  'csrfToken': '123',
                  'baseUrl':'<?php echo base_url();?>',
                  'destUrl':'<?php echo base_url();?>/api/v1/fileend/delete',
                  'AJAX_SUCCESS' :'SUCCESS',
                  'AJAX_FAILURE' :'FAILURE'
            };

            event.preventDefault();
            var postUrl= GlobalVariables.baseUrl +'/api/v1/brservicesend/delete';
            //end　check delete have value
            // $('#loading').show();
            $.ajax({
                  method: "POST",
                  url: postUrl,
                  dataType: "json",
                 data: postData,
                 success : function(data){
                  // $('#loading').hide();
                // alert("posted");
                // alert('formsubmit');
                // alert(data);
                
                // alert(data['recordstatus']);
                // alert(data['msg']);
                if(data['recordstatus']=="SUCCESS"){

                    $('#feedback').remove();
                    $( '#deletemsg' ).append('<p class="text-primary" id="feedback">'+data['msg']+'</p>');
                    setTimeout(function() {
                        location.reload();
                    }, 3000);
                    // location.reload();

                }
                  if(data['recordstatus']=="FAILURE"){
                    $('#feedback').remove();
                    $( '#deletemsg' ).append('<p class="text-danger"  id="feedback">'+data['msg']+'</p>');
                //   $( '#modal-bodymsg' ).empty();
                //   $( '#modal-bodymsg' ).append( '<h5 class="text-center" style="color: #a03d49;">客戶不能增加。</h5> <h5 class="text-center" style="color: #a03d49;">請稍後再嘗試。</h5>' );
                //   $('#finishModal').modal('show');
                // }
                  // if (data.AJAX_SUCCESS==GlobalVariables.AJAX_SUCCESS){
                  //     window.location.href=GlobalVariables.destUrl;
                  // } else {
                  //     $('.alert').text("登入錯誤");
                  //    $('.alert').removeClass('hidden');
                  }
              }
            });  

        });  //$("#btndeleteSubmit").click(function(event) {      
        //end delete submit button  
        });//$( document ).ready(function() {

                </script>
</head>
<body>
   <?php   include('include/header.php');?>
    <div class="wrapper" >
        
        <?php   include('include/sidebar.php');?>
        <!-- Page Content  -->

            <!-- delete modal -->
            <script>
                
            </script>

            <div class="modal fade" id="deleteModalCenter" tabindex="-1" role="dialog" aria-labelledby="deleteModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered  " role="document" style="max-width: 600px;">
                <div class="modal-content px-3">
                <!-- <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div> -->
                <div class="modal-body ">
                     <h5 style="color:<?php echo MAIN_TEXT_COLOR;?>" class="text-center py-2"><i class="fas fa-plus mr-2" style="color:<?php echo MAIN_TEXT_COLOR;?>"></i>删除服務</h5>
                     <form>

                   
                    <div class="form-group row">
                        <label for="inputRePassword" class="col-sm-12 "><span style="color:<?php echo MAIN_TEXT_COLOR;?>;" >確定删除</span><span id="deletenum" style="color:<?php echo MAIN_TEXT_COLOR;?>;"></span><span style="color:<?php echo MAIN_TEXT_COLOR;?>;" >個服務?</span></label>
                        
                        <span id="deletemsg" class="text-center"></span>
                    </div>
                    <!-- <div class="form-group row">
                        <div class="col-sm-12">
                        <p style="font-size: 12px;"><span style="color:#616161">*為必填項目<br>登入名稱為英文字或數字組成(不分大小寫)</span></p>
                        <span id="editmsg" class="text-center"></span>
                         </div>
                    </div> -->
                    <div class="form-group row">
                        <div class="col-sm-12 text-center">
                        <button type="button" class="btn  px-5  custombutton" id="btndeleteSubmit">確定</button>
                        </div>
                    </div>
                    <input type="hidden" class="form-control" id="inputadminid" placeholder="">
                    </form>
                </div>
                <!-- <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save changes</button>
                </div> -->
                </div>
            </div>
            </div>
            <script type="text/javascript">
             


            </script>
            <!-- end delete modal -->   



        <div id="content" style="background-color: #ffffff;">

            <?php 

               //for manager can see other shop but cannot edit
                        $extraPasscheck=false;
                        if($this->session->userdata('shopid')==$currentshop){
                          $extraPasscheck=true;
                        }
                        if($this->session->userdata('shopid')!=$currentshop && ($this->session->userdata('roleId')==6 || $this->session->userdata('roleId')==7 )){
                          $extraPasscheck=true;
                        }
                //end for manager can see other shop but cannot edit


            ?>

            <!-- title     -->

            <div class="title">服務管理</div>    
            <!-- end title -->

            <!-- add button -->
            <?php
                if($this->session->userdata('brservice_add')==true && $extraPasscheck==true){
            ?>

            <div style="" class="menubar2  p-2">
                    <a href="/at-cms/brservicesadmin/add">
                        <i class="fas fa-plus" style=" display: inline-block;
/*  border-radius: 10px;
  box-shadow: 0px 0px 2px #888;*/
  color: #957c78;
  padding: 2px 2px;"></i>

新增</a>
            </div>

            <?php
                }//if($this->session->userdata('brservice_add')==true){
            ?>
            <!-- end add button -->

            <!-- sample table -->
              
            <!-- end sample table -->

            <!-- test datatable -->
            <!-- <table id="book-table" class="table table-bordered table-striped table-hover "> -->
              <style type="text/css">

                   /*
                table#book-table.dataTable tbody tr:hover {
                    background-color: #fbeae6;
                  }
                table#book-table.dataTable tbody tr {
                    background-color: #fbeae6;
                  }
    957c78  
    b6a5a2          */
                  table#book-table.dataTable tbody tr:hover{
                    background-color: <?php echo DATATABLE_HOVER;?>;
                  }
                  table#book-table.dataTable tbody tr.odd {
                    background-color: <?php echo DATATABLE_ODD;?>;
                  }
                  table#book-table.dataTable tbody tr.odd:hover {
                    background-color: <?php echo DATATABLE_HOVER;?>;
                  }
   
/*  table#book-table.dataTable tbody tr:hover > .sorting_1 {
    background-color: <?php echo DATATABLE_ODD;?>;
  }*/
             table#book-table.dataTable tbody tr:hover > .sorting_1 {
    background-color: <?php echo DATATABLE_HOVER;?>;
  }      


  table#book-table.dataTable tbody tr.odd > .sorting_1 {
    background-color: <?php echo DATATABLE_ODD;?>;
  }      
   table#book-table.dataTable tbody tr.even > .sorting_1 {
    background-color: <?php echo DATATABLE_EVEN;?>;
  }   

  table#book-table.dataTable tbody tr.even:hover > .sorting_1 {
    background-color: <?php echo DATATABLE_HOVER;?>;
  }    

  table#book-table.dataTable tbody tr.odd:hover > .sorting_1 {
    background-color: <?php echo DATATABLE_HOVER;?>;
  }       

table.dataTable thead th {
    position: relative;
    background-image: none !important;
}

  a, a:hover, a:focus{
    text-decoration: none!important;
    color: #000000;
  }

  
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
    position: absolute !important;
    top: 12px !important;
    right: 8px !important;
    display: block !important;
    font-family: FontAwesome !important;
}
table.dataTable thead th.sorting:after {
    content: "\f0dc" !important;
    color: #ddd !important;
    font-size: 0.8em !important;
    padding-top: 0.12em !important;
}
table.dataTable thead th.sorting_asc:after {
    content: "\f0de" !important;
    color: #e97358 !important;
}
table.dataTable thead th.sorting_desc:after {
    content: "\f0dd" !important;
    color: #e97358 !important;
}    
table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>td:first-child:before, table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>th:first-child:before {
  background-color: #4dac47;

}
/*  table#book-table.dataTable.order-column.stripe tbody tr.odd>.sorting_1{
    background-color: #fbeae6;
  }      


table.dataTable td.sorting_1{ background-color: white; border:1px lightgrey; }
    table.dataTable td{ background-color: white;  border:1px lightgrey;}
    table.dataTable tr.odd { background-color: white;  border:1px lightgrey;}
    table.dataTable tr.even{ background-color: white; border:1px lightgrey; }*/

            </style>
             <style type="text/css">

  
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
    position: absolute !important;
    top: 12px !important;
    right: 8px !important;
    display: block !important;
    font-family: FontAwesome !important;
}
table.dataTable thead th.sorting:after {
    content: "\f0dc" !important;
    color: #ddd !important;
    font-size: 0.8em !important;
    padding-top: 0.12em !important;
}
table.dataTable thead th.sorting_asc:after {
    content: "\f0de" !important;
    color: #e97358 !important;
}
table.dataTable thead th.sorting_desc:after {
    content: "\f0dd" !important;
    color: #e97358 !important;
}    
table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>td:first-child:before, table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>th:first-child:before {
  background-color: #4dac47;

}
            </style>
<script type="text/javascript">
  $(document).ready(function (){
    // var table = $('#example').DataTable({
    //     'responsive': true
    // });

    // // Handle click on "Expand All" button
    // $('#btn-show-all-children').on('click', function(){
    //     // Expand row details
    //     table.rows(':not(.parent)').nodes().to$().find('td:first-child').trigger('click');
    // });

    // // Handle click on "Collapse All" button
    // $('#btn-hide-all-children').on('click', function(){
    //     // Collapse row details
    //     table.rows('.parent').nodes().to$().find('td:first-child').trigger('click');
    // });

    // var table = $('#example').DataTable();
  var table = $('#book-table').DataTable(
  {
        responsive:true,
  
        "order": [[ 0, "asc" ]],
          dom: 'Bfrtip',
          buttons: [
              // 'colvis'
          ]
      });
// table.rows().every( function () {
//     this.child( 'Row details for row: '+this.index() );
// } );
 
// $('#example tbody').on( 'click', 'tr', function () {
//     var child = table.row( this ).child;
 
//     if ( child.isShown() ) {
//         child.hide();
//     }
//     else {
//         child.show();
//     }
// } );
});
</script>
<style type="text/css">
  /*td.details-control {
    background: url('../resources/details_open.png') no-repeat center center;
    cursor: pointer;
}
tr.shown td.details-control {
    background: url('../resources/details_close.png') no-repeat center center;
}*/

/*table.dataTable thead .sorting:after, 
table.dataTable thead .sorting_asc:after, 
table.dataTable thead .sorting_desc:after {
  color : yellow;
  opacity: 0.6 !important;
}
*/
/*
 table#example.dataTable tbody tr:hover{
                    background-color: #ff9d85;
                  }
                  table#example.dataTable tbody tr.odd {
                    background-color: #fbeae6;
                  }
                  table#example.dataTable tbody tr.odd:hover {
                    background-color: #ff9d85;
                  }
   

             table#example.dataTable tbody tr:hover > .sorting_1 {
    background-color: #ff9d85;
  }      


  table#example.dataTable tbody tr.odd > .sorting_1 {
    background-color: #fbeae6;
  }      
   table#example.dataTable tbody tr.even > .sorting_1 {
    background-color: #ffffff;
  }   

  table#example.dataTable tbody tr.even:hover > .sorting_1 {
    background-color: #ff9d85;
  }    

  table#example.dataTable tbody tr.odd:hover > .sorting_1 {
    background-color: #ff9d85;
  }  

  table#example.dataTable thead .sorting::after,
table#example.dataTable thead .sorting_asc::after {
    content: "\e252";
    color:#fbeae6;
}

table#example.dataTable thead .sorting_desc::after {
    content: "\e253";
     color:#fbeae6;
} */

/*table.dataTable thead th {
    position: relative;
    background-image: none !important;
}
  
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after {
    position: absolute !important;
    top: 12px !important;
    right: 8px !important;
    display: block !important;
    font-family: FontAwesome !important;
}
table.dataTable thead th.sorting:after {
    content: "\f0dc" !important;
    color: #ddd !important;
    font-size: 0.8em !important;
    padding-top: 0.12em !important;
}
table.dataTable thead th.sorting_asc:after {
    content: "\f0de" !important;
    color: #e97358 !important;
}
table.dataTable thead th.sorting_desc:after {
    content: "\f0dd" !important;
    color: #e97358 !important;
}    
table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>td:first-child:before, table.dataTable.dtr-inline.collapsed>tbody>tr[role="row"]>th:first-child:before {
  background-color: #4dac47;

}*/
</style>
<!-- <h3><a target="_blank" href="https://www.gyrocode.com/articles/jquery-datatables-how-to-expand-collapse-all-child-rows/">jQuery DataTables: How to expand/collapse all child rows</a> <small>Responsive extension</small></h3>

<button id="btn-show-all-children" type="button">Expand All</button>
<button id="btn-hide-all-children" type="button">Collapse All</button>
<hr> -->
<!-- <table id="example"   class="ui celled table display success"  cellspacing="0" width="100%"> -->
<table id="book-table"   class="table table-striped table-bordered"  cellspacing="0" width="100%">
    <thead>
        <tr>
            <th class="success" style="border-bottom: 1px solid #dbd0ce;width: 20px;"><span class="tabletextcolor">服務編號</span></th>
            <th   style="border-bottom: 1px solid #dbd0ce;width: 20px;" ><span class="tabletextcolor">服務項目</span></th>
            <th style="border-bottom: 1px solid #dbd0ce;width: 20px;"><span class="tabletextcolor">價錢</span></th>
            <th style="border-bottom: 1px solid #dbd0ce;width: 20px;"><span class="tabletextcolor">時間</span></th>
             <th style="border-bottom: 1px solid #dbd0ce;width: 20px;"><span class="tabletextcolor">積分</span></th>
            <th  style="border-bottom: 1px solid #dbd0ce;width: 20px;" ><span class="tabletextcolor">創建日期</span></th>
            <th  style="border-bottom: 1px solid #dbd0ce;width: 20px;" ><span class="tabletextcolor">更新日期</span></th>
            <th   style="border-bottom: 1px solid #dbd0ce;width: 20px;" ><span class="tabletextcolor">編輯</span></th>
            <th   style="border-bottom: 1px solid #dbd0ce;width: 20px;" ><span class="tabletextcolor">啟用</span></th>
            
            <th  style="border-bottom: 1px solid #dbd0ce;width: 20px;"><span class="tabletextcolor">删除</span><input type="checkbox" class="" id="admincheck" name="admincheck" value="" onclick="checkall(this)"></th>
        </tr>
    </thead>
<!--     <tfoot>
        <tr>
            <th>Name</th>
            <th>Position</th>
            <th>Office</th>
            <th>Age</th>
            <th>Start date</th>
            <th>Salary</th>
        </tr>
    </tfoot> -->
    <tbody>
       <?php  foreach ($services as $servicesrow) {
            ?>
                    <tr><td><?php echo $servicesrow->code;?></td><td><?php echo $servicesrow->name;?></td><td>$<?php echo $servicesrow->price;?></td><td><?php 
                        if($servicesrow->time_type=="minutes"){
                            echo (int)round($servicesrow->time);
                        }   
                        if($servicesrow->time_type=="hours"){
                            echo $servicesrow->time;
                        }  
                        ?><?php
                        if($servicesrow->time_type=="minutes"){
                            echo "分鐘";
                        }
                      ?>
                      <?php
                        if($servicesrow->time_type=="hours"){
                            echo "小時";
                        }
                      ?>
                    </td>
                    <td><?php echo $servicesrow->point;?></td>
                    <td><?php echo date("Y-m-d H:i:s", $servicesrow->create_time);?></td><td><?php echo date("Y-m-d H:i:s", $servicesrow->update_time);?></td><td>
                      <?php
                if($this->session->userdata('brservice_edit')==true && $extraPasscheck==true){
            ?>
                      <a href="/at-cms/brservicesadmin/edit/<?php echo $servicesrow->id;?>">編輯</a>
                       <?php
                }//if($this->session->userdata('brservice_edit')==true){
            ?>
                      </td><td><input type="checkbox" <?php
                        if($servicesrow->status=="1"){
                            echo "checked";
                        }
                      ?> data-toggle="toggle" id="checkstatus<?php echo $servicesrow->id;?>"  name="checkstatus<?php echo $servicesrow->id;?>" class="togglenewclass" data-onstyle="success" data-offstyle="danger" 
                      data-clickid="<?php echo $servicesrow->id;?>"  
                 
                       <?php
                        if($this->session->userdata('brservice_edit')==false){

                          echo 'disabled="disabled"';
                        }
                      ?>

                      <?php
                if($this->session->userdata('brservice_edit')==true){

                      ?>
                      onchange="checkToggle(this)"
                      <?php
                }//if($this->session->userdata('brservice_edit')==true){

                      ?>
                      ></td><td>
                        <?php
                if($this->session->userdata('brservice_delete')==true){

                      ?>
                            <input type="checkbox" class="checkbox" id="admincheck" name="admincheck" value="<?php echo  $servicesrow->id; ?>">  
                            <?php
                }//if($this->session->userdata('brservice_delete')==true){

                      ?>  
                            </td></tr>



            <?php 
                   }//foreach ($employee as $row) {
            ?>
        <!-- <tr>
            <td>Tiger Nixon</td>
            <td>System Architect</td>
            <td>Edinburgh</td>
            <td>61</td>
            <td>2011/04/25</td>
            <td>$320,800</td>
        </tr>
        <tr>
            <td>Garrett Winters</td>
            <td>Accountant</td>
            <td>Tokyo</td>
            <td>63</td>
            <td>2011/07/25</td>
            <td>$170,750</td>
        </tr>
        <tr>
            <td>Ashton Cox</td>
            <td>Junior Technical Author</td>
            <td>San Francisco</td>
            <td>66</td>
            <td>2009/01/12</td>
            <td>$86,000</td>
        </tr>
        <tr>
            <td>Bradley Greer</td>
            <td>Software Engineer</td>
            <td>London</td>
            <td>41</td>
            <td>2012/10/13</td>
            <td>$132,000</td>
        </tr>
        <tr>
            <td>Dai Rios</td>
            <td>Personnel Lead</td>
            <td>Edinburgh</td>
            <td>35</td>
            <td>2012/09/26</td>
            <td>$217,500</td>
        </tr>
        <tr>
            <td>Jenette Caldwell</td>
            <td>Development Lead</td>
            <td>New York</td>
            <td>30</td>
            <td>2011/09/03</td>
            <td>$345,000</td>
        </tr>
        <tr>
            <td>Yuri Berry</td>
            <td>Chief Marketing Officer (CMO)</td>
            <td>New York</td>
            <td>40</td>
            <td>2009/06/25</td>
            <td>$675,000</td>
        </tr>
        <tr>
            <td>Caesar Vance</td>
            <td>Pre-Sales Support</td>
            <td>New York</td>
            <td>21</td>
            <td>2011/12/12</td>
            <td>$106,450</td>
        </tr>
        <tr>
            <td>Doris Wilder</td>
            <td>Sales Assistant</td>
            <td>Sidney</td>
            <td>23</td>
            <td>2010/09/20</td>
            <td>$85,600</td>
        </tr>
        <tr>
            <td>Angelica Ramos</td>
            <td>Chief Executive Officer (CEO)</td>
            <td>London</td>
            <td>47</td>
            <td>2009/10/09</td>
            <td>$1,200,000</td>
        </tr>
        <tr>
            <td>Gavin Joyce</td>
            <td>Developer</td>
            <td>Edinburgh</td>
            <td>42</td>
            <td>2010/12/22</td>
            <td>$92,575</td>
        </tr>
        <tr>
            <td>Jennifer Chang</td>
            <td>Regional Director</td>
            <td>Singapore</td>
            <td>28</td>
            <td>2010/11/14</td>
            <td>$357,650</td>
        </tr>
        <tr>
            <td>Brenden Wagner</td>
            <td>Software Engineer</td>
            <td>San Francisco</td>
            <td>28</td>
            <td>2011/06/07</td>
            <td>$206,850</td>
        </tr>
        <tr>
            <td>Fiona Green</td>
            <td>Chief Operating Officer (COO)</td>
            <td>San Francisco</td>
            <td>48</td>
            <td>2010/03/11</td>
            <td>$850,000</td>
        </tr>
        <tr>
            <td>Shou Itou</td>
            <td>Regional Marketing</td>
            <td>Tokyo</td>
            <td>20</td>
            <td>2011/08/14</td>
            <td>$163,000</td>
        </tr>
        <tr>
            <td>Michelle House</td>
            <td>Integration Specialist</td>
            <td>Sidney</td>
            <td>37</td>
            <td>2011/06/02</td>
            <td>$95,400</td>
        </tr>
        <tr>
            <td>Suki Burks</td>
            <td>Developer</td>
            <td>London</td>
            <td>53</td>
            <td>2009/10/22</td>
            <td>$114,500</td>
        </tr>
        <tr>
            <td>Prescott Bartlett</td>
            <td>Technical Author</td>
            <td>London</td>
            <td>27</td>
            <td>2011/05/07</td>
            <td>$145,000</td>
        </tr>
        <tr>
            <td>Gavin Cortez</td>
            <td>Team Leader</td>
            <td>San Francisco</td>
            <td>22</td>
            <td>2008/10/26</td>
            <td>$235,500</td>
        </tr>
        <tr>
            <td>Martena Mccray</td>
            <td>Post-Sales support</td>
            <td>Edinburgh</td>
            <td>46</td>
            <td>2011/03/09</td>
            <td>$324,050</td>
        </tr>
        <tr>
            <td>Unity Butler</td>
            <td>Marketing Designer</td>
            <td>San Francisco</td>
            <td>47</td>
            <td>2009/12/09</td>
            <td>$85,675</td>
        </tr>
        <tr>
            <td>Howard Hatfield</td>
            <td>Office Manager</td>
            <td>San Francisco</td>
            <td>51</td>
            <td>2008/12/16</td>
            <td>$164,500</td>
        </tr>
        <tr>
            <td>Hope Fuentes</td>
            <td>Secretary</td>
            <td>San Francisco</td>
            <td>41</td>
            <td>2010/02/12</td>
            <td>$109,850</td>
        </tr>
        <tr>
            <td>Vivian Harrell</td>
            <td>Financial Controller</td>
            <td>San Francisco</td>
            <td>62</td>
            <td>2009/02/14</td>
            <td>$452,500</td>
        </tr>
        <tr>
            <td>Timothy Mooney</td>
            <td>Office Manager</td>
            <td>London</td>
            <td>37</td>
            <td>2008/12/11</td>
            <td>$136,200</td>
        </tr>
        <tr>
            <td>Jackson Bradshaw</td>
            <td>Director</td>
            <td>New York</td>
            <td>65</td>
            <td>2008/09/26</td>
            <td>$645,750</td>
        </tr>
        <tr>
            <td>Olivia Liang</td>
            <td>Support Engineer</td>
            <td>Singapore</td>
            <td>64</td>
            <td>2011/02/03</td>
            <td>$234,500</td>
        </tr>
        <tr>
            <td>Bruno Nash</td>
            <td>Software Engineer</td>
            <td>London</td>
            <td>38</td>
            <td>2011/05/03</td>
            <td>$163,500</td>
        </tr>
        <tr>
            <td>Sakura Yamamoto</td>
            <td>Support Engineer</td>
            <td>Tokyo</td>
            <td>37</td>
            <td>2009/08/19</td>
            <td>$139,575</td>
        </tr>
        <tr>
            <td>Thor Walton</td>
            <td>Developer</td>
            <td>New York</td>
            <td>61</td>
            <td>2013/08/11</td>
            <td>$98,540</td>
        </tr>
        <tr>
            <td>Finn Camacho</td>
            <td>Support Engineer</td>
            <td>San Francisco</td>
            <td>47</td>
            <td>2009/07/07</td>
            <td>$87,500</td>
        </tr>
        <tr>
            <td>Serge Baldwin</td>
            <td>Data Coordinator</td>
            <td>Singapore</td>
            <td>64</td>
            <td>2012/04/09</td>
            <td>$138,575</td>
        </tr>
        <tr>
            <td>Zenaida Frank</td>
            <td>Software Engineer</td>
            <td>New York</td>
            <td>63</td>
            <td>2010/01/04</td>
            <td>$125,250</td>
        </tr>
        <tr>
            <td>Zorita Serrano</td>
            <td>Software Engineer</td>
            <td>San Francisco</td>
            <td>56</td>
            <td>2012/06/01</td>
            <td>$115,000</td>
        </tr>
        <tr>
            <td>Jennifer Acosta</td>
            <td>Junior Javascript Developer</td>
            <td>Edinburgh</td>
            <td>43</td>
            <td>2013/02/01</td>
            <td>$75,650</td>
        </tr>
        <tr>
            <td>Cara Stevens</td>
            <td>Sales Assistant</td>
            <td>New York</td>
            <td>46</td>
            <td>2011/12/06</td>
            <td>$145,600</td>
        </tr>
        <tr>
            <td>Hermione Butler</td>
            <td>Regional Director</td>
            <td>London</td>
            <td>47</td>
            <td>2011/03/21</td>
            <td>$356,250</td>
        </tr>
        <tr>
            <td>Lael Greer</td>
            <td>Systems Administrator</td>
            <td>London</td>
            <td>21</td>
            <td>2009/02/27</td>
            <td>$103,500</td>
        </tr>
        <tr>
            <td>Jonas Alexander</td>
            <td>Developer</td>
            <td>San Francisco</td>
            <td>30</td>
            <td>2010/07/14</td>
            <td>$86,500</td>
        </tr>
        <tr>
            <td>Shad Decker</td>
            <td>Regional Director</td>
            <td>Edinburgh</td>
            <td>51</td>
            <td>2008/11/13</td>
            <td>$183,000</td>
        </tr>
        <tr>
            <td>Michael Bruce</td>
            <td>Javascript Developer</td>
            <td>Singapore</td>
            <td>29</td>
            <td>2011/06/27</td>
            <td>$183,000</td>
        </tr>
        <tr>
            <td>Donna Snider</td>
            <td>Customer Support</td>
            <td>New York</td>
            <td>27</td>
            <td>2011/01/25</td>
            <td>$112,000</td>
        </tr> -->
    </tbody>
</table>
  <?php
                if($this->session->userdata('brservice_delete')==true){

                      ?>
             <style type="text/css">
               .button1 {
      background-color: #ff9d85; 
      color: black; 
      /*border: 2px solid #fbeae6;*/
    }

  .button1:hover {
    background-color: #e67358;
    color: black;
  }

             </style>
             <button type="button" class="btn  custombutton" id="deletebutton" onclick="showdeletemodal()" data-toggle="" data-target="">
            <!-- <i class="fas fa-trash-alt mr-2" style="color:#7d4495"></i>  -->  
            遞交</button>   <?php
                }//if($this->session->userdata('brservice_delete')==true){

                      ?>

            <!-- end delete button -->

        </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>