<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Apotik Pharmacy
            <small><?= $abdulradjak['NamaPerusahaan']; ?> - <?= $abdulradjak['KodePPK']; ?></small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Vclaim</a></li>
            <li class="active">Data Pasien</li>
        </ol>
    </section>

    <?php
    extract($_GET);
    $detailApotik = $this->db->query("SELECT AA.ID, AA.TransactionID, AA.[Case ID], AA.Unit,AA.DrugsID,P.Description,AA.Charge,AA.Qty,AA.Charge,AA.BasicPrice,AA.Dosis,AA.Cara,P.PharmacyUnit,AA.Ket
    FROM [Activity Drugs] AA, Pharmacy P WHERE AA.DrugsID=P.PharmacyCode AND TransactionID = '$isi'")->result_array();
    ?>

    <!-- Main content -->
    <section class="content">
        <!-- Default box -->
        <div class="box">
            <div class="box-body">
                <small>
                    <form action="<?= base_url('apotik/prosesAddPharmacy'); ?>" method="post">
                        <table class="table table-striped">
                            <tr>
                                <th style="display: none;">Transaction ID</th>
                                <th style="display: none;">Case ID</th>

                                <th>Pharmacy</th>
                                <th>Qty</th>
                                <th>Dosis / Frekuensi</th>
                                <th>Cara</th>
                                <th>Ket. </th>
                            </tr>
                            <tr>
                                <td style="display: none;">
                                    <input autofocus type="text" name="TransactionID" class="form-control" value="<?= $isi; ?>">
                                    <input type="text" name="UserCreated" value="<?= $user['UserName']; ?>">
                                </td>
                                <td style="display: none;">
                                    <input type="text" name="caseID" class="form-control" value="<?= $pasienDetail['Case ID']; ?>">
                                </td>

                                <td>
                                    <select name="DrugsId" class="teanganData" required data-live-search="true">
                                        <option value=""></option>
                                        <?php
                                        foreach ($obat as $list) :
                                        ?>
                                            <option value="<?= $list['PharmacyCode']; ?>"><?= $list['Description']; ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>
                                </td>
                                <td>
                                    <input type="number" name="Qty" class="form-control" required>
                                    <input type="hidden" name="user" value="<?= $user['nama']; ?>">
                                </td>
                                <td>
                                    <select name="dosis" class="teanganData" required data-live-search="true">
                                        <option value=""></option>
                                        <?php
                                        foreach ($dosis as $dosisP) :
                                        ?>
                                            <option value="<?= $dosisP['AturanPakai']; ?>"><?= $dosisP['AturanPakai']; ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>
                                </td>
                                <td>
                                    <select name="caraPakai" required class="teanganData " data-live-search="true">
                                        <option value=""></option>
                                        <?php
                                        foreach ($caraPakai as $pakai) :
                                        ?>
                                            <option value="<?= $pakai['CaraPakai']; ?>"><?= $pakai['CaraPakai']; ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>
                                </td>
                                <td>
                                    <input type="text" class="form-control" name="ket">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="6">
                                    <button type="submit" class="btn btn-sm btn-success">Add Pharmacy</button>
                                    <a href="<?= base_url('apotik/transaksiPharmacy/' . $pasienDetail['Case ID'] . '?isi=' . $isi); ?>" class="btn btn-sm btn-danger">Selesai</a>
                                </td>
                            </tr>
                        </table>
                    </form>
                </small>
            </div><!-- /.box-body -->
        </div><!-- /.box -->

        <div class="box">
            <div class="box-body">
                <small>
                    <table class="table table-striped">
                        <tr>
                            <th></th>
                            <th>Pharmacy</th>
                            <th>Satuan</th>
                            <th>Qty</th>
                            <th>Charge</th>
                            <th>Dosis / Frekuensi</th>
                            <th>Cara</th>
                            <th>Ket. </th>
                        </tr>
                        <?php
                        foreach ($detailApotik as $details) :
                        ?>
                            <tr>
                                <td>
                                    <a href="<?= base_url('apotik/editPharmacy/' . $pasienDetail['Case ID'] . '?isi=' . $isi . '&Idt=' . $details['ID']); ?>" class="btn btn-sm btn-primary">
                                        <i class="fa fa-fw fa-pencil"></i>
                                    </a>
                                    <a href="<?= base_url('apotik/hapusPharmacy/' . $details['ID'].'/'.$isi); ?>" onclick="return confirm('Hapus item obat <?= $details['Description']; ?> ?')" class="btn btn-sm btn-danger">
                                        <i class="fa fa-fw fa-trash"></i>
                                    </a>
                                </td>
                                <td><?= $details['Description']; ?></td>
                                <td><?= $details['PharmacyUnit']; ?></td>
                                <td><?= $details['Qty']; ?></td>
                                <td><?= $details['Charge']; ?></td>
                                <td><?= $details['Dosis']; ?></td>
                                <td><?= $details['Cara']; ?></td>
                                <td><?= $details['Ket']; ?></td>

                            </tr>
                        <?php
                        endforeach;
                        ?>

                    </table>
                </small>
            </div><!-- /.box-body -->
        </div>

    </section><!-- /.content -->

</div><!-- /.content-wrapper -->