Spaces:
Running
Running
File size: 9,785 Bytes
7c447df c937180 d4594a2 c937180 7c447df 4ece56c 7c447df 4ece56c 7c447df fbc04b5 7c447df fbc04b5 7c447df e127da4 7c447df bf69f50 7c447df bf69f50 7c447df bf69f50 7c447df d4594a2 4ece56c 7c447df e127da4 7c447df bf69f50 7c447df bf69f50 7c447df | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | <!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Worker Dashboard - WorkerConnect India</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<link href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" rel="stylesheet" crossorigin="anonymous">
<style>
body {
background-color: #f8f9fa;
}
.dashboard-container {
max-width: 1200px;
margin: 20px auto;
}
.profile-card {
background: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
padding: 20px;
margin-bottom: 20px;
}
.profile-img {
width: 150px;
height: 150px;
object-fit: cover;
border-radius: 50%;
display: block;
margin: 0 auto 15px;
border: 3px solid #dee2e6;
}
#map {
height: 500px;
border-radius: 10px;
margin-top: 20px;
}
.worker-list {
margin-top: 20px;
}
.worker-card {
border: 1px solid #dee2e6;
border-radius: 5px;
padding: 15px;
margin-bottom: 15px;
background: white;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
will-change: transform;
}
.worker-card:hover {
transform: translateY(-5px) scale(1.02);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="index.html">WorkerConnect India</a>
<div class="navbar-nav">
<a class="nav-link active" href="worker-dashboard.html">Dashboard</a>
<a class="nav-link" href="worker-login.html">Logout</a>
</div>
</div>
</nav>
<div class="dashboard-container">
<div class="row">
<div class="col-md-4">
<div class="profile-card">
<img id="profilePhoto" src="http://static.photos/people/150x150/1" class="profile-img" alt="Profile Photo">
<h3 id="workerName" class="text-center">Worker Name</h3>
<p class="text-center" id="workerLocation">Location</p>
<div class="d-grid mt-3">
<button class="btn btn-primary">Update Profile</button>
</div>
</div>
<div class="profile-card">
<h4>Your Availability</h4>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" id="availableToggle" checked>
<label class="form-check-label" for="availableToggle">Available for work</label>
</div>
<div class="mb-3">
<label for="rateInput" class="form-label">Hourly Rate (₹)</label>
<input type="number" class="form-control" id="rateInput" value="300">
</div>
<button class="btn btn-success w-100">Save Changes</button>
</div>
</div>
<div class="col-md-8">
<div class="profile-card">
<h4>Your Location on Map</h4>
<div id="map"></div>
<p class="mt-2 text-muted">Users in your area will see your profile when searching for workers.</p>
</div>
<div class="profile-card worker-list">
<h4>Nearby Workers</h4>
<div class="worker-card">
<div class="row">
<div class="col-md-2">
<img src="http://static.photos/people/100x100/2" class="rounded-circle" width="50" height="50">
</div>
<div class="col-md-6">
<h5>Rajesh Kumar</h5>
<p class="text-muted">Electrician | 2 km away</p>
<p class="text-muted">Mobile: 9876543210</p>
</div>
<div class="col-md-4 text-end">
<span class="badge bg-success">Available</span>
</div>
</div>
</div>
<div class="worker-card">
<div class="row">
<div class="col-md-2">
<img src="http://static.photos/people/100x100/3" class="rounded-circle" width="50" height="50">
</div>
<div class="col-md-6">
<h5>Sunil Patel</h5>
<p class="text-muted">Plumber | 3 km away</p>
<p class="text-muted">Mobile: 8765432109</p>
</div>
<div class="col-md-4 text-end">
<span class="badge bg-warning text-dark">Busy</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous" defer></script>
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" crossorigin="anonymous" defer></script>
<script>
// Initialize map
const map = L.map('map').setView([20.5937, 78.9629], 13); // Default to India coordinates
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// Try to get user's current location
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
const { latitude, longitude } = position.coords;
map.setView([latitude, longitude], 13);
L.marker([latitude, longitude]).addTo(map)
.bindPopup('Your Location')
.openPopup();
},
(error) => {
console.error("Error getting location:", error);
// Default to India coordinates if location access is denied
L.marker([20.5937, 78.9629]).addTo(map)
.bindPopup('Default Location (India)')
.openPopup();
}
);
} else {
// Fallback for browsers that don't support geolocation
L.marker([20.5937, 78.9629]).addTo(map)
.bindPopup('Default Location (India)')
.openPopup();
}
// Load worker data from form submission
document.addEventListener('DOMContentLoaded', function() {
const workerData = JSON.parse(localStorage.getItem('workerData'));
if (workerData) {
document.getElementById('workerName').textContent = `${workerData.firstName} ${workerData.lastName}`;
document.getElementById('workerLocation').textContent = `${workerData.district}, ${workerData.state}`;
if (workerData.photo) {
document.getElementById('profilePhoto').src = workerData.photo;
}
}
// Load nearby workers data
const nearbyWorkers = [
{
name: "Rajesh Kumar",
specialty: "Electrician",
distance: "2 km away",
mobile: "9876543210",
photo: "http://static.photos/people/100x100/2",
status: "Available"
},
{
name: "Sunil Patel",
specialty: "Plumber",
distance: "3 km away",
mobile: "8765432109",
photo: "http://static.photos/people/100x100/3",
status: "Busy"
}
];
const workerList = document.querySelector('.worker-list');
nearbyWorkers.forEach(worker => {
const workerCard = document.createElement('div');
workerCard.className = 'worker-card';
workerCard.innerHTML = `
<div class="row">
<div class="col-md-2">
<img src="${worker.photo}" class="rounded-circle" width="50" height="50">
</div>
<div class="col-md-6">
<h5>${worker.name}</h5>
<p class="text-muted">${worker.specialty} | ${worker.distance}</p>
<p class="text-muted">Mobile: ${worker.mobile}</p>
</div>
<div class="col-md-4 text-end">
<span class="badge ${worker.status === 'Available' ? 'bg-success' : 'bg-warning text-dark'}">${worker.status}</span>
</div>
</div>
`;
workerList.insertBefore(workerCard, workerList.firstChild);
});
});
</script>
</body>
</html> |