<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Items Transaction
            <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
 $caseid       = $this->uri->segment(3);
 $pasienDetail = $this->db->query("Select * from Cases where [Case ID] = '$caseid' ")->row_array();
 $idtransaksi       = $this->uri->segment(4);
 $cekidtransaksi = $this->db->query("Select * from Activity where TransactionID = '$idtransaksi' ")->num_rows();
?>

    <!-- Main content -->
    <section class="content">
        <!-- Default box -->
        <div class="box">
            <div class="box-body">
                <small>
                    <form action="<?= base_url('Transaction/prosesAddTreatment'); ?>" method="post">
                        <table class="table table-striped">
                            <tr>
                                <th colspan="4">Items Transaction</th>
                            </tr>
                            <tr>
                                <th>Treatment</th>
                                <th>Doctor</th>
                                <th>Harga</th>
                                <th>Coa</th>
                            </tr>
                            <tr>
                                <td style="display: none;">
                                    <input type="text" name="caseID" class="form-control" value="<?= $pasienDetail['Case ID']; ?>">
                                    <input type="text" name="mr" class="form-control" value="<?= $pasienDetail['PatientCode']; ?>">
                                    <input type="text" name="class" class="form-control" value="<?= $pasienDetail['Category']; ?>">
                                    <input type="text" name="refrensi" class="form-control" value="<?= $pasienDetail['LastOP']; ?>">
                                    <input type="text" name="cekidtransaksi" value="<?= $cekidtransaksi; ?>">
                                    <input type="text" name="idtransaksi" value="<?= $idtransaksi; ?>">
                                </td>
                                <td>
                                <input type="text" name="namatindakan" readonly class="form-control" id="txtCariTindakan" placeholder="Pilih Treatment" value="">
                                <input type="hidden" name="kodetindakan" class="form-control" id="txtKodeTindakan" value="">
                                </td>
                                <td>
                                <select name="dokter" class="teanganData" required data-live-search="true">
                                <option value="">-- Pilih Dokter --</option>
                                <?php foreach($dokter as $d) : ?>
                                <option value="<?= $d['DoctorID']; ?>"><?= $d['FirstName']; ?></option>
                                <?php endforeach; ?>
                                </select>
                                <input type="hidden" name="user" value="<?= $user['nama']; ?>">
                                </td>
                                <td>
                                <input type="text" name="harga" id="txtHarga" class="form-control" value="">
                                </td>
                                <td>
                                <input type="text" readonly name="coa" id="txtCoa" class="form-control" value="">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="6">
                                    <button type="submit" class="btn btn-sm btn-success">Add Treatment</button>
                                    <a href="<?= base_url('Transaction/detailTransaction/'.$pasienDetail['Case ID'].'/'.$idtransaksi) ?>" class="btn btn-sm btn-danger">Kembali</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>Transaksi ID</th>
                            <th>Treatment</th>
                            <th>Category</th>
                            <th>Harga</th>
                            <th>Doctor</th>
                            <th>~</th>
                        </tr>
                       <?php foreach($trans1 as $trx) : ?>
                            <tr>
                                <td><?= $trx['TransactionID'] ?></td>
                                <td><?= $trx['Description'] ?></td>
                                <td><?= $trx['Category'] ?></td>
                                <td><?= $trx['Charge'] ?></td>
                                <td><?= $trx['FirstName'] ?></td>
                                <td>
                                    <a href="<?= base_url('Transaction/EditTransaction/'.$trx['ID']); ?>"  class="btn btn-sm btn-primary">
                                        <i class="fa fa-fw fa-pencil"></i>
                                    </a>
                                    <a href="<?= base_url('Transaction/DeletItems/'.$trx['ID'].'/'.$trx['TransactionID']); ?>" onclick="return confirm('Apakah anda yakin ingin meng hapusitem transaksi?')"  class="btn btn-sm btn-danger">
                                        <i class="fa fa-fw fa-trash"></i>
                                    </a>
                                </td>
                              
                            </tr>
                      <?php endforeach; ?>
                    </table>
                </small>
            </div><!-- /.box-body -->
        </div>

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

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

<!-- Modal Cari Tindakan -->
<div class="modal fade" id="ModalCariTindakan" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-dialog-scrollable" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">Edit Treatment</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                
            <div class="col-ms-4">
            <select name="category" id="textCategory"" class="teanganData" required data-live-search="true">
                                <?php foreach($category as $d) : ?>
                                <option value="<?= $d['ActivityClass']; ?>"><?= $d['ActivityClass']; ?></option>
                                <?php endforeach; ?>
            </select>
            </div><br><br>
            <div class="col-ms-4">
                    <input type="text" class="form-control" id="textCaritindakan" placeholder="Ketik Nama Treatment"><br>
                </div>
                    <table class="table table-hover mt-3">
                        <thead>
                            <tr>
                                <th scope="col" width="50%">Kode Treatment</th>
                                <th scope="col" width="40%">Nama Treatment</th>
                                <th scope="col" width="40%">Harga Treatment</th>
                                <th scope="col" width="40%">COA</th>
                                <th scope="col" width="10%">Action</th>
                            </tr>
                        </thead>
                        <tbody id="ListTindakan">

                        </tbody>
                    </table>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
            </div>
        </div>
    </div>
</div>
<!-- End of Modal Cari Diagnosa -->


<!-- End of Modal Cari Diagnosa -->

