397 lines
11 KiB
HTML
397 lines
11 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>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
header {
|
|
background: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
margin-bottom: 20px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
text-align: center;
|
|
}
|
|
|
|
h1 {
|
|
color: #333;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.subtitle {
|
|
color: #666;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.upload-section {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.upload-card {
|
|
background: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.upload-card h2 {
|
|
font-size: 18px;
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.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 #667eea;
|
|
border-radius: 6px;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
background: #f8f9ff;
|
|
}
|
|
|
|
.file-input-label:hover {
|
|
border-color: #764ba2;
|
|
background: #f0f1ff;
|
|
}
|
|
|
|
.file-input-wrapper input[type="file"] {
|
|
display: none;
|
|
}
|
|
|
|
.file-name {
|
|
margin-top: 10px;
|
|
font-size: 14px;
|
|
color: #667eea;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.results-section {
|
|
background: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
display: none;
|
|
max-width: 100%;
|
|
}
|
|
|
|
.results-section.show {
|
|
display: block;
|
|
}
|
|
|
|
.results-section h2 {
|
|
color: #333;
|
|
margin-bottom: 25px;
|
|
padding-bottom: 15px;
|
|
border-bottom: 3px solid #667eea;
|
|
}
|
|
|
|
.traffic-light {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 15px;
|
|
margin-bottom: 30px;
|
|
}
|
|
|
|
.check-item {
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
font-weight: 500;
|
|
border-left: 4px solid;
|
|
}
|
|
|
|
.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: 24px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.light.green::before { content: "🟢"; }
|
|
.light.yellow::before { content: "🟡"; }
|
|
.light.red::before { content: "🔴"; }
|
|
|
|
.details-section {
|
|
margin-top: 30px;
|
|
border-top: 1px solid #eee;
|
|
padding-top: 20px;
|
|
}
|
|
|
|
.details-section h3 {
|
|
font-size: 16px;
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
padding-bottom: 10px;
|
|
border-bottom: 2px solid #667eea;
|
|
margin-top: 25px;
|
|
}
|
|
|
|
.details-section > div:first-child h3 {
|
|
margin-top: 0;
|
|
}
|
|
|
|
.message-box {
|
|
padding: 15px;
|
|
margin-bottom: 15px;
|
|
border-radius: 6px;
|
|
font-size: 14px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.message-box.error {
|
|
background: #f8d7da;
|
|
color: #721c24;
|
|
border-left: 4px solid #dc3545;
|
|
}
|
|
|
|
.message-box.warning {
|
|
background: #fff3cd;
|
|
color: #856404;
|
|
border-left: 4px solid #ffc107;
|
|
}
|
|
|
|
.message-box.info {
|
|
background: #d1ecf1;
|
|
color: #0c5460;
|
|
border-left: 4px solid #17a2b8;
|
|
}
|
|
|
|
.message-box.success {
|
|
background: #d4edda;
|
|
color: #155724;
|
|
border-left: 4px solid #28a745;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 15px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
th {
|
|
background: #667eea;
|
|
color: white;
|
|
padding: 12px;
|
|
text-align: left;
|
|
font-weight: 600;
|
|
}
|
|
|
|
td {
|
|
padding: 10px 12px;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
tr:hover {
|
|
background: #f8f9ff;
|
|
}
|
|
|
|
.match {
|
|
color: #28a745;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.mismatch {
|
|
color: #dc3545;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.missing {
|
|
color: #ffc107;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.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: #d1ecf1;
|
|
border-left-color: #17a2b8;
|
|
color: #0c5460;
|
|
}
|
|
|
|
.validation-row {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.validation-item {
|
|
background: #f8f9ff;
|
|
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;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.upload-section {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.traffic-light {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
|
|
footer {
|
|
background: white;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
margin-top: 20px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
text-align: center;
|
|
font-size: 13px;
|
|
color: #666;
|
|
}
|
|
|
|
footer a {
|
|
color: #667eea;
|
|
text-decoration: none;
|
|
font-weight: 600;
|
|
}
|
|
|
|
footer a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header>
|
|
<h1>🌾 SmartCane Data Validation Tool</h1>
|
|
<p class="subtitle">Validate your Excel and GeoJSON files before uploading to the system</p>
|
|
</header>
|
|
|
|
<div class="upload-section">
|
|
<div class="upload-card">
|
|
<h2><span class="file-icon">📊</span>Excel File (Harvest Data)</h2>
|
|
<p style="font-size: 13px; color: #666; margin-bottom: 15px;">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 style="font-size: 13px; color: #666; margin-bottom: 15px;">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; margin-bottom: 20px;">
|
|
<button id="checkButton" style="padding: 12px 40px; font-size: 16px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; display: none;">
|
|
✓ Check Files
|
|
</button>
|
|
</div>
|
|
|
|
<div class="results-section" id="resultsSection">
|
|
<h2 style="margin-bottom: 20px; color: #333;">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>
|