<!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>Penanganan Pasien</title>
  <!-- Favicon -->
  <link rel="shortcut icon" href="{{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"> <!-- Custom styles -->
  <!-- Custom styles -->
  <link rel="stylesheet" href="{{url('design/css/style.min.css')}}">
  <link rel="stylesheet" href="{{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="{{url('design/css/project-style.css')}}">
</head>

<body>
  <div class="layer"></div>
  <!-- ! Body -->
  <div class="page-flex">
    <!-- ! Sidebar -->
    @include('component.sidebar')
    <div class="main-wrapper">
      <!-- ! Main nav -->
      @include('component.navbar')
      <!-- ! Main -->
      <main class="main users chart-page">
        <div class="container">
          <h2 class="main-title">Penanganan Pasien</h2>
          <div class="row">
            <div class="col-12">
              <div class="white-block">
                <div class="row">
                  <div class="col-12 mb-3">
                    <h5>Data Pasien</h5>
                  </div>
                  <div class="col-6">
                    <div class="mb-3">
                      <p>No. Rekam Medis</p>
                      <h5>{{$dataPemeriksaan->dataPasien->dp_no_rm}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>No. KTP</p>
                      <h5>{{$dataPemeriksaan->dataPasien->dp_no_ktp}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>No. BPJS</p>
                      <h5>
                        <?php
                        if ($dataPemeriksaan->dataPasien->dp_no_bpjs != null) {
                          echo $dataPemeriksaan->dataPasien->dp_no_bpjs;
                        } else {
                          echo "Tidak terdaftar";
                        }
                        ?>
                      </h5>
                    </div>
                  </div>
                  <div class="col-6">
                    <div class="mb-3">
                      <p>Nama</p>
                      <h5>{{$dataPemeriksaan->dataPasien->dp_nama}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>Tahun</p>
                      <h5>
                        <?php
                        $usia = date_diff(date_create($dataPemeriksaan->dataPasien->dp_tgl_lahir), date_create('now'))->y;
                        echo $usia . " tahun";
                        ?>
                      </h5>
                    </div>
                    <div class="mb-3">
                      <p>Jenis Kelamin</p>
                      <h5>{{$dataPemeriksaan->dataPasien->dp_jenis_kelamin}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>Alamat</p>
                      <h5><?php echo $dataPemeriksaan->dataPasien->dp_alamat ?></h5>
                    </div>

                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-6">
              <div class="white-block data_rekam_medis">
                <h5 class="mb-3">Rekam Medis</h5>
                <div style="max-height: 550px;" class="overflow-auto">
                  <div class="accordion" id="dataRekamMedis">
                    @foreach ($dataRekamMedis as $drm)
                    <div class="accordion-item">
                      <h2 class="accordion-header" id="DRM{{$drm->rm_id}}">
                        <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#dataRM{{$drm->rm_id}}" aria-expanded="true" aria-controls="dataRM{{$drm->rm_id}}">
                          <div class="col-6">
                            <p>Tanggal</p>
                            <h5>
                              <?php
                              echo date_format(date_create($drm->rm_created_at), 'd - F - Y');
                              ?>
                            </h5>
                          </div>
                          <div class="col-6">
                            <p class="text-end">Biaya</p>
                            <h5 class="text-end">Rp. {{ number_format($drm->rm_pembayaran, 2) }}</h5>
                          </div>
                        </button>
                      </h2>
                      <div id="dataRM{{$drm->rm_id}}" class="accordion-collapse collapse" aria-labelledby="DRM{{$drm->rm_id}}" data-bs-parent="#dataRekamMedis">
                        <div class="accordion-body">

                          <div class="mb-3">
                            <h5>Alergi Obat</h5>
                            <div><?php echo $drm->p_alergi ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Anamnesa</h5>
                            <div><?php echo $drm->p_anamnesa ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Pemeriksaan Fisik</h5>
                            <div><?php echo $drm->p_pemeriksaan_fisik ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Diagnosa</h5>
                            <div><?php echo $drm->rm_diagnosa ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Terapi</h5>
                            <div><?php echo $drm->rm_terapi ?></div>
                          </div>
                        </div>
                      </div>
                    </div>
                    @endforeach
                  </div>
                </div>
                @if ($dataRekamMedis->isEmpty())
                <h3 class="text-center">Data Rekam Medis Tidak Tersedia</h3>
                @endif
              </div>
            </div>
            <div class="col-6">
              <div class="white-block">
                <h5>Data Periksa</h5>

                <form action="{{url('dataPenangananPasien/'. $dataPemeriksaan->p_id)}}" method="POST">
                  @method('PUT')
                  @csrf

                  <label class="form-label-wrapper mb-2">
                    <p class="form-label">Alergi Obat</p>
                    <textarea class="alergi form-input" name="p_alergi" required>{{$dataPemeriksaan->p_alergi}}</textarea>
                  </label>

                  <label class="form-label-wrapper mb-2">
                    <p class="form-label">Anamnesa</p>
                    <textarea class="anamnesa form-input" name="p_anamnesa" required>{{$dataPemeriksaan->p_anamnesa}}</textarea>
                  </label>

                  <label class="form-label-wrapper mb-2">
                    <p class="form-label">Pemeriksaan Fisik</p>
                    <textarea class="pemeriksaan_fisik form-input" name="p_pemeriksaan_fisik" required>{{$dataPemeriksaan->p_pemeriksaan_fisik}}</textarea>
                  </label>


                  <label class="form-label-wrapper mb-2">
                    <p class="form-label">Diagnosa</p>
                    <textarea class="diagnosa form-input" name="rm_diagnosa" required></textarea>
                  </label>


                  <label class="form-label-wrapper mb-2">
                    <p class="form-label">Terapi</p>
                    <textarea class="terapi form-input" name="rm_terapi" required></textarea>
                  </label>

                  <label class="form-label-wrapper">
                    <p class="form-label">Biaya</p>
                    <input class="form-input" type="number" name="rm_pembayaran" placeholder="Masukan biaya pengobatan" required>
                  </label>
                  <button type="submit" class="primary-default-btn transparent-btn">Simpan</button>
                </form>
              </div>
            </div>
          </div>
        </div>
      </main>
      <!-- ! Footer -->
      @include('component.footer')
    </div>
  </div>
  <!-- Froala -->
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/froala-editor@latest/js/froala_editor.pkgd.min.js"></script>
  <!-- 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="{{url('design/plugins/chart.min.js')}}"></script>
  <!-- Icons library -->
  <script src="{{url('design/plugins/feather.min.js')}}"></script>
  <!-- Custom scripts -->
  <script src="{{url('design/js/script.js')}}"></script>
  <script>
    $("#antrian").addClass("active");

    // new FroalaEditor('textarea.alergi', {
    //   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']
    //   ]
    // });
    // new FroalaEditor('textarea.anamnesa', {
    //   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']
    //   ]
    // });
    // new FroalaEditor('textarea.pemeriksaan_fisik', {
    //   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']
    //   ]
    // });
    // new FroalaEditor('textarea.diagnosa', {
    //   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']
    //   ]
    // });
    // new FroalaEditor('textarea.terapi', {
    //   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']
    //   ]
    // });
  </script>
</body>

</html>