<div class="container-fluid py-4">
      <div class="card pb-0 p-3">
                  <div class="row">
                    <div class="col-6 d-flex align-items-center">
                      <h6 class="mb-0">รายการชื่อสมาชิกทั้งหมด</h6>
                    </div>
                    <div class="col-6 text-end ">
                      <button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo"><i class="fas fa-plus" aria-hidden="true"></i>&nbsp;&nbsp;เพิ่มสมาชิก</a></button>
                    </div>
                   
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-5" id="exampleModalLabel">เพิ่มสมาชิกใหม่</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
                <?php if (isset($validation)) : ?>
                    <div class="col-12">
                        <div class="alert alert-danger" role="alert">
                            <?= $validation->listErrors() ?>
                        </div>
                    </div>
                <?php endif; ?>
                <form class="" action="<?= base_url('/account/category/add') ?>" method="post">
                    <div class="form-group">
                        <label for="name">ชื่อ-นามสกุล</label>
                        <input type="text" class="form-control" name="name" id="name"  placeholder="กรอก ชื่อ-นามสกุล" >
                    </div>
                    <div class="form-group">
                        <label for="email">อีเมล์</label>
                        <input type="email" class="form-control" name="email" id="email"  placeholder="กรอกอีเมล์ที่จะใช้ในการเข้าสู่ระบบ" >
                    </div>
                    <div class="form-group">
                        <label for="mobile">หมายเลขโทรศัพท์</label>
                        <input type="text" class="form-control" name="phone_no" id="phone_no"  placeholder="กรอกหมายเลขโทรศัพท์" >
                    </div>
                    <label for="mobile">สถานะ</label>
                    <select class="form-select" autofocus="" name="write_status" id="write_status" title="สถานะ">
                        <option value="member">สมาชิกทั่วไป</option>
                        <option value="admin">แอดมิน</option>
                    </select><br>
		    <div class="form-group">
                        <label for="mobile">ตั่งรหัสผ่าน</label>
                        <input type="text" class="form-control" name="phone_no" id="phone_no"  placeholder="กรอกหมายเลขโทรศัพท์" >
                    </div>
                    <div class="form-group">
                        <label for="mobile">ยื่นยันรหัสผ่านที่จะตั่ง</label>
                        <input type="text" class="form-control" name="phone_no" id="phone_no"  placeholder="กรอกหมายเลขโทรศัพท์" >
                    </div>
                    <br>
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">ปิดหน้านี้</button>
                    <button type="submit" class="btn btn-success">สมัครสมาชิกใหม่เลย</button>
                </form>
      </div>
    </div>
  </div>
  </div>
</div>
            </div><br>
            
