<!DOCTYPE html>
<html>

<head>

<?php   include('include/common.php');?>  
</head>

<body style="overflow-x: auto;max-width: 100vw;">

    <!-- admin javascript -->
    
    <script type="text/javascript">
      $( document ).ready(function() {

          //add control
        $("#btnSubmit").click(function(event) {
          var forcusitem="";
          var passCheck=true;

          if($('#inputadminname').val().length !== 0){
            $("#inputadminname").addClass(" is-valid ");
            $("#inputadminname").removeClass(" is-invalid ");
          }
          else{
            if(forcusitem.length===0){
               forcusitem="#inputadminname";
            }
            passCheck=false;
            $("#inputadminname").addClass(" is-invalid ");
           $("#inputadminname").removeClass(" is-valid ");
          }

          if($('#inputloginname').val().length !== 0){
            $("#inputloginname").addClass(" is-valid ");
            $("#inputloginname").removeClass(" is-invalid ");
          }
          else{
            if(forcusitem.length===0){
               forcusitem="#inputloginname";
            }
            passCheck=false;
            $("#inputloginname").addClass(" is-invalid ");
           $("#inputloginname").removeClass(" is-valid ");
          }

          if($('#inputPassword').val().length !== 0){
            $("#inputPassword").addClass(" is-valid ");
            $("#inputPassword").removeClass(" is-invalid ");
          }
          else{
            if(forcusitem.length===0){
               forcusitem="#inputPassword";
            }
            passCheck=false;
            $("#inputPassword").addClass(" is-invalid ");
           $("#inputPassword").removeClass(" is-valid ");
          }

          if($('#inputRePassword').val().length !== 0 || ($('#inputRePassword').val()!==$('#inputPassword').val())){
            $("#inputRePassword").addClass(" is-valid ");
            $("#inputRePassword").removeClass(" is-invalid ");
          }
          else{
            if(forcusitem.length===0){
               forcusitem="#inputRePassword";
            }
            passCheck=false;
            $("#inputRePassword").addClass(" is-invalid ");
           $("#inputRePassword").removeClass(" is-valid ");
          }

       


        //   alert("1");
          if(passCheck==true){

          
          var GlobalVariables ={
                  'csrfToken': '123',
                  'baseUrl':'http://notesvision.at-webs.hk',
                  'destUrl':'http://notesvision.at-webs.hk/api/v1/admins/post',
                  'AJAX_SUCCESS' :'SUCCESS',
                  'AJAX_FAILURE' :'FAILURE'
            };

            event.preventDefault();
            var postUrl= GlobalVariables.baseUrl +'/api/v1/admins/post';
            // var postData ={
            //       'csrfToken' :'',
            //       'custname' : $('#name').val(),
            //       'tel' : $('#tel').val(),
            //       'email' : $('#email').val(),
            //       'wechat' : $('#wechat').val(),
            //       'birthday' : $('#birthday').val(),
            //       // 'selectedBox' :$('.css-checkbox:checked').val()
            //       'selectedBox' :selectBox1

            // }
            var postData ={
                'inputadminname':$('#inputadminname').val(),
                'inputloginname':$('#inputloginname').val(),
                'inputPassword':$('#inputPassword').val()
            }
            $.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();
                    $( '#newmsg' ).append('<p class="text-primary" id="feedback">'+data['msg']+'</p>');
                    setTimeout(function() {
                        location.reload();
                    }, 3000);
                    // location.reload();

                }
                  if(data['recordstatus']=="FAILURE"){
                    $('#feedback').remove();
                    $( '#newmsg' ).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');
                  }
              }
            });  

            }//if(passCheck==true){
        });//$("#btnSubmit").click(function(event) {

        
        //edit submit button
        
        $("#btneditSubmit").click(function(event) {
          var forcusitem="";
          var passCheck=true;

          if($('#inputadminnameedit').val().length !== 0){
            $("#inputadminnameedit").addClass(" is-valid ");
            $("#inputadminnameedit").removeClass(" is-invalid ");
          }
          else{
            if(forcusitem.length===0){
               forcusitem="#inputadminnameedit";
            }
            passCheck=false;
            $("#inputadminnameedit").addClass(" is-invalid ");
           $("#inputadminnameedit").removeClass(" is-valid ");
          }

          if($('#inputloginnameedit').val().length !== 0){
            $("#inputloginnameedit").addClass(" is-valid ");
            $("#inputloginnameedit").removeClass(" is-invalid ");
          }
          else{
            if(forcusitem.length===0){
               forcusitem="#inputloginnameedit";
            }
            passCheck=false;
            $("#inputloginnameedit").addClass(" is-invalid ");
           $("#inputloginnameedit").removeClass(" is-valid ");
          }

        //   if($('#inputPassword').val().length !== 0){
        //     $("#inputPassword").addClass(" is-valid ");
        //     $("#inputPassword").removeClass(" is-invalid ");
        //   }
        //   else{
        //     if(forcusitem.length===0){
        //        forcusitem="#inputPassword";
        //     }
        //     passCheck=false;
        //     $("#inputPassword").addClass(" is-invalid ");
        //    $("#inputPassword").removeClass(" is-valid ");
        //   }

          if($('#inputPasswordedit').val().length !== 0){
                if($('#inputRePasswordedit').val().length !== 0 && ($('#inputRePasswordedit').val()===$('#inputPasswordedit').val())){
                $("#inputRePasswordedit").addClass(" is-valid ");
                $("#inputRePasswordedit").removeClass(" is-invalid ");
            }
            else{
                if(forcusitem.length===0){
                forcusitem="#inputRePasswordedit";
                }
                passCheck=false;
                $("#inputRePasswordedit").addClass(" is-invalid ");
            $("#inputRePasswordedit").removeClass(" is-valid ");
            }
          }//if($('#inputPasswordedit').val().length !== 0){

          

       


        //   alert("1");
          if(passCheck==true){

          
          var GlobalVariables ={
                  'csrfToken': '123',
                  'baseUrl':'http://notesvision.at-webs.hk',
                  'destUrl':'http://notesvision.at-webs.hk/api/v1/admins/edit',
                  'AJAX_SUCCESS' :'SUCCESS',
                  'AJAX_FAILURE' :'FAILURE'
            };

            event.preventDefault();
            var postUrl= GlobalVariables.baseUrl +'/api/v1/admins/edit';
            // var postData ={
            //       'csrfToken' :'',
            //       'custname' : $('#name').val(),
            //       'tel' : $('#tel').val(),
            //       'email' : $('#email').val(),
            //       'wechat' : $('#wechat').val(),
            //       'birthday' : $('#birthday').val(),
            //       // 'selectedBox' :$('.css-checkbox:checked').val()
            //       'selectedBox' :selectBox1

            // }
            var postData ={
                'inputadminnameedit':$('#inputadminnameedit').val(),
                'inputloginnameedit':$('#inputloginnameedit').val(),
                'inputPasswordedit':$('#inputPasswordedit').val(),
                'inputadminid':$('#inputadminid').val()
            }
            $.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');
                  }
              }
            });  

            }//if(passCheck==true){
        });  //$("#btneditSubmit").click(function(event) {  
        //end edit submit button


        //delete submit button
        $("#btndeleteSubmit").click(function(event) {
          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':'http://notesvision.at-webs.hk',
                  'destUrl':'http://notesvision.at-webs.hk/api/v1/admins/delete',
                  'AJAX_SUCCESS' :'SUCCESS',
                  'AJAX_FAILURE' :'FAILURE'
            };

            event.preventDefault();
            var postUrl= GlobalVariables.baseUrl +'/api/v1/admins/delete';
            //end　check delete have value
            $.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();
                    $( '#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    


        //Pop up edit box
        // $( "#deletebutton" ).click(function() {
        //     $('#editModalCenter').modal({
        //         show: true,
        //     }); 

        // });
        // $('#myform').on('submit', function(ev) {
        //     $('#my-modal').modal({
        //         show: 'false'
        //     }); 


        //     var data = $(this).serializeObject();
        //     json_data = JSON.stringify(data);
        //     $("#results").text(json_data); 
        //     $(".modal-body").text(json_data); 

            // $("#results").text(data);

            // ev.preventDefault();
        // });
        //end pop up edit box

        //get edit modal data
    $('#editModalCenter').on('show.bs.modal', function (e) {        
		var user_id = $(e.relatedTarget).data('user_id'); 
        var GlobalVariables ={
                  'csrfToken': '123',
                  'baseUrl':'http://notesvision.at-webs.hk',
                  'destUrl':'http://notesvision.at-webs.hk/api/v1/admins/getadmindata',
                  'AJAX_SUCCESS' :'SUCCESS',
                  'AJAX_FAILURE' :'FAILURE'
            };
       

		$.ajax(
		{            
			type : 'POST',            
			url  : GlobalVariables.destUrl, //Here you will fetch records     
            dataType: "json", 
			data    : 'user_id='+ user_id, //Pass $user_id            
			success : function(result) 
					{ 

                        
                        $("#inputadminnameedit").val(result[0].fullName);
                        $("#inputloginnameedit").val(result[0].login);


                        // $("#inputadminnameedit").val('123');
// 						alert('success'+result); 
//                         alert(result[0]);
//                         var obj = jQuery.parseJSON( '{ "name": "John" }' );
// alert( obj.name );
//                         var json = $.parseJSON(result);
//                         //now json variable contains data in json format
//                         //let's display a few items
//                         for (var i=0;i<json.length;++i)
//                         {
//                             alert(json[0]);
//                         }
						// $('.fetched_user').html(result); //Show fetched data from database
					},
			error   : function(result) 
					{ 
						alert('error'+result); 
					}
		});     
	
    
    });

        //end get edit modal data    

       


      });//$( document ).ready(function() {



         //show edit modal
         function showeditmodal($id) {

            
            var GlobalVariables ={
                    'csrfToken': '123',
                    'baseUrl':'http://notesvision.at-webs.hk',
                    'destUrl':'http://notesvision.at-webs.hk/api/v1/admins/getadmindata',
                    'AJAX_SUCCESS' :'SUCCESS',
                    'AJAX_FAILURE' :'FAILURE'
                };
                     
            $.ajax(
            {            
                type : 'POST',            
                url  : GlobalVariables.destUrl, //Here you will fetch records     
                dataType: "json", 
                data    : 'user_id='+ $id, //Pass $user_id            
                success : function(result) 
                        { 

                            
                            $("#inputadminnameedit").val(result[0].fullName);
                            $("#inputloginnameedit").val(result[0].login);
                            $("#inputadminid").val($id);
                            
                            $('#editModalCenter').modal({
                                show: true,
                            }); 

                            // $("#inputadminnameedit").val('123');
    // 						alert('success'+result); 
    //                         alert(result[0]);
    //                         var obj = jQuery.parseJSON( '{ "name": "John" }' );
    // alert( obj.name );
    //                         var json = $.parseJSON(result);
    //                         //now json variable contains data in json format
    //                         //let's display a few items
    //                         for (var i=0;i<json.length;++i)
    //                         {
    //                             alert(json[0]);
    //                         }
                            // $('.fetched_user').html(result); //Show fetched data from database
                        },
                error   : function(result) 
                        { 
                            alert('error'+result); 
                        }
            });     
           
        }
       
        //end show edit modal

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

        //end control

        
    </script>  
    <!-- end admin javascript -->


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

            <!-- pop up add modal  -->
            <!-- Button trigger modal -->
            <!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
            Launch demo modal
            </button> -->

            <!-- Modal -->
           <script>
              function myFunction() {
                var x = document.getElementById("myInput");
                if (x.type === "password") {
                    x.type = "text";
                } else {
                    x.type = "password";
                }
                }
            </script>

            <div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" 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:#7d4495" class="text-center py-2"><i class="fas fa-plus mr-2" style="color:#7d4495"></i>新增用戶</h5>
                     <form>

                    <div class="form-group row">
                        <label for="inputadminname" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >管理員名稱</span></label>
                        <div class="col-sm-9">
                        <input type="text" class="form-control" id="inputadminname" placeholder="請填寫管理員名稱">
                        
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料</div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputloginname" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >登入名稱</span></label>
                        <div class="col-sm-9">
                        <input type="text" class="form-control" id="inputloginname" placeholder="請填寫登入名稱">
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料</div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputPassword" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >登入密碼</span></label>
                        <div class="col-sm-9">
                        <!-- <input type="password" class="form-control" id="inputPassword" placeholder="請填寫登入密碼">
                        <div class="input-group">
                        <input type="password" class="form-control pwd" value="iamapassword">
                        <span class="input-group-btn">
                            <button class="btn btn-default reveal" type="button"><i class="glyphicon glyphicon-eye-open"></i></button>
                        </span>          
                        </div>   -->
                         <!-- password field -->
                         <div class="input-group ">
                            <input type="password" class="form-control" id="inputPassword" placeholder="請填寫登入密碼">
                            <div class="input-group-append form-password-icon">
                            <span class="input-group-text "><i class="fas fa-eye-slash"></i></span>
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料</div>
                            </div>
                        </div>
                         <!-- end password field -->
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputRePassword" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >重新輸入密碼</span></label>
                        <div class="col-sm-9">
                        <!-- <input type="password" class="form-control" id="inputRePassword" placeholder="請重新輸入密碼"> -->
                        <!-- password field -->
                        <div class="input-group ">
                            <input type="password" class="form-control" id="inputRePassword" placeholder="請重新輸入密碼">
                            <div class="input-group-append form-password-icon">
                            <span class="input-group-text "><i class="fas fa-eye-slash"></i></span>
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料或密碼和登入密碼不同</div>
                            </div>
                        </div>
                         <!-- end password field -->
                        </div>
                    </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="newmsg" 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="btnSubmit">確定</button>
                        </div>
                    </div>
                   
                    </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>

            <!-- end pop up add modal -->

            <!-- edit modal -->
            <script>
                
            </script>

            <div class="modal fade" id="editModalCenter" tabindex="-1" role="dialog" aria-labelledby="editModalCenterTitle" 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:#7d4495" class="text-center py-2"><i class="fas fa-plus mr-2" style="color:#7d4495"></i>更改用戶</h5>
                     <form>

                    <div class="form-group row">
                        <label for="inputadminname" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >管理員名稱</span></label>
                        <div class="col-sm-9">
                        <input type="text" class="form-control" id="inputadminnameedit" placeholder="請填寫管理員名稱">
                        
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料</div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputloginname" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >登入名稱</span></label>
                        <div class="col-sm-9">
                        <input type="text" class="form-control" id="inputloginnameedit" placeholder="請填寫登入名稱">
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料</div>
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputPassword" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >登入密碼</span></label>
                        <div class="col-sm-9">
                        <!-- <input type="password" class="form-control" id="inputPassword" placeholder="請填寫登入密碼">
                        <div class="input-group">
                        <input type="password" class="form-control pwd" value="iamapassword">
                        <span class="input-group-btn">
                            <button class="btn btn-default reveal" type="button"><i class="glyphicon glyphicon-eye-open"></i></button>
                        </span>          
                        </div>   -->
                         <!-- password field -->
                         <div class="input-group ">
                            <input type="password" class="form-control" id="inputPasswordedit" placeholder="請填寫登入密碼">
                            <div class="input-group-append form-password-icon">
                            <span class="input-group-text "><i class="fas fa-eye-slash"></i></span>
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料</div>
                            </div>
                        </div>
                         <!-- end password field -->
                        </div>
                    </div>
                    <div class="form-group row">
                        <label for="inputRePassword" class="col-sm-3 col-form-label"><span style="color:#7d4495;" >重新輸入密碼</span></label>
                        <div class="col-sm-9">
                        <!-- <input type="password" class="form-control" id="inputRePassword" placeholder="請重新輸入密碼"> -->
                        <!-- password field -->
                        <div class="input-group ">
                            <input type="password" class="form-control" id="inputRePasswordedit" placeholder="請重新輸入密碼">
                            <div class="input-group-append form-password-icon">
                            <span class="input-group-text "><i class="fas fa-eye-slash"></i></span>
                            <div class="valid-feedback">正確</div>
                            <div class="invalid-feedback">没有资料或密碼和登入密碼不同</div>
                            </div>
                        </div>
                         <!-- end password field -->
                        </div>
                    </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="btneditSubmit">確定</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>
            <!-- end edit modal -->

            <!-- 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:#7d4495" class="text-center py-2"><i class="fas fa-plus mr-2" style="color:#7d4495"></i>删除用戶</h5>
                     <form>

                   
                    <div class="form-group row">
                        <label for="inputRePassword" class="col-sm-12 "><span style="color:#7d4495;" >確定删除</span><span id="deletenum" style="color:#7d4495;"></span><span style="color:#7d4495;" >個用戶?</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>
            <!-- end delete modal -->    
            <style>
            .customsearch:hover{
                background-color: #e2e6ea;      
            }
            </style>
           
            <!-- end top menu bar -->
            <br>
              <?php 
                  // echo "user data";
                  // echo "<br>";
                  // echo "username:";
                  // echo $this->session->userdata('username');
                  // echo "<br>";
                  // echo "userid:";
                  //  echo $this->session->userdata('userid');
                  //   echo "<br>";
                  // echo "fullName:";
                  //  echo $this->session->userdata('fullName');
                  //   echo "<br>";
                  // echo "logged_in:";
                  //  echo $this->session->userdata('logged_in');
                  //    echo "<br>";
                  // echo "shopid:";
                  // echo $this->session->userdata('shopid');
                  //   echo "<br>";
                  // echo "roleId:";
                  // echo $this->session->userdata('roleId');
                  // echo "<br>";
                  // echo "rolename:";
                  // echo $this->session->userdata('rolename');
                  // echo "<br>";
                  // echo "usertype:";
                  // echo $this->session->userdata('usertype');
                  // echo "<br>";
                  // echo "dashboard_access:";
                  // echo $this->session->userdata('dashboard_access');
                  // echo "<br>";
                  // echo "secret:";
                  // echo $this->session->userdata('secret');
                  // echo "<br>";
                  // echo "chi_name:";
                  // echo $this->session->userdata('chi_name');
               ?>


            <!-- <nav class="navbar navbar-expand-lg navbar-light bg-light">
                <div class="container-fluid">

                    <button type="button" id="sidebarCollapse" class="btn btn-info">
                        <i class="fas fa-align-left"></i>
                        <span>Toggle Sidebar</span>
                    </button>
                    <button class="btn btn-dark d-inline-block d-lg-none ml-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                        <i class="fas fa-align-justify"></i>
                    </button>

                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                        <ul class="nav navbar-nav ml-auto">
                            <li class="nav-item active">
                                <a class="nav-link" href="#">Page<?php echo $title;?></a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#">Page</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#">Page</a>
                            </li>
                            <li class="nav-item">
                                <a class="nav-link" href="#">Page</a>
                            </li>
                        </ul>
                    </div>
                </div>
            </nav> -->

            <!-- body content -->
            <style>
                .levleonetext{
                    text-align: center;
                }
                .tablerowoddbg{
                    background-color: #f1ebf5;
                }
                .levleonetext span{
                    color:#616161;
                }
            </style>
            <div class="container-fluid py-2" style="background-color: #ffffff;min-height:80vh">
            <!-- <h2 style="color:#7d4495;">正在架設中...敬請期待!</h2> -->

             <!-- dashboard -->

              <!-- newcontent -->
              <header class="section-header">
      <div class="tbl">
        <div class="tbl-row">
          <div class="tbl-cell">
            <h3>登記問題</h3>
            <ol class="breadcrumb breadcrumb-simple">
              <li><a href="<?php echo base_url();?>admin">儀錶板&nbsp;&nbsp;</a></li>
              <li class="ml-3"><a href="<?php echo base_url();?>admin/questions">登記問題&nbsp;&nbsp;</a></li>
              <li class="ml-3 active">
                <?php if(empty($questioncontent[0]->id)){ echo '新增';}else{ echo '更改';}?>
              </li>
            </ol>
          </div>
        </div>
      </div>
    </header>

  



    <div class="box-typical box-typical-padding">
      <h5 class="with-border">Information</h5>
      <form class="form-horizontal" method="post" action="<?=base_url()?>admin/questions/edit" enctype="multipart/form-data" >
      <?php if($save){ ?>
          <div class="alert alert-success alert-dismissable ">
            <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
            登記問題成功儲存. </div>
          <?php }?>

        <div class="form-group row">
          <label class="col-sm-2 control-label">登記問題</label>
          <div class="col-sm-10">
          <select name="type_id" class="form-control">
              <?php 

                if($questioncontent[0]->type_id == 1){
                        $select = 'selected';
                      }else{
                        $select = '';
                      }
                 echo '<option value="1" '.$select.'>你想改善的問題</option>';

                 if($questioncontent[0]->type_id == 2){
                        $select = 'selected';
                      }else{
                        $select = '';
                      }
                 echo '<option value="2" '.$select.'>專業項目諮詢</option>';

                  
                  ?>
            </select>
          </div>
        </div>
        <div class="form-group row">
          <label class="col-sm-2 control-label">內容</label>
          <div class="col-sm-10">
