457 lines
12 KiB
HTML
457 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>SmartCane Data Validation Tool</title>
|
|
<link rel="stylesheet" href="../theme.css">
|
|
<link rel="icon" type="image/png" href="../res/check.png">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: #faf8f3;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
header {
|
|
background: linear-gradient(135deg, var(--sc-primary) 0%, var(--sc-primary-light) 100%);
|
|
color: white;
|
|
padding: 15px 20px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 20px;
|
|
}
|
|
|
|
header h1 {
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
flex: 1;
|
|
}
|
|
|
|
.container {
|
|
flex: 1;
|
|
max-width: 1200px;
|
|
margin: 30px auto;
|
|
width: 100%;
|
|
padding: 0 20px;
|
|
}
|
|
|
|
.upload-section {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.upload-card {
|
|
background: white;
|
|
padding: 25px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
border: 1px solid #e0d9d0;
|
|
}
|
|
|
|
.upload-card h2 {
|
|
font-size: 18px;
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.upload-card p {
|
|
font-size: 13px;
|
|
color: #666;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.file-icon {
|
|
font-size: 24px;
|
|
}
|
|
|
|
.file-input-wrapper {
|
|
position: relative;
|
|
display: inline-block;
|
|
width: 100%;
|
|
}
|
|
|
|
.file-input-label {
|
|
display: block;
|
|
padding: 20px;
|
|
border: 2px dashed var(--sc-primary);
|
|
border-radius: 6px;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
background: rgba(42, 171, 149, 0.05);
|
|
}
|
|
|
|
.file-input-label:hover {
|
|
border-color: var(--sc-primary-light);
|
|
background: rgba(37, 150, 190, 0.05);
|
|
}
|
|
|
|
.file-input-label small {
|
|
display: block;
|
|
font-size: 12px;
|
|
color: #999;
|
|
margin-top: 5px;
|
|
}
|
|
|
|
.file-input-wrapper input[type="file"] {
|
|
display: none;
|
|
}
|
|
|
|
.file-name {
|
|
margin-top: 10px;
|
|
font-size: 14px;
|
|
color: var(--sc-primary);
|
|
font-weight: 500;
|
|
}
|
|
|
|
.results-section {
|
|
background: white;
|
|
padding: 25px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
display: none;
|
|
max-width: 100%;
|
|
border: 1px solid #e0d9d0;
|
|
}
|
|
|
|
.results-section.show {
|
|
display: block;
|
|
}
|
|
|
|
.results-section h2 {
|
|
color: #333;
|
|
margin-bottom: 20px;
|
|
padding-bottom: 12px;
|
|
border-bottom: 2px solid var(--sc-primary);
|
|
}
|
|
|
|
.traffic-light {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 15px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.check-item {
|
|
padding: 15px;
|
|
border-radius: 6px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
font-weight: 500;
|
|
border-left: 4px solid;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.check-item.pass {
|
|
background: #d4edda;
|
|
color: #155724;
|
|
border-left-color: #28a745;
|
|
}
|
|
|
|
.check-item.warning {
|
|
background: #fff3cd;
|
|
color: #856404;
|
|
border-left-color: #ffc107;
|
|
}
|
|
|
|
.check-item.fail {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
border-left-color: #dc3545;
|
|
}
|
|
|
|
.light {
|
|
font-size: 20px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.light.green::before { content: "🟢"; }
|
|
.light.yellow::before { content: "🟡"; }
|
|
.light.red::before { content: "🔴"; }
|
|
|
|
.details-section {
|
|
margin-top: 25px;
|
|
border-top: 1px solid #e0d9d0;
|
|
padding-top: 20px;
|
|
}
|
|
|
|
.details-section h3 {
|
|
font-size: 15px;
|
|
color: #333;
|
|
margin-bottom: 12px;
|
|
padding-bottom: 8px;
|
|
border-bottom: 1px solid var(--sc-primary);
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.details-section > div:first-child h3 {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.message-box {
|
|
padding: 12px;
|
|
margin-bottom: 10px;
|
|
border-radius: 4px;
|
|
font-size: 13px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.message-box.error {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
border-left: 3px solid #dc3545;
|
|
}
|
|
|
|
.message-box.warning {
|
|
background: #fff3cd;
|
|
color: #856404;
|
|
border-left: 3px solid #ffc107;
|
|
}
|
|
|
|
.message-box.info {
|
|
background: #cfe2ff;
|
|
color: #084298;
|
|
border-left: 3px solid #0d6efd;
|
|
}
|
|
|
|
.message-box.success {
|
|
background: #d1e7dd;
|
|
color: #0f5132;
|
|
border-left: 3px solid #198754;
|
|
}
|
|
|
|
.field-list {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.field-badge {
|
|
background: #e9ecef;
|
|
padding: 8px 12px;
|
|
border-radius: 4px;
|
|
font-size: 13px;
|
|
border-left: 3px solid;
|
|
}
|
|
|
|
.field-badge.missing {
|
|
background: #fff3cd;
|
|
border-left-color: #ffc107;
|
|
color: #856404;
|
|
}
|
|
|
|
.field-badge.extra {
|
|
background: #cfe2ff;
|
|
border-left-color: #0d6efd;
|
|
color: #084298;
|
|
}
|
|
|
|
.validation-row {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.validation-item {
|
|
background: #f8f9fa;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
font-size: 13px;
|
|
border-left: 3px solid;
|
|
}
|
|
|
|
.validation-item.valid {
|
|
border-left-color: #28a745;
|
|
}
|
|
|
|
.validation-item.invalid {
|
|
border-left-color: #dc3545;
|
|
}
|
|
|
|
.match {
|
|
color: #28a745;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.mismatch {
|
|
color: #dc3545;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.missing {
|
|
color: #ffc107;
|
|
font-weight: 500;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 15px;
|
|
font-size: 13px;
|
|
}
|
|
|
|
table th {
|
|
background: var(--sc-primary);
|
|
color: white;
|
|
padding: 10px;
|
|
text-align: left;
|
|
font-weight: 600;
|
|
}
|
|
|
|
table td {
|
|
padding: 10px;
|
|
border-bottom: 1px solid #e0d9d0;
|
|
}
|
|
|
|
table tr:nth-child(even) {
|
|
background: rgba(42, 171, 149, 0.02);
|
|
}
|
|
|
|
button {
|
|
background: var(--sc-primary);
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
transition: background 0.3s ease;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
button:hover {
|
|
background: #238b7d;
|
|
}
|
|
|
|
button:disabled {
|
|
background: #ccc;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
#checkButton {
|
|
padding: 12px 40px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
width: auto;
|
|
margin: 20px auto;
|
|
display: block;
|
|
}
|
|
|
|
footer {
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
margin-top: 20px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
|
text-align: center;
|
|
font-size: 13px;
|
|
color: #666;
|
|
border: 1px solid #e0d9d0;
|
|
}
|
|
|
|
footer a {
|
|
color: var(--sc-primary);
|
|
text-decoration: none;
|
|
font-weight: 600;
|
|
}
|
|
|
|
footer a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
header {
|
|
flex-direction: column;
|
|
text-align: center;
|
|
}
|
|
|
|
header h1 {
|
|
flex: none;
|
|
}
|
|
|
|
.upload-section {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.traffic-light {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
if (sessionStorage.getItem('authenticated') !== 'true') {
|
|
window.location.href = '../login.html';
|
|
}
|
|
</script>
|
|
<header>
|
|
<button class="back-btn" onclick="window.location.href='../';" title="Back to main tools">← Back</button>
|
|
<h1>✅ Data Validation Tool</h1>
|
|
</header>
|
|
|
|
<div class="container">
|
|
<div class="upload-section">
|
|
<div class="upload-card">
|
|
<h2><span class="file-icon">📊</span>Excel File (Harvest Data)</h2>
|
|
<p>Required columns: field, sub_field, year, season_start, season_end, age, sub_area, tonnage_ha</p>
|
|
<div class="file-input-wrapper" id="excelDropZone">
|
|
<label class="file-input-label" for="excelFile">
|
|
<div>Drop your Excel file here<br><small>or click to browse</small></div>
|
|
<div class="file-name" id="excelFileName"></div>
|
|
</label>
|
|
<input type="file" id="excelFile" accept=".xlsx,.xls" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="upload-card">
|
|
<h2><span class="file-icon">🗺️</span>GeoJSON File (Field Boundaries)</h2>
|
|
<p>Required properties: field, sub_field</p>
|
|
<div class="file-input-wrapper" id="geojsonDropZone">
|
|
<label class="file-input-label" for="geojsonFile">
|
|
<div>Drop your GeoJSON file here<br><small>or click to browse</small></div>
|
|
<div class="file-name" id="geojsonFileName"></div>
|
|
</label>
|
|
<input type="file" id="geojsonFile" accept=".geojson,.json" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="text-align: center;">
|
|
<button id="checkButton" style="display: none;">✓ Check Files</button>
|
|
</div>
|
|
|
|
<div class="results-section" id="resultsSection">
|
|
<h2>Validation Results</h2>
|
|
<div class="traffic-light" id="trafficLight"></div>
|
|
<div class="details-section" id="detailsSection"></div>
|
|
</div>
|
|
|
|
<footer>
|
|
SmartCane Data Validation Tool | Learn more at <a href="https://www.smartcane.ag" target="_blank">www.smartcane.ag</a>
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/xlsx@0.18.5/dist/xlsx.full.min.js"></script>
|
|
<script src="validator.js"></script>
|
|
</body>
|
|
</html>
|