<div class="modal-detail">
    <div class="card shadow-sm p-3">
        <div class="card-header bg-white py-3">
            <div class="row">
                <div class="col">
                    <table class="table w-100 dt-responsive nowrap">
                        <tbody>
                            <tr>
                                <td width="30%">
                                    Id Barang Masuk
                                </td>
                                <td>
                                    <?= $brg['id_barang_masuk'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Tanggal
                                </td>
                                <td>
                                    <?= $brg['tanggal_masuk'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Nama User Pemilik
                                </td>
                                <td>
                                    <?= $brg['nm_user_pemilik'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Nama Cabang
                                </td>
                                <td>
                                    <?= $brg['nama_cabang'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Petugas Gudang
                                </td>
                                <td>
                                    <?= $brg['nm_user'] ?>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="table-responsive">
            <table class="table table-striped w-100 dt-responsive nowrap" id="dataTable">
                <thead>
                    <tr>
                        <th>No. </th>
                        <th>ID Barang</th>
                        <th>Nama Barang</th>
                        <th>Stok</th>
                        <th>Merk</th>
                        <th>Spesifikasi</th>
                        <th>Barcode</th>
                        <th>Serial Number</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $no = 1;
                    $total_bm = 0;
                    if ($d_brg) :
                        foreach ($d_brg as $b) :
                    ?>
                            <tr>
                                <td><?= $no++; ?></td>
                                <td><?= $b['id_barang']; ?></td>
                                <td><?= $b['nama_barang']; ?></td>
                                <td><?= $b['jumlah'] . ' ' . $b['nama_satuan']; ?></td>
                                <td><?= $b['merk']; ?></td>
                                <td><?= $b['spesifikasi']; ?></td>
                                <td><?= $b['barcode']; ?></td>
                                <td><?= $b['sn']; ?></td>
                            </tr>
                        <?php 
                                $total_bm += $b['jumlah'];
                            endforeach; ?>
                    <?php else : ?>
                        <tr>
                            <td colspan="8" class="text-center">
                                Data Kosong
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="3" class="text-right">Total Pembelian</td>
                        <td><?= $total_bm; ?></td>
                    </tr>
                </tfoot>
            </table>
        </div>

        <div class="row">
            <div class="col">
                <table class="table w-100 dt-responsive nowrap">
                    <tbody>
                        <tr>
                            <td width="30%">
                                Status
                            </td>
                            <td>
                                <?= $brg['stts_perolehan'] ?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Movement
                            </td>
                            <td>
                                <?= $brg['stts_penggunaan'] ?>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Keterangan
                            </td>
                            <td>
                                <?= $brg['ket'] ?>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        
        </div>
    </div>
</div>
<div class="modal-footer">
    <?php if($dt_user['nama'] == $brg['nm_user']) { ?>
        <a href="<?= base_url('barangmasuk/edit/') . $brg['id_barang_masuk'] ?>" class="btn btn-warning btn-circle"><i class="fa fa-pen"></i></a>
        <a onclick="return confirm('Yakin ingin hapus?')" href="<?= base_url('barangmasuk/delete/') . $brg['id_barang_masuk'] ?>" class="btn btn-danger btn-circle"><i class="fa fa-trash"></i></a>
    <?php } ?>
    <a href="<?= base_url('barangmasuk/cetak_bmasuk/'.$brg['id_barang_masuk'])?>" type="button" target="_blank" class="btn btn-primary"><i class="fa fa-print"></i> Cetak</a>
    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>