<div class="card pb-3 p-3">
    <table class="table">
  <thead>
    <tr>
      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7" scope="col">#</th>
      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7" scope="col">Name</th>
      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7" scope="col">E-Mail</th>
      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7" scope="col">Phone</th>
      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7" scope="col">Status</th>
      <th class="text-uppercase text-secondary text-xxs font-weight-bolder opacity-7" scope="col">Note</th>
      <th></th>
    </tr>
  </thead>
  <tbody class="table-group-divider">
                        <?php
                        foreach ($members as $value) {
                        ?>
  
    <tr>
      <th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7" scope="row"><?php echo $value['id']; ?></th>
      <td class="text-secondary text-xxs opacity-7"><?php echo $value['name']; ?></td>
      <td class="text-secondary text-xxs  opacity-7"><?php echo $value['email']; ?></td>
      <td class="text-secondary text-xxs  opacity-7"><?php echo $value['phone_no']; ?></td>
      <td class="text-center text-secondary text-xxs  opacity-7"><?php echo $value['role']; ?></td>
      <td class="text-secondary text-xxs  opacity-7"><?php echo $value['note']; ?></td>
      <td>
      <div class="ms-auto text-end">
       <a class="btn btn-link text-dark px-3 mb-0" href="javascript:;"><svg class="svg-inline--fa fa-pencil text-dark me-2" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="pencil" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" data-fa-i2svg=""><path fill="currentColor" d="M421.7 220.3l-11.3 11.3-22.6 22.6-205 205c-6.6 6.6-14.8 11.5-23.8 14.1L30.8 511c-8.4 2.5-17.5 .2-23.7-6.1S-1.5 489.7 1 481.2L38.7 353.1c2.6-9 7.5-17.2 14.1-23.8l205-205 22.6-22.6 11.3-11.3 33.9 33.9 62.1 62.1 33.9 33.9zM96 353.9l-9.3 9.3c-.9 .9-1.6 2.1-2 3.4l-25.3 86 86-25.3c1.3-.4 2.5-1.1 3.4-2l9.3-9.3H112c-8.8 0-16-7.2-16-16V353.9zM453.3 19.3l39.4 39.4c25 25 25 65.5 0 90.5l-14.5 14.5-22.6 22.6-11.3 11.3-33.9-33.9-62.1-62.1L314.3 67.7l11.3-11.3 22.6-22.6 14.5-14.5c25-25 65.5-25 90.5 0z"></path></svg><!-- <i class="fas fa-pencil-alt text-dark me-2" aria-hidden="true"></i> Font Awesome fontawesome.com -->Edit</a>
       <a class="btn btn-link text-danger text-gradient px-3 mb-0" href="javascript:;"><svg class="svg-inline--fa fa-trash-can me-2" aria-hidden="true" focusable="false" data-prefix="far" data-icon="trash-can" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg=""><path fill="currentColor" d="M160 400C160 408.8 152.8 416 144 416C135.2 416 128 408.8 128 400V192C128 183.2 135.2 176 144 176C152.8 176 160 183.2 160 192V400zM240 400C240 408.8 232.8 416 224 416C215.2 416 208 408.8 208 400V192C208 183.2 215.2 176 224 176C232.8 176 240 183.2 240 192V400zM320 400C320 408.8 312.8 416 304 416C295.2 416 288 408.8 288 400V192C288 183.2 295.2 176 304 176C312.8 176 320 183.2 320 192V400zM317.5 24.94L354.2 80H424C437.3 80 448 90.75 448 104C448 117.3 437.3 128 424 128H416V432C416 476.2 380.2 512 336 512H112C67.82 512 32 476.2 32 432V128H24C10.75 128 0 117.3 0 104C0 90.75 10.75 80 24 80H93.82L130.5 24.94C140.9 9.357 158.4 0 177.1 0H270.9C289.6 0 307.1 9.358 317.5 24.94H317.5zM151.5 80H296.5L277.5 51.56C276 49.34 273.5 48 270.9 48H177.1C174.5 48 171.1 49.34 170.5 51.56L151.5 80zM80 432C80 449.7 94.33 464 112 464H336C353.7 464 368 449.7 368 432V128H80V432z"></path></svg><!-- <i class="far fa-trash-alt me-2" aria-hidden="true"></i> Font Awesome fontawesome.com -->Delete</a>
      </div></td>
    </tr>
<?php
     }
   ?>
     </tbody>
</table>
</table>
   <script type="text/javascript">
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();   
});

$('#reloadpage').click(function() {
 
    location.reload(true);
 
});

function archiveFunction(id) {
event.preventDefault(); // prevent form submit
var form = event.target.form; // storing the form
        swal({
  title: "คุณแน่ใจใช่ไหม?",
  text: "เมื่อคุณลบกระเป๋าใบนี้ไปแล้วคุณจะไม่สามารถกู้คืนได้อีก",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#F83D3D",
  confirmButtonText: "ใช่, ต้องการลบ!",
  cancelButtonText: "ไม่, ไม่ต้องการลบ!",
  closeOnConfirm: false,
  closeOnCancel: false
},
function(isConfirm){
  if (isConfirm) {
	  window.location = "/account/category/delete/"+id;

  } else {
  
    setTimeout(function() {
                        swal({
                            title: "Cancelled!",
                            text: "ลบข้อมูลไม่สำเร็จ!",
                            type: "error",
                            timer: 1000,
			    })
                         });
        }
                });
  }
 

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