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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>AI Coach for Site Supervisors</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/heroicons/2.1.1/outline/index.min.css" rel="stylesheet">
|
9 |
+
<style>
|
10 |
+
body {
|
11 |
+
font-family: 'Inter', sans-serif;
|
12 |
+
}
|
13 |
+
.checklist-item {
|
14 |
+
transition: background-color 0.3s ease, transform 0.2s ease;
|
15 |
+
}
|
16 |
+
.checklist-item.completed {
|
17 |
+
background-color: #ecfdf5;
|
18 |
+
transform: scale(1.02);
|
19 |
+
}
|
20 |
+
.checklist-item:hover {
|
21 |
+
transform: scale(1.02);
|
22 |
+
}
|
23 |
+
.tip-card {
|
24 |
+
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
25 |
+
}
|
26 |
+
.tip-card:hover {
|
27 |
+
transform: translateY(-5px);
|
28 |
+
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
|
29 |
+
}
|
30 |
+
.fade-in {
|
31 |
+
animation: fadeIn 0.5s ease-in-out;
|
32 |
+
}
|
33 |
+
@keyframes fadeIn {
|
34 |
+
from { opacity: 0; transform: translateY(10px); }
|
35 |
+
to { opacity: 1; transform: translateY(0); }
|
36 |
+
}
|
37 |
+
.gradient-header {
|
38 |
+
background: linear-gradient(135deg, #3b82f6, #1d4ed8);
|
39 |
+
}
|
40 |
+
.spinner {
|
41 |
+
border: 4px solid #f3f3f3;
|
42 |
+
border-top: 4px solid #3b82f6;
|
43 |
+
border-radius: 50%;
|
44 |
+
width: 24px;
|
45 |
+
height: 24px;
|
46 |
+
animation: spin 1s linear infinite;
|
47 |
+
display: none;
|
48 |
+
}
|
49 |
+
@keyframes spin {
|
50 |
+
0% { transform: rotate(0deg); }
|
51 |
+
100% { transform: rotate(360deg); }
|
52 |
+
}
|
53 |
+
</style>
|
54 |
+
</head>
|
55 |
+
<body class="bg-gray-50 min-h-screen flex flex-col">
|
56 |
+
<!-- Header -->
|
57 |
+
<header class="gradient-header text-white p-6 shadow-lg">
|
58 |
+
<h1 class="text-3xl font-bold tracking-tight flex items-center">
|
59 |
+
<svg class="w-8 h-8 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
60 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
61 |
+
</svg>
|
62 |
+
AI Coach for Supervisors
|
63 |
+
</h1>
|
64 |
+
<p class="mt-1 text-sm opacity-80">Your daily guide to success</p>
|
65 |
+
</header>
|
66 |
+
|
67 |
+
<!-- Main Content -->
|
68 |
+
<main class="flex-1 p-6 space-y-8 max-w-3xl mx-auto">
|
69 |
+
<!-- Supervisor Input Form -->
|
70 |
+
<section class="bg-white rounded-xl shadow-md p-6 fade-in">
|
71 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
|
72 |
+
<svg class="w-6 h-6 mr-2 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
73 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
|
74 |
+
</svg>
|
75 |
+
Supervisor Details
|
76 |
+
</h2>
|
77 |
+
<div class="space-y-4">
|
78 |
+
<div>
|
79 |
+
<label class="block text-gray-700 font-medium mb-1">Role</label>
|
80 |
+
<input id="role" type="text" value="Site Supervisor" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-400 focus:border-transparent" placeholder="e.g., Site Supervisor">
|
81 |
+
</div>
|
82 |
+
<div>
|
83 |
+
<label class="block text-gray-700 font-medium mb-1">Location</label>
|
84 |
+
<input id="location" type="text" value="Construction Site A" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-400 focus:border-transparent" placeholder="e.g., Construction Site A">
|
85 |
+
</div>
|
86 |
+
<div>
|
87 |
+
<label class="block text-gray-700 font-medium mb-1">Project Schedule (JSON)</label>
|
88 |
+
<textarea id="schedule" class="w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-400 focus:border-transparent" rows="3" placeholder='e.g., [{"task": "Foundation Inspection", "due_date": "2025-05-07", "status": "Pending"}]'>[{"task": "Foundation Inspection", "due_date": "2025-05-07", "status": "Pending"}, {"task": "Material Delivery", "due_date": "2025-05-06", "status": "Delayed"}]</textarea>
|
89 |
+
</div>
|
90 |
+
<button id="loadData" class="w-full bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors duration-200 flex items-center justify-center">
|
91 |
+
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
92 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9H20m-7 7v5h-.582m-7.356-2A8.001 8.001 0 0119.418 15H4"></path>
|
93 |
+
</svg>
|
94 |
+
Load Coaching Data
|
95 |
+
<div id="spinner" class="spinner ml-2"></div>
|
96 |
+
</button>
|
97 |
+
</div>
|
98 |
+
</section>
|
99 |
+
|
100 |
+
<!-- Alerts (Placeholder) -->
|
101 |
+
<section id="alerts" class="bg-red-50 rounded-xl shadow-md p-6 fade-in hidden">
|
102 |
+
<h2 class="text-2xl font-semibold text-red-800 mb-4 flex items-center">
|
103 |
+
<svg class="w-6 h-6 mr-2 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
104 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
105 |
+
</svg>
|
106 |
+
Alerts
|
107 |
+
</h2>
|
108 |
+
<p class="text-red-700">No alerts at this time. (Placeholder for missed milestones or unsafe patterns)</p>
|
109 |
+
</section>
|
110 |
+
|
111 |
+
<!-- Checklist -->
|
112 |
+
<section id="checklistSection" class="bg-white rounded-xl shadow-md p-6 fade-in hidden">
|
113 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
|
114 |
+
<svg class="w-6 h-6 mr-2 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
115 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
116 |
+
</svg>
|
117 |
+
Daily Checklist
|
118 |
+
</h2>
|
119 |
+
<ul id="checklist" class="space-y-3"></ul>
|
120 |
+
</section>
|
121 |
+
|
122 |
+
<!-- Tips -->
|
123 |
+
<section id="tipsSection" class="bg-white rounded-xl shadow-md p-6 fade-in hidden">
|
124 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
|
125 |
+
<svg class="w-6 h-6 mr-2 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
126 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
|
127 |
+
</svg>
|
128 |
+
Today's Top 3 Focus Areas
|
129 |
+
</h2>
|
130 |
+
<ul id="tips" class="space-y-3"></ul>
|
131 |
+
</section>
|
132 |
+
|
133 |
+
<!-- Quote -->
|
134 |
+
<section id="quoteSection" class="bg-white rounded-xl shadow-md p-6 fade-in hidden">
|
135 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
|
136 |
+
<svg class="w-6 h-6 mr-2 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
137 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z"></path>
|
138 |
+
</svg>
|
139 |
+
Motivational Quote
|
140 |
+
</h2>
|
141 |
+
<p id="quote" class="italic text-gray-600 text-lg"></p>
|
142 |
+
</section>
|
143 |
+
|
144 |
+
<!-- Reflection Journal -->
|
145 |
+
<section class="bg-white rounded-xl shadow-md p-6 fade-in">
|
146 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
|
147 |
+
<svg class="w-6 h-6 mr-2 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
148 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path>
|
149 |
+
</svg>
|
150 |
+
Reflection Journal
|
151 |
+
</h2>
|
152 |
+
<textarea id="reflection" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-400 focus:border-transparent" rows="4" placeholder="Log your thoughts or observations..."></textarea>
|
153 |
+
<button id="saveReflection" class="mt-3 w-full bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors duration-200">Save Reflection</button>
|
154 |
+
</section>
|
155 |
+
|
156 |
+
<!-- Engagement Score -->
|
157 |
+
<section class="bg-white rounded-xl shadow-md p-6 fade-in">
|
158 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
|
159 |
+
<svg class="w-6 h-6 mr-2 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
160 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 012-2h2a2 2 0 012 2v12a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path>
|
161 |
+
</svg>
|
162 |
+
Engagement Score
|
163 |
+
</h2>
|
164 |
+
<p class="text-gray-600 mb-3">Weekly trend (Placeholder)</p>
|
165 |
+
<div class="h-40 bg-gray-100 rounded-lg flex items-center justify-center">
|
166 |
+
<svg width="100%" height="100" class="max-w-full">
|
167 |
+
<polyline points="10,90 30,70 50,80 70,50 90,60 110,40 130,60" fill="none" stroke="#3b82f6" stroke-width="2"/>
|
168 |
+
<text x="10" y="20" fill="#4b5563" font-size="12">Engagement: 85%</text>
|
169 |
+
<line x1="10" y1="90" x2="130" y2="90" stroke="#d1d5db" stroke-width="1"/>
|
170 |
+
<line x1="10" y1="90" x2="10" y2="30" stroke="#d1d5db" stroke-width="1"/>
|
171 |
+
</svg>
|
172 |
+
</div>
|
173 |
+
</section>
|
174 |
+
|
175 |
+
<!-- PDF Download -->
|
176 |
+
<section class="bg-white rounded-xl shadow-md p-6 fade-in">
|
177 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
|
178 |
+
<svg class="w-6 h-6 mr-2 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
179 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
|
180 |
+
</svg>
|
181 |
+
Summary Report
|
182 |
+
</h2>
|
183 |
+
<button id="downloadPdf" class="w-full bg-green-600 text-white px-4 py-2 rounded-lg hover:bg-green-700 transition-colors duration-200">Download PDF Summary</button>
|
184 |
+
</section>
|
185 |
+
</main>
|
186 |
+
|
187 |
+
<script>
|
188 |
+
// Default supervisor data
|
189 |
+
let supervisorData = {
|
190 |
+
supervisor_id: "SUP123",
|
191 |
+
role: "Site Supervisor",
|
192 |
+
project_id: "PRJ456",
|
193 |
+
milestones: [
|
194 |
+
{ task: "Foundation Inspection", due_date: "2025-05-07", status: "Pending" },
|
195 |
+
{ task: "Material Delivery", due_date: "2025-05-06", status: "Delayed" }
|
196 |
+
],
|
197 |
+
reflection_log: "Noticed delays due to rain; team morale is low.",
|
198 |
+
weather: "Rainy, 20°C"
|
199 |
+
};
|
200 |
+
|
201 |
+
async function fetchCoachingOutput() {
|
202 |
+
const spinner = document.getElementById('spinner');
|
203 |
+
spinner.style.display = 'block';
|
204 |
+
try {
|
205 |
+
const response = await fetch('/generate', {
|
206 |
+
method: 'POST',
|
207 |
+
headers: { 'Content-Type': 'application/json' },
|
208 |
+
body: JSON.stringify(supervisorData)
|
209 |
+
});
|
210 |
+
const result = await response.json();
|
211 |
+
if (result.status === 'success') {
|
212 |
+
updateUI(result.output);
|
213 |
+
} else {
|
214 |
+
alert('Error: ' + result.message);
|
215 |
+
}
|
216 |
+
} catch (error) {
|
217 |
+
alert('Failed to fetch coaching output: ' + error.message);
|
218 |
+
} finally {
|
219 |
+
spinner.style.display = 'none';
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
function updateUI(output) {
|
224 |
+
// Show sections
|
225 |
+
document.getElementById('checklistSection').classList.remove('hidden');
|
226 |
+
document.getElementById('tipsSection').classList.remove('hidden');
|
227 |
+
document.getElementById('quoteSection').classList.remove('hidden');
|
228 |
+
|
229 |
+
// Checklist
|
230 |
+
const checklist = document.getElementById('checklist');
|
231 |
+
checklist.innerHTML = output.checklist.map(item => `
|
232 |
+
<li class="checklist-item flex items-center p-3 bg-gray-50 rounded-lg">
|
233 |
+
<input type="checkbox" class="w-5 h-5 text-green-500 rounded focus:ring-green-400 mr-3" onchange="toggleCompletion(this)">
|
234 |
+
<span class="text-gray-700">${item}</span>
|
235 |
+
</li>
|
236 |
+
`).join('');
|
237 |
+
|
238 |
+
// Tips
|
239 |
+
const tips = document.getElementById('tips');
|
240 |
+
tips.innerHTML = output.tips.map(tip => `
|
241 |
+
<li class="tip-card p-4 bg-blue-50 rounded-lg text-gray-700">${tip}</li>
|
242 |
+
`).join('');
|
243 |
+
|
244 |
+
// Quote
|
245 |
+
document.getElementById('quote').textContent = output.quote;
|
246 |
+
}
|
247 |
+
|
248 |
+
function toggleCompletion(checkbox) {
|
249 |
+
const li = checkbox.parentElement;
|
250 |
+
li.classList.toggle('completed', checkbox.checked);
|
251 |
+
}
|
252 |
+
|
253 |
+
document.getElementById('saveReflection').addEventListener('click', () => {
|
254 |
+
const reflection = document.getElementById('reflection').value;
|
255 |
+
if (reflection) {
|
256 |
+
alert('Reflection saved: ' + reflection);
|
257 |
+
} else {
|
258 |
+
alert('Please enter a reflection');
|
259 |
+
}
|
260 |
+
});
|
261 |
+
|
262 |
+
document.getElementById('downloadPdf').addEventListener('click', () => {
|
263 |
+
alert('PDF download feature coming soon...');
|
264 |
+
});
|
265 |
+
|
266 |
+
document.getElementById('loadData').addEventListener('click', () => {
|
267 |
+
const role = document.getElementById('role').value;
|
268 |
+
const location = document.getElementById('location').value;
|
269 |
+
const schedule = JSON.parse(document.getElementById('schedule').value || '[]');
|
270 |
+
supervisorData.role = role;
|
271 |
+
supervisorData.location = location;
|
272 |
+
supervisorData.milestones = schedule;
|
273 |
+
fetchCoachingOutput();
|
274 |
+
});
|
275 |
+
|
276 |
+
// Initial load (optional, can be triggered by button only)
|
277 |
+
fetchCoachingOutput();
|
278 |
+
</script>
|
279 |
+
</body>
|
280 |
+
</html>
|