<!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>{{$dataAntrian->pasien->dp_no_rm}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>No. KTP</p>
                      <h5>{{$dataAntrian->pasien->dp_no_ktp}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>No. BPJS</p>
                      <h5>{{$dataAntrian->pasien->dp_no_bpjs}}</h5>
                    </div>
                  </div>
                  <div class="col-6">
                    <div class="mb-3">
                      <p>Nama</p>
                      <h5>{{$dataAntrian->pasien->dp_nama}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>Tahun</p>
                      <h5>
                        <?php
                        $usia = date_diff(date_create($dataAntrian->pasien->dp_tgl_lahir), date_create('now'))->y;
                        echo $usia . " tahun";
                        ?>
                      </h5>
                    </div>
                    <div class="mb-3">
                      <p>Jenis Kelamin</p>
                      <h5>{{$dataAntrian->pasien->dp_jenis_kelamin}}</h5>
                    </div>
                    <div class="mb-3">
                      <p>Alamat</p>
                      <h5><?php echo $dataAntrian->pasien->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->a_id}}">
                        <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#dataRM{{$drm->a_id}}" aria-expanded="true" aria-controls="dataRM{{$drm->a_id}}">
                          <div class="col-6">
                            <p>Tanggal</p>
                            <h5>
                              <?php
                              echo date_format($drm->a_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->a_pembayaran, 2) }}</h5>
                          </div>
                        </button>
                      </h2>
                      <div id="dataRM{{$drm->a_id}}" class="accordion-collapse collapse" aria-labelledby="DRM{{$drm->a_id}}" data-bs-parent="#dataRekamMedis">
                        <div class="accordion-body">

                          <div class="mb-3">
                            <h5>Alergi Obat</h5>
                            <div><?php echo $drm->a_alergi ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Anamnesa</h5>
                            <div><?php echo $drm->a_anamnesa ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Pemeriksaan Fisik</h5>
                            <div><?php echo $drm->a_pemeriksaan_fisik ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Diagnosa</h5>
                            <div><?php echo $drm->a_diagnosa ?></div>
                          </div>
                          <div class="mb-3">
                            <h5>Terapi</h5>
                            <div><?php echo $drm->a_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/'. $dataAntrian->a_id)}}" method="POST">
                  @method('PUT')
                  @csrf
                  <div class="form-group mb-2">
                    <label class="form-label">Alergi Obat</label>
                    <textarea class="alergi" name="a_alergi" required>{{$dataAntrian->a_alergi}}</textarea>
                  </div>

                  <div class="form-group mb-2">
                    <label class="form-label">Anamnesa</label>
                    <textarea class="anamnesa" name="a_anamnesa" required>{{$dataAntrian->a_anamnesa}}</textarea>
                  </div>

                  <div class="form-group mb-2">
                    <label class="form-label">Pemeriksaan Fisik</label>
                    <textarea class="pemeriksaan_fisik" name="a_pemeriksaan_fisik" required>{{$dataAntrian->a_pemeriksaan_fisik}}</textarea>
                  </div>

                  <div class="form-group mb-2">
                    <label class="form-label">Diagnosa</label>
                    <textarea class="diagnosa" name="a_diagnosa" required>{{$dataAntrian->a_diagnosa}}</textarea>
                  </div>

                  <div class="form-group mb-2">
                    <label class="form-label">Terapi</label>
                    <textarea class="terapi" name="a_terapi" required></textarea>
                  </div>

                  <label class="form-label-wrapper">
                    <p class="form-label">Biaya</p>
                    <input class="form-input" type="number" name="a_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>