<input type="text" name="question" class="form-control" required value="<?php if(isset($questioncontent[0]->question)){ echo $questioncontent[0]->question; }?>">
          </div>
        </div>

        <div class="form-group row">
          <label class="col-sm-2 control-label">顯示次序</label>
          <div class="col-sm-10">
<input type="text" name="displayorder" class="form-control" required value="<?php if(isset($questioncontent[0]->displayorder)){ echo $questioncontent[0]->displayorder; }?>">
          </div>
        </div>
      
<!--         <div class="form-group row">
          <label class="col-sm-2 control-label">Keywords</label>
          <div class="col-sm-10">
<textarea class="form-control" name="keywords" required><?php if(isset($seo[0]->keywords)){ echo $seo[0]->keywords; }?>
</textarea>
          </div>
        </div> -->
        <div class="form-group row">
          <div class="col-sm-2"></div>
          <div class="col-sm-10">
            <input name="save" type="submit" class="btn btn-success" value="Save">
            <input type="submit" class="btn btn-danger" value="Reset">
            <input type="hidden" name="id" value="<?php if(isset($questioncontent[0]->id)){ echo $questioncontent[0]->id; }?>">
          </div>
        </div>
      </form>
    </div>
    <!--.box-typical--> 

              <!-- end newcontent -->



              </div>
             <!-- end dashboard -->

                <!-- end new table -->
                
                <!-- body table -->
                <!-- <table class="table table-bordered table-sm   ">
                <thead class="">
                    <tr>
                        <th class="levleonetext" >

                            <input type="checkbox" class="checkbox" id="exampleCheck1">
                           


                        </th>
                        <th class="levleonetext"><span style="color:#7d4495;">管理員姓名</span></th>
                        <th class="levleonetext"><span style="color:#7d4495;">登入名稱</span></th>
                        <th class="levleonetext"><span style="color:#7d4495;" class="">更新時間<i class="fas fa-arrow-down ml-2"></i></span></th>
                        <th class="levleonetext"><span style="color:#7d4495;">編輯</span></th>
                    </tr>
                </thead>
                <tbody>
                    <tr class="tablerowoddbg ">
                        <td class="levleonetext"> <input type="checkbox" class="checkbox" id="exampleCheck1"></td>
                        <td class="levleonetext"><span>Amy AU</span></td>
                        <td class="levleonetext"><span>Admin1</span></td>
                        <td class="levleonetext"><span>2020-03-14 10:24:26</span></td>
                        <td class="levleonetext"><i class="fas fa-pencil-alt" style="color:#7d4495"></i></td>
                    </tr>
                </tbody>
                <tbody>
                    <tr class="">
                        <td class="levleonetext"> <input type="checkbox" class="checkbox" id="exampleCheck1"></td>
                        <td class="levleonetext"><span>Amy AU</span></td>
                        <td class="levleonetext"><span>Admin1</span></td>
                        <td class="levleonetext"><span>2020-03-14 10:24:26</span></td>
                        <td class="levleonetext"><i class="fas fa-pencil-alt" style="color:#7d4495"></i></td>
                    </tr>
                </tbody>
                <tbody>
                    <tr class="clickable tablerowoddbg" data-toggle="collapse" data-target="#group-of-rows-1" aria-expanded="false" aria-controls="group-of-rows-1" style="">
                        <td class="levleonetext"> <input type="checkbox" class="checkbox" id="exampleCheck1"></td>
                        <td class="levleonetext">Amy AU</td>
                        <td class="levleonetext">Admin1</td>
                        <td class="levleonetext">2020-03-14 10:24:26</td>
                        <td class="levleonetext"><i class="fas fa-pencil-alt" style="color:#7d4495"></i></td>
                    </tr>
                </tbody>
                <tbody id="group-of-rows-1" class="collapse">
                    <tr class="table-warning">
                        <td><i class="fa fa-folder-open"></i> child row</td>
                        <td>data 1</td>
                        <td>data 1</td>
                        <td>data 1</td>
                        <td>data</td>
                    </tr>
                    <tr class="table-warning">
                        <td><i class="fa fa-folder-open"></i> child row</td>
                        <td>data 1</td>
                        <td>data 1</td>
                        <td>data 1</td>
                        <td>data</td>
                    </tr>
                </tbody>
                <tbody>
                    <tr class="clickable" data-toggle="collapse" data-target="#group-of-rows-2" aria-expanded="false" aria-controls="group-of-rows-2">
                        <td><i class="fa fa-folder"></i></td>
                        <td>data</td>
                        <td>data</td>
                        <td>data</td>
                        <td>data</td>
                    </tr>
                </tbody>
                <tbody id="group-of-rows-2" class="collapse">
                    <tr class="table-warning">
                        <td><i class="fa fa-folder-open"></i> child row</td>
                        <td>data 2</td>
                        <td>data 2</td>
                        <td>data 2</td>
                        <td>data</td>
                    </tr>
                    <tr class="table-warning">
                        <td><i class="fa fa-folder-open"></i> child row</td>
                        <td>data 2</td>
                        <td>data 2</td>
                        <td>data 2</td>
                        <td>data</td>
                    </tr>
                </tbody>
            </table>   -->
                <!-- end body table -->
            </div>    
            <!-- end body content -->

            <!-- <table class="table table-bordered table-sm mx-2 ">
    <thead class="thead-dark">
        <tr>
            <th>Column</th>
            <th>管理員姓名</th>
            <th>登入名稱</th>
            <th>更新時間<i class="fas fa-arrow-down"></i></th>
        </tr>
    </thead>
    <tbody>
        <tr class="clickable" data-toggle="collapse" data-target="#group-of-rows-1" aria-expanded="false" aria-controls="group-of-rows-1">
            <td><i class="fa fa-folder"></i></td>
            <td>data</td>
            <td>data</td>
            <td>data</td>
        </tr>
    </tbody>
    <tbody id="group-of-rows-1" class="collapse">
        <tr class="table-warning">
            <td><i class="fa fa-folder-open"></i> child row</td>
            <td>data 1</td>
            <td>data 1</td>
            <td>data 1</td>
        </tr>
        <tr class="table-warning">
            <td><i class="fa fa-folder-open"></i> child row</td>
            <td>data 1</td>
            <td>data 1</td>
            <td>data 1</td>
        </tr>
    </tbody>
    <tbody>
        <tr class="clickable" data-toggle="collapse" data-target="#group-of-rows-2" aria-expanded="false" aria-controls="group-of-rows-2">
            <td><i class="fa fa-folder"></i></td>
            <td>data</td>
            <td>data</td>
            <td>data</td>
        </tr>
    </tbody>
    <tbody id="group-of-rows-2" class="collapse">
        <tr class="table-warning">
            <td><i class="fa fa-folder-open"></i> child row</td>
            <td>data 2</td>
            <td>data 2</td>
            <td>data 2</td>
        </tr>
        <tr class="table-warning">
            <td><i class="fa fa-folder-open"></i> child row</td>
            <td>data 2</td>
            <td>data 2</td>
            <td>data 2</td>
        </tr>
    </tbody>
</table> -->
            <!-- <h2>Collapsible Sidebar Using Bootstrap 41</h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

            <div class="line"></div>

            <h2>Lorem Ipsum Dolor</h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

            <div class="line"></div>

            <h2>Lorem Ipsum Dolor</h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

            <div class="line"></div>

            <h3>Lorem Ipsum Dolor</h3>
            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> -->
        </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>