| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <?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 = 'Soil Test Analysis Report';
- $siteName = 'Crop Management Platform';
- $activeItem = 'Soil Analysis';
- 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"><!-- TODO: render breadcrumbs dynamically --></ol>
- <div class="row">
- <div class="container">
- <h3 id="forms-example">Soil Test Details</h3>
- <p class="text-muted">Complete the soil test form and submit.</p>
- <!-- Client Details Form Component -->
- <?php include __DIR__ . '/../../../components/clientDetailsForm.php'; ?>
- <!-- New Client Modal Component -->
- <?php include __DIR__ . '/../../../components/newClientModal.php'; ?>
- <form method="post" action="/controllers/soilTestSubmit.php" id="SoilcsvForm" class="needs-validation" novalidate>
- <input type="hidden" name="csrf_token" value="<?php echo generateCsrfToken(); ?>">
- <?php // Soil Analysis Form Component ?>
- <?php include __DIR__ . '/../../../components/soilAnalysisForm.php'; ?>
- <button form="SoilcsvForm" type="submit" name="SoilcsvForm" class="btn btn-success">Submit</button>
- </form>
- <hr />
- <!-- ── Lab File Import ────────────────────────────── -->
- <div class="card mb-4">
- <div class="card-header d-flex align-items-center gap-2">
- <i class="fas fa-file-excel text-success"></i>
- <h5 class="mb-0">Import from Lab File</h5>
- </div>
- <div class="card-body">
- <p class="text-muted mb-3">
- Upload a report file from your soil testing laboratory.
- Select your lab for accurate direct mapping, or choose <em>Auto-detect</em>.
- Multi-sample files can be imported all at once.
- </p>
- <div class="row g-2 align-items-end">
- <div class="col-md-3">
- <label for="lab-select" class="form-label fw-semibold">Laboratory</label>
- <select id="lab-select" class="form-select form-select-sm">
- <option value="auto">Auto-detect</option>
- <option value="csbp">CSBP</option>
- <option value="generic">Other (AI mapping)</option>
- </select>
- </div>
- <div class="col-md-6">
- <label for="lab-file-input" class="form-label fw-semibold">Select file</label>
- <input type="file"
- class="form-control form-control-sm"
- id="lab-file-input"
- accept=".xls,.xlsx,.csv,.ods">
- </div>
- <div class="col-md-3">
- <button class="btn btn-success w-100"
- type="button"
- id="lab-analyse-btn"
- disabled>
- <i class="fas fa-search me-1"></i>Analyse
- </button>
- </div>
- </div>
- <!-- Progress -->
- <div id="import-progress" class="mt-3 d-flex align-items-center gap-2 text-muted" hidden>
- <div class="spinner-border spinner-border-sm text-success" role="status"></div>
- <span class="progress-label">Processing…</span>
- </div>
- <!-- Status message -->
- <div id="import-status" class="alert mt-3" hidden></div>
- <!-- ── Bulk confirmation table ──────────────── -->
- <div id="bulk-import-panel" hidden class="mt-3">
- <div class="d-flex justify-content-between align-items-center mb-2">
- <h6 class="fw-semibold mb-0">Review & Import Samples</h6>
- <button id="bulk-import-btn" class="btn btn-success btn-sm" type="button">
- <i class="fas fa-database me-1"></i>Import Selected
- </button>
- </div>
- <p class="text-muted small mb-2">
- Edit the <strong>Paddock / Sample ID</strong> if needed, uncheck any rows to skip,
- then click <em>Import Selected</em>. Records are saved directly — no need to fill the form below.
- </p>
- <div class="table-responsive">
- <table class="table table-sm table-hover align-middle mb-0">
- <thead class="table-light">
- <tr>
- <th class="text-center" style="width:40px">
- <input type="checkbox" class="form-check-input" id="bulk-select-all" checked title="Select all">
- </th>
- <th>Lab No.</th>
- <th>Paddock / Sample ID</th>
- <th>Client</th>
- <th>Crop</th>
- <th class="text-center" style="width:50px">Form</th>
- </tr>
- </thead>
- <tbody id="bulk-import-tbody"></tbody>
- </table>
- </div>
- </div>
- <p class="text-muted small mt-3 mb-0">
- <i class="fas fa-info-circle me-1"></i>
- Fields highlighted in green were auto-populated. Always review before submitting.
- </p>
- </div>
- </div>
- <?php // include __DIR__ . '/../../../controllers/soilTestSubmit.php'; ?>
- <!-- old modX placeholders: [[!clientDetailsFORM]], [[!soilformSubmit]], [[!newClientDetails]] -->
- </div>
- </div>
- </div>
- </main>
- </div>
- </div>
- <script src="/client-assets/js/soil-import.js"></script>
- <?php include __DIR__ . '/../../../layouts/footer.php'; ?>
|