<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>User</title>
  <!-- Favicon -->
  <link rel="shortcut icon" href="<?php echo e(url('design/img/svg/Logo_Original.png')); ?>">
  <!-- Bootstrap -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <!-- Fontawesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
  <!-- Custom styles -->
  <link rel="stylesheet" href="<?php echo e(url('design/css/style.min.css')); ?>">
  <link rel="stylesheet" href="<?php echo e(url('design/fonts/stylesheet.css')); ?>">
  <link rel="stylesheet" href="<?php echo e(url('design/css/project-style.css')); ?>">
</head>

<body>
  <div class="layer"></div>
  <!-- ! Body -->
  <div class="page-flex">
    <!-- ! Sidebar -->
    <?php echo $__env->make('component.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <div class="main-wrapper">
      <!-- ! Main nav -->
      <?php echo $__env->make('component.navbar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
      <!-- ! Main -->
      <main class="main users chart-page">
        <div class="container">
          <h2 class="main-title">Data User</h2>
          <div class="row justify-content-center">
            <div class="col-9">
              <div class="white-block">
                <button type="button" class="btn btn-primary w-25 mb-3" data-bs-toggle="modal" data-bs-target="#addUser">Tambah</button>
                <table class="table align-middle table-striped table-hover">
                  <thead>
                    <tr>
                      <th scope="col" class="text-center">#</th>
                      <th scope="col">Nama</th>
                      <th scope="col">Email</th>
                      <th scope="col">Wewenang</th>
                      <th scope="col">Nomor Handphone</th>
                      <th scope="col" class="w-25">Aksi</th>
                    </tr>
                  </thead>
                  <tbody>
                    <?php $i = 0 ?>
                    <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php $i++ ?>
                    <?php if($u->u_role != 'Developer'): ?>
                    <tr>
                      <td class=" text-center"><?php echo e($i); ?></td>
                      <td><?php echo e($u->u_nama); ?></td>
                      <td><?php echo e($u->u_email); ?></td>
                      <td><?php echo e($u->u_role); ?></td>
                      <td><?php echo e($u->u_no_hp); ?></td>
                      <td style="height: 60px;">
                        <button type="button" class="btn btn-info" data-bs-toggle="modal" data-bs-target="#editUser<?php echo e($u->u_id); ?>">Ubah</button>
                        <button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#deleteUser<?php echo e($u->u_id); ?>">Hapus</button>
                      </td>
                    </tr>
                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </main>
      <!-- ! Footer -->
      <?php echo $__env->make('component.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    </div>
  </div>

  <!-- Modal Add -->
  <div class="modal fade" id="addUser" tabindex="-1" aria-labelledby="addUserLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="addUserLabel">Tambah Pengguna</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <form id="formAddUser" action="<?php echo e(url('/user')); ?>" method="post">
            <?php echo csrf_field(); ?>
            <label class="form-label-wrapper">
              <p class="form-label">Nama</p>
              <input class="form-input" type="text" name="u_nama" placeholder="Masukan nama anda" required>
            </label>
            <label class="form-label-wrapper">
              <p class="form-label">Email</p>
              <input class="form-input" type="email" name="u_email" placeholder="Masukan email anda" required>
            </label>
            <label class="form-label-wrapper">
              <p class="form-label">Wewenang</p>
              <select class="form-input" name="u_role" required>
                <option selected>-Pilih wewenang-</option>
                <option value="Dokter">Dokter</option>
                <option value="Admin">Admin</option>
              </select>
            </label>
            <label class="form-label-wrapper">
              <p class="form-label">Nomor Handphone</p>
              <input class="form-input" type="text" name="u_no_hp" placeholder="Masukan nomor ponsel anda" minlength="11" maxlength="12" required>
            </label>
            <label class="form-label-wrapper">
              <p class="form-label">Password</p>
              <input class="form-input" type="password" name="u_password" onChange="onChange()" placeholder="Masukan password anda" minlength="6" required>
            </label>
            <label class="form-label-wrapper">
              <p class="form-label">Konfirmasi Password</p>
              <input class="form-input" type="password" name="konfirmasi_password" onChange="onChange()" placeholder="Masukan konfirmasi password anda" required>
            </label>
          </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
          <button class="btn btn-primary" type="submit" form="formAddUser">Simpan</button>
        </div>
      </div>
    </div>
  </div>

  <!-- Modal Edit -->
  <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
  <div class="modal fade" id="editUser<?php echo e($u->u_id); ?>" tabindex="-1" aria-labelledby="editUser<?php echo e($u->id); ?>" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="addUserLabel">Edit Pengguna</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <form id="formEditUser<?php echo e($u->u_id); ?>" action="<?php echo e(url('user/'.$u->u_id)); ?>" method="post">
            <?php echo method_field('PUT'); ?>
            <?php echo csrf_field(); ?>
            <label class="form-label-wrapper">
              <p class="form-label">Nama</p>
              <input class="form-input" type="text" name="u_nama" placeholder="Masukan nama anda" value="<?php echo e($u->u_nama); ?>" required>
            </label>
            <label class="form-label-wrapper">
              <p class="form-label">Email</p>
              <input class="form-input" type="email" name="u_email" placeholder="Masukan email anda" value="<?php echo e($u->u_email); ?>" minlength="11" maxlength="12" required>
            </label> <label class="form-label-wrapper">
              <p class="form-label">Wewenang</p>
              <select class="form-input" name="u_role" required>
                <option value="Dokter" <?php if ("Dokter" == $u->u_role) echo 'selected="selected"'; ?>>Dokter</option>
                <option value="Admin" <?php if ("Admin" == $u->u_role) echo 'selected="selected"'; ?>>Admin</option>
              </select>
            </label>
            <label class="form-label-wrapper">
              <p class="form-label">Nomor Handphone</p>
              <input class="form-input" type="text" name="u_no_hp" placeholder="Masukan nomor ponsel anda" value="<?php echo e($u->u_no_hp); ?>" required>
            </label>
            <div class="form-check form-switch">
              <input class="form-check-input border" type="checkbox" id="togglePassword<?php echo e($u->u_id); ?>">
              <label class="form-check-label" for="togglePassword<?php echo e($u->u_id); ?>">Ubah Password</label>
            </div>
            <div id="passInput<?php echo e($u->u_id); ?>">
              <label class="form-label-wrapper">
                <p class="form-label">Password</p>
                <input class="form-input" type="password" name="u_password" placeholder="Masukan password anda" minlength="6">
              </label>
              <label class="form-label-wrapper">
                <p class="form-label">Konfirmasi Password</p>
                <input class="form-input" type="password" name="konfirmasi_password" placeholder="Masukan konfirmasi password anda">
              </label>
            </div>
          </form>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
          <button class="btn btn-primary" type="submit" form="formEditUser<?php echo e($u->u_id); ?>">Simpan</button>
        </div>
      </div>
    </div>
  </div>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

  <!-- Modal Delete -->
  <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
  <div class="modal fade" id="deleteUser<?php echo e($u->u_id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLongTitle">Hapus Pengguna</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <table class="table table-borderless">
            <tbody>
              <tr>
                <th>Nama</th>
                <td>:</td>
                <td><?php echo e($u->u_nama); ?></td>
              </tr>
              <tr>
                <th>Wewenang</th>
                <td>:</td>
                <td><?php echo e($u->u_role); ?></td>
              </tr>
            </tbody>
          </table>
          <form id="deleteForm<?php echo e($u->u_id); ?>" method="POST" action="<?php echo e(url('user/'.$u->u_id)); ?>">
            <?php echo method_field('DELETE'); ?>
            <?php echo csrf_field(); ?>
          </form>
        </div>
        <div class=" modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
          <button type="submit" form="deleteForm<?php echo e($u->u_id); ?>" class="btn btn-danger">Hapus</button>
        </div>
      </div>
    </div>
  </div>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

  <!-- jQuery -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  <!-- Bootstrap -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
  <!-- Chart library -->
  <script src="<?php echo e(url('design/plugins/chart.min.js')); ?>"></script>
  <!-- Icons library -->
  <script src="<?php echo e(url('design/plugins/feather.min.js')); ?>"></script>
  <!-- Custom scripts -->
  <script src="<?php echo e(url('design/js/script.js')); ?>"></script>
  <!-- Notiflix -->
  <script src="https://cdn.jsdelivr.net/npm/notiflix@3.0.1/dist/notiflix-aio-3.0.1.min.js"></script>

  <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
  <script>
    $("#user").addClass("active");

    $(function() {
      $("#passInput<?php echo e($u->u_id); ?>").hide();
      $("#togglePassword<?php echo e($u->u_id); ?>").change(function() {
        if ($(this).is(":checked")) {
          $("#passInput<?php echo e($u->u_id); ?>").show();
        } else {
          $("#passInput<?php echo e($u->u_id); ?>").hide();
        }
      });
    });
  </script>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

  <script>
    function onChange() {
      const password = document.querySelector('input[name=u_password]');
      const confirm = document.querySelector('input[name=konfirmasi_password]');
      if (confirm.value === password.value) {
        confirm.setCustomValidity('');
      } else {
        confirm.setCustomValidity('Passwords do not match');
      }
    };
  </script>

  <?php echo $__env->make('component.notif', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
</body>

</html><?php /**PATH D:\website-dokter-budi-master\resources\views\user\user.blade.php ENDPATH**/ ?>