<?= $this->extend('owner/layout/main') ?>

<?= $this->section('content') ?>

<div class="card">

    <div class="card-header">

        <h4>Harga Custom Barang</h4>

    </div>

    <div class="card-body">

        <form method="post" action="<?= base_url('owner/product-custom/store') ?>">

            <input type="hidden" name="id_product" value="<?= $id_product ?>">

            <div class="mb-3">

                <label>Nama Custom</label>

                <input type="text"
                       class="form-control"
                       name="custom_name"
                       required>

            </div>

            <div class="mb-3">

                <label>Harga Tambahan</label>

                <input type="number"
                       class="form-control"
                       name="additional_price"
                       required>

            </div>

            <button class="btn btn-primary">

                Simpan

            </button>

        </form>

        <hr>

        <table class="table table-bordered">

            <thead>

                <tr>

                    <th>No</th>

                    <th>Custom</th>

                    <th>Harga Tambahan</th>

                    <th>Aksi</th>

                </tr>

            </thead>

            <tbody>

                <?php $no=1; foreach($customs as $c): ?>

                <tr>

                    <td><?= $no++ ?></td>

                    <td><?= $c['custom_name'] ?></td>

                    <td>Rp <?= number_format($c['additional_price']) ?></td>

                    <td>

                        <a href="<?= base_url('owner/product-custom/delete/'.$c['id']) ?>"
                           onclick="return confirm('Hapus?')"
                           class="btn btn-danger btn-sm">

                            Hapus

                        </a>

                    </td>

                </tr>

                <?php endforeach ?>

            </tbody>

        </table>

    </div>

</div>

<?= $this->endSection() ?>