<!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>Data Pasien</title>
  <!-- Favicon -->
  <link rel="shortcut icon" href="./img/svg/logo.svg" type="image/x-icon">
  <!-- 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"> <!-- Custom styles -->
  <!-- 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')); ?>">
  <!-- Froala -->
  <link href="https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css" rel="stylesheet" type="text/css" />
  <!-- Project Style -->
  <link rel="stylesheet" href="<?php echo e(url('design/css/project-style.css')); ?>">
  <!-- Flatpicker -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.min.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 Pasein</h2>
          <div class="row justify-content-center">
            <div class="col-10">
              <div class="white-block">
                <div class="row">
                  <div class="col-6">
                    <p class="stat-cards-info__num mb-3" style="font-size: 22px;">Data Pasien</p>
                  </div>
                </div>
                <table class="table table-striped table-hover" id="data_pasien">
                  <thead>
                    <tr>
                      <th style="width: 5%;">No</th>
                      <th scope="col">Nama</th>
                      <th style="width: 15%;">No. Rek. Medis</th>
                      <th style="width: 18%;">Umur</th>
                      <th style="width: 25%;">Aksi</th>
                    </tr>
                  </thead>
                  <tbody>
                    <?php $no = 0; ?>
                    <?php $__currentLoopData = $dataPasien; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php $no++; ?>
                    <tr id="dataPasien_<?php echo e($dp->dp_id); ?>" class="align-middle">
                      <td><?php echo e($no); ?></td>
                      <td><?php echo e($dp->dp_nama); ?></td>
                      <th scope="row"><?php echo e($dp->dp_no_rm); ?></th>
                      <td>
                        <?php
                        $tgl_lahir = date_create($dp->dp_tgl_lahir);
                        $today = new DateTime;
                        $usia = $today->diff($tgl_lahir);
                        echo $usia->format('%y Tahun, %m Bulan');
                        ?>
                      </td>
                      <td style="height: 60px">
                        <a type="button" class="btn btn-success" href="<?php echo e(url('data_pasien/'.$dp->dp_id)); ?>">Detail</a>
                        <a type="button" style="color: white;" class="btn btn-info mobile-button" href="<?php echo e(url('data_pasien/'.$dp->dp_id.'/edit')); ?>">Ubah</a>
                        <button type="button" class="btn btn-danger" onclick="deleteDataPasien(event.target)" data-id="<?php echo e($dp->dp_id); ?>">Hapus</button>
                      </td>
                    </tr>
                    <?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>

  <!-- 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>
  <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js" integrity="sha256-DI6NdAhhFRnO2k51mumYeDShet3I8AKCQf/tf7ARNhI=" crossorigin="anonymous"></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>
  <!-- Flatpicker -->
  <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
  <!-- Froala -->
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/froala-editor@latest/js/froala_editor.pkgd.min.js"></script>
  <!-- Notiflix -->
  <script src="https://cdn.jsdelivr.net/npm/notiflix@3.0.1/dist/notiflix-aio-3.0.1.min.js"></script>
  <!-- DataTables -->
  <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
  <script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap5.min.js"></script>

  <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  <script>
    $(document).ready(function() {
      $(".tgl-lahir").flatpickr({
        altInput: true,
        altFormat: "j-F-Y",
        dateFormat: "d-M-Y"
      });

      $('#data_pasien').DataTable({
        "scrollX": true,
        'language': {
          search: '<div class="search-wrapper float-end"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search" aria-hidden="true"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg> <input type="text" placeholder="Cari ..." required=""> </div>',
          searchPlaceholder: 'Cari',
        }
      });

      new FroalaEditor('textarea.alamat', {
        quickInsertEnabled: false,
        attribution: false,
        placeholderText: false,
        height: 150,
        fontSizeDefaultSelection: '18',
        toolbarButtons: [
          ['bold', 'italic', 'underline'],
          ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify', 'lineHeight', 'outdent', 'indent'],
          ['undo', 'redo', 'print', 'getPDF']
        ]
      });
    });

    function deleteDataPasien(e) {
      var id = $(e).data("id");
      var nama = $("#dataPasien_" + id + " td:nth-child(2)").html();
      var no_rm = $("#dataPasien_" + id + " th:nth-child(3)").html();

      swal.fire({
        title: "Apakah anda yakin !!",
        text: "Data pasien " + nama + " dengan nomor rekam medis " + no_rm + " akan dihapus ?",
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
      }).then((result) => {
        if (result.isConfirmed) {
          let url = "<?php echo e(route('data_pasien.destroy', ['data_pasien' => ':id'])); ?>".replace(':id', id);

          $.ajax({
            url: url,
            type: 'delete',
            data: {
              _token: '<?php echo e(csrf_token()); ?>',
            },
            success: function(response) {
              $("#dataPasien_" + id).remove();
            }
          });
          Swal.fire(
            'Deleted!',
            "Data pasien " + nama + " dengan nomor rekam medis " + no_rm + " telah dihapus",
            'success'
          )
        }
      })
    };
  </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\data_pasien\data_pasien.blade.php ENDPATH**/ ?>