<?php
require_once __DIR__ . '/../../../config/database.php';
require_once __DIR__ . '/../../../lib/auth.php';
require_once __DIR__ . '/../../../lib/csrf.php';

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

requireLogin();

$pageTitle = 'Compost Test Analysis';
$siteName  = 'Crop Monitor';

include __DIR__ . '/../../../layouts/header.php';
include __DIR__ . '/../../../layouts/navbar.php';
?>

<div id="layoutSidenav">
    <div id="layoutSidenav_nav">
        <?php include __DIR__ . '/../../../layouts/sidebar.php'; ?>
    </div>
    <div id="layoutSidenav_content">
        <main>
            <div class="container-fluid px-4">
                <h1 class="mt-4"><?= htmlspecialchars($pageTitle, ENT_QUOTES, 'UTF-8') ?></h1>
                <ol class="breadcrumb mb-4">
                    <li class="breadcrumb-item"><a href="/dashboard/dashboard.php">Dashboard</a></li>
                    <li class="breadcrumb-item active">Compost Test Analysis</li>
                </ol>

                <div class="row">
                    <div class="container">
                        <h3>Compost Test Details</h3>
                        <span class="text-danger small">* required fields.</span>

                        <?php include __DIR__ . '/../../../components/clientDetailsForm.php'; ?>
                        <?php include __DIR__ . '/../../../components/newClientModal.php'; ?>

                        <form method="post" action="/controllers/compostTestSubmit.php" id="compostForm">
                            <input type="hidden" name="csrf_token" value="<?= htmlspecialchars(generateCsrfToken(), ENT_QUOTES, 'UTF-8') ?>">

                            <div class="alert alert-info mt-3">
                                <i class="fas fa-info-circle me-1"></i>
                                Compost analysis form — pending full field migration.
                                Contact your administrator for the current compost test spreadsheet.
                            </div>

                            <button type="submit" class="btn btn-success mt-2">Submit</button>
                        </form>

                    </div>
                </div>
            </div>
        </main>

        <?php include __DIR__ . '/../../../layouts/footer.php'; ?>
    </div>
</div>
