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resource Planner</title>
|
| 7 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
|
| 8 |
+
<style>
|
| 9 |
+
.phase-card {
|
| 10 |
+
transition: transform 0.2s;
|
| 11 |
+
}
|
| 12 |
+
.phase-card:hover {
|
| 13 |
+
transform: translateY(-5px);
|
| 14 |
+
}
|
| 15 |
+
.loading-spinner {
|
| 16 |
+
border: 4px solid #f3f3f3;
|
| 17 |
+
border-radius: 50%;
|
| 18 |
+
border-top: 4px solid #3498db;
|
| 19 |
+
width: 40px;
|
| 20 |
+
height: 40px;
|
| 21 |
+
animation: spin 1s linear infinite;
|
| 22 |
+
}
|
| 23 |
+
@keyframes spin {
|
| 24 |
+
0% { transform: rotate(0deg); }
|
| 25 |
+
100% { transform: rotate(360deg); }
|
| 26 |
+
}
|
| 27 |
+
.material-bar {
|
| 28 |
+
height: 24px;
|
| 29 |
+
background: linear-gradient(90deg, #3498db, #2980b9);
|
| 30 |
+
transition: width 0.5s ease-in-out;
|
| 31 |
+
}
|
| 32 |
+
.drop-zone {
|
| 33 |
+
border: 2px dashed #ccc;
|
| 34 |
+
border-radius: 8px;
|
| 35 |
+
padding: 20px;
|
| 36 |
+
text-align: center;
|
| 37 |
+
transition: border-color 0.3s ease;
|
| 38 |
+
}
|
| 39 |
+
.drop-zone.dragover {
|
| 40 |
+
border-color: #3498db;
|
| 41 |
+
background-color: rgba(52, 152, 219, 0.1);
|
| 42 |
+
}
|
| 43 |
+
.tab-active {
|
| 44 |
+
border-bottom: 2px solid #3498db;
|
| 45 |
+
color: #3498db;
|
| 46 |
+
}
|
| 47 |
+
</style>
|
| 48 |
+
</head>
|
| 49 |
+
<body class="bg-gray-50">
|
| 50 |
+
<nav class="bg-white shadow-lg">
|
| 51 |
+
<div class="max-w-7xl mx-auto px-4">
|
| 52 |
+
<div class="flex justify-between h-16">
|
| 53 |
+
<div class="flex items-center">
|
| 54 |
+
<img src="/api/placeholder/32/32" alt="Logo" class="h-8 w-8">
|
| 55 |
+
<span class="ml-2 text-xl font-semibold">Construction Resource Planner</span>
|
| 56 |
+
</div>
|
| 57 |
+
<div class="flex items-center space-x-4">
|
| 58 |
+
<button id="helpBtn" class="text-gray-600 hover:text-gray-900">
|
| 59 |
+
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
| 60 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
| 61 |
+
</svg>
|
| 62 |
+
</button>
|
| 63 |
+
<div class="relative">
|
| 64 |
+
<img src="/api/placeholder/32/32" alt="User" class="h-8 w-8 rounded-full">
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
</nav>
|
| 70 |
+
|
| 71 |
+
<main class="max-w-7xl mx-auto px-4 py-8">
|
| 72 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 73 |
+
<!-- Project Input Section -->
|
| 74 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 75 |
+
<h2 class="text-2xl font-semibold mb-6">Project Details</h2>
|
| 76 |
+
<form id="projectForm" class="space-y-6">
|
| 77 |
+
<div>
|
| 78 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">
|
| 79 |
+
Construction Type
|
| 80 |
+
</label>
|
| 81 |
+
<input type="text" id="constructionType" required
|
| 82 |
+
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 83 |
+
</div>
|
| 84 |
+
|
| 85 |
+
<div>
|
| 86 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">
|
| 87 |
+
Number of Phases
|
| 88 |
+
</label>
|
| 89 |
+
<input type="number" id="phaseCount" min="1" required
|
| 90 |
+
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
<div>
|
| 94 |
+
<label class="block text-sm font-medium text-gray-700 mb-2">
|
| 95 |
+
Project Description
|
| 96 |
+
</label>
|
| 97 |
+
<textarea id="description" rows="4" required
|
| 98 |
+
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
<div class="drop-zone" id="dropZone">
|
| 102 |
+
<div class="mb-4">
|
| 103 |
+
<svg class="mx-auto h-12 w-12 text-gray-400" stroke="currentColor" fill="none" viewBox="0 0 48 48">
|
| 104 |
+
<path d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
| 105 |
+
</svg>
|
| 106 |
+
<div class="text-sm text-gray-600">
|
| 107 |
+
<label class="relative cursor-pointer bg-white rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-blue-500">
|
| 108 |
+
<span>Upload construction drawing</span>
|
| 109 |
+
<input id="fileInput" type="file" class="sr-only" accept="image/*">
|
| 110 |
+
</label>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
<div id="preview" class="hidden mt-4">
|
| 114 |
+
<img id="imagePreview" class="max-w-full h-auto rounded-lg" alt="Preview">
|
| 115 |
+
</div>
|
| 116 |
+
</div>
|
| 117 |
+
|
| 118 |
+
<button type="submit" id="analyzeBtn"
|
| 119 |
+
class="w-full bg-blue-600 text-white py-3 px-4 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors">
|
| 120 |
+
Analyze Project
|
| 121 |
+
</button>
|
| 122 |
+
</form>
|
| 123 |
+
</div>
|
| 124 |
+
|
| 125 |
+
<!-- Results Section -->
|
| 126 |
+
<div class="bg-white rounded-lg shadow-md p-6">
|
| 127 |
+
<div class="flex justify-between items-center mb-6">
|
| 128 |
+
<h2 class="text-2xl font-semibold">Analysis Results</h2>
|
| 129 |
+
<div class="flex space-x-4">
|
| 130 |
+
<button id="exportBtn" class="text-blue-600 hover:text-blue-700 hidden">
|
| 131 |
+
Export Report
|
| 132 |
+
</button>
|
| 133 |
+
</div>
|
| 134 |
+
</div>
|
| 135 |
+
|
| 136 |
+
<div id="loadingState" class="hidden flex flex-col items-center justify-center py-12">
|
| 137 |
+
<div class="loading-spinner mb-4"></div>
|
| 138 |
+
<p class="text-gray-600">Analyzing project details...</p>
|
| 139 |
+
</div>
|
| 140 |
+
|
| 141 |
+
<div id="results" class="hidden space-y-6">
|
| 142 |
+
<div class="flex space-x-4 border-b">
|
| 143 |
+
<button class="tab-active px-4 py-2">Resources</button>
|
| 144 |
+
<button class="px-4 py-2">Timeline</button>
|
| 145 |
+
<button class="px-4 py-2">Dependencies</button>
|
| 146 |
+
</div>
|
| 147 |
+
|
| 148 |
+
<div id="phasesContainer" class="space-y-4">
|
| 149 |
+
<!-- Phases will be dynamically inserted here -->
|
| 150 |
+
</div>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
</main>
|
| 155 |
+
|
| 156 |
+
<script>
|
| 157 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 158 |
+
const dropZone = document.getElementById('dropZone');
|
| 159 |
+
const fileInput = document.getElementById('fileInput');
|
| 160 |
+
const preview = document.getElementById('preview');
|
| 161 |
+
const imagePreview = document.getElementById('imagePreview');
|
| 162 |
+
const projectForm = document.getElementById('projectForm');
|
| 163 |
+
const loadingState = document.getElementById('loadingState');
|
| 164 |
+
const results = document.getElementById('results');
|
| 165 |
+
const exportBtn = document.getElementById('exportBtn');
|
| 166 |
+
const phasesContainer = document.getElementById('phasesContainer');
|
| 167 |
+
|
| 168 |
+
// File upload handling
|
| 169 |
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
| 170 |
+
dropZone.addEventListener(eventName, preventDefaults, false);
|
| 171 |
+
});
|
| 172 |
+
|
| 173 |
+
function preventDefaults(e) {
|
| 174 |
+
e.preventDefault();
|
| 175 |
+
e.stopPropagation();
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
['dragenter', 'dragover'].forEach(eventName => {
|
| 179 |
+
dropZone.addEventListener(eventName, highlight, false);
|
| 180 |
+
});
|
| 181 |
+
|
| 182 |
+
['dragleave', 'drop'].forEach(eventName => {
|
| 183 |
+
dropZone.addEventListener(eventName, unhighlight, false);
|
| 184 |
+
});
|
| 185 |
+
|
| 186 |
+
function highlight(e) {
|
| 187 |
+
dropZone.classList.add('dragover');
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
function unhighlight(e) {
|
| 191 |
+
dropZone.classList.remove('dragover');
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
dropZone.addEventListener('drop', handleDrop, false);
|
| 195 |
+
|
| 196 |
+
function handleDrop(e) {
|
| 197 |
+
const dt = e.dataTransfer;
|
| 198 |
+
const files = dt.files;
|
| 199 |
+
handleFiles(files);
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
fileInput.addEventListener('change', function() {
|
| 203 |
+
handleFiles(this.files);
|
| 204 |
+
});
|
| 205 |
+
|
| 206 |
+
function handleFiles(files) {
|
| 207 |
+
if (files.length > 0) {
|
| 208 |
+
const file = files[0];
|
| 209 |
+
if (file.type.startsWith('image/')) {
|
| 210 |
+
const reader = new FileReader();
|
| 211 |
+
reader.onload = function(e) {
|
| 212 |
+
preview.classList.remove('hidden');
|
| 213 |
+
imagePreview.src = e.target.result;
|
| 214 |
+
}
|
| 215 |
+
reader.readAsDataURL(file);
|
| 216 |
+
}
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
// Form submission
|
| 221 |
+
projectForm.addEventListener('submit', async function(e) {
|
| 222 |
+
e.preventDefault();
|
| 223 |
+
|
| 224 |
+
loadingState.classList.remove('hidden');
|
| 225 |
+
results.classList.add('hidden');
|
| 226 |
+
|
| 227 |
+
// Simulate API call
|
| 228 |
+
setTimeout(() => {
|
| 229 |
+
loadingState.classList.add('hidden');
|
| 230 |
+
results.classList.remove('hidden');
|
| 231 |
+
exportBtn.classList.remove('hidden');
|
| 232 |
+
|
| 233 |
+
// Example phase data
|
| 234 |
+
const phases = [
|
| 235 |
+
{
|
| 236 |
+
phase: 1,
|
| 237 |
+
materials: {
|
| 238 |
+
'Concrete': { quantity: 1500, unit: 'cubic_meters' },
|
| 239 |
+
'Steel': { quantity: 250, unit: 'tons' }
|
| 240 |
+
},
|
| 241 |
+
timeline: '3 months',
|
| 242 |
+
dependencies: ['Site preparation', 'Foundation work']
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
phase: 2,
|
| 246 |
+
materials: {
|
| 247 |
+
'Glass': { quantity: 800, unit: 'square_meters' },
|
| 248 |
+
'Aluminum': { quantity: 120, unit: 'tons' }
|
| 249 |
+
},
|
| 250 |
+
timeline: '2 months',
|
| 251 |
+
dependencies: ['Phase 1 completion', 'Material delivery']
|
| 252 |
+
}
|
| 253 |
+
];
|
| 254 |
+
|
| 255 |
+
renderPhases(phases);
|
| 256 |
+
}, 2000);
|
| 257 |
+
});
|
| 258 |
+
|
| 259 |
+
function renderPhases(phases) {
|
| 260 |
+
phasesContainer.innerHTML = '';
|
| 261 |
+
phases.forEach(phase => {
|
| 262 |
+
const phaseCard = document.createElement('div');
|
| 263 |
+
phaseCard.className = 'phase-card bg-gray-50 rounded-lg p-6';
|
| 264 |
+
|
| 265 |
+
let materialsHtml = '';
|
| 266 |
+
Object.entries(phase.materials).forEach(([material, info]) => {
|
| 267 |
+
materialsHtml += `
|
| 268 |
+
<div class="mb-4">
|
| 269 |
+
<div class="flex justify-between mb-2">
|
| 270 |
+
<span>${material}</span>
|
| 271 |
+
<span>${info.quantity} ${info.unit}</span>
|
| 272 |
+
</div>
|
| 273 |
+
<div class="bg-gray-200 rounded-full">
|
| 274 |
+
<div class="material-bar rounded-full" style="width: ${Math.min(info.quantity/20, 100)}%"></div>
|
| 275 |
+
</div>
|
| 276 |
+
</div>
|
| 277 |
+
`;
|
| 278 |
+
});
|
| 279 |
+
|
| 280 |
+
phaseCard.innerHTML = `
|
| 281 |
+
<h3 class="text-xl font-semibold mb-4">Phase ${phase.phase}</h3>
|
| 282 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 283 |
+
<div>
|
| 284 |
+
<h4 class="font-medium mb-3">Materials Required</h4>
|
| 285 |
+
${materialsHtml}
|
| 286 |
+
</div>
|
| 287 |
+
<div>
|
| 288 |
+
<h4 class="font-medium mb-3">Timeline & Dependencies</h4>
|
| 289 |
+
<p class="mb-2">Duration: ${phase.timeline}</p>
|
| 290 |
+
<ul class="list-disc list-inside">
|
| 291 |
+
${phase.dependencies.map(dep => `<li>${dep}</li>`).join('')}
|
| 292 |
+
</ul>
|
| 293 |
+
</div>
|
| 294 |
+
</div>
|
| 295 |
+
`;
|
| 296 |
+
|
| 297 |
+
phasesContainer.appendChild(phaseCard);
|
| 298 |
+
});
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
// Export functionality
|
| 302 |
+
exportBtn.addEventListener('click', function() {
|
| 303 |
+
// Implement export logic here
|
| 304 |
+
alert('Generating report...');
|
| 305 |
+
});
|
| 306 |
+
});
|
| 307 |
+
</script>
|
| 308 |
+
</body>
|
| 309 |
+
</html>
|