<?php
$page_title = 'Warehouse Online';
require_once('includes/load.php');
page_require_level(1);

// Proses penambahan produk
if (isset($_POST['add_product'])) {
    // Logika penambahan produk
}

// Proses ekspor data
if (isset($_POST['export'])) {
    // Logika ekspor data
}

// Proses penghapusan produk
if (isset($_POST['delete_product'])) {
    // Logika penghapusan produk
}

// Ambil semua data dari tabel warehouse_online
$all_products = find_all('warehouse_online');
?>

<?php include_once('layouts/header.php'); ?>

<div class="row">
    <div class="col-md-12">
        <?php echo display_msg($msg); ?>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading clearfix">
                <div class="pull-left">
                    <a href="#" class="btn btn-primary">Add New</a>
                </div>
                <div class="pull-right">
                    <form method="post" action="warehouse_online.php">
                        <button type="submit" name="export" class="btn btn-success">Export</button>
                    </form>
                </div>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th class="text-center">#</th>
                                <th>Part Number</th>
                                <th>Product</th>
                                <th class="text-center">Categories</th>
                                <th class="text-center">In-Stock</th>
                                <th class="text-center">UoM</th>
                                <th class="text-center">Buy Price</th>
                                <th class="text-center">Location ID</th>
                                <th class="text-center">Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php foreach ($all_products as $product) : ?>
                                <tr>
                                    <!-- Tampilkan data produk di sini -->
                                </tr>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<?php include_once('layouts/footer.php'); ?>
