<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Find Workers</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
        }
        .container {
            width: 80%;
            margin: 20px auto;
            padding: 20px;
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        h1 {
            text-align: center;
            color: #333;
        }
        .search-form {
            text-align: center;
            margin-bottom: 20px;
        }
        .search-form select, .search-form input {
            padding: 10px;
            font-size: 16px;
            width: 200px;
            border-radius: 5px;
            margin: 10px;
        }
        .search-form button {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            margin-left: 10px;
            transition: background-color 0.3s ease;
        }
        .search-form button:hover {
            background-color: #45a049;
        }
        .worker-list {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            margin-top: 30px;
        }
        .worker-card {
            background-color: #fff;
            padding: 20px;
            margin: 10px;
            width: 48%;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            display: flex;
            justify-content: space-between;
        }
        .worker-card:nth-child(odd) {
            background-color: #f9f9f9;
        }
        .worker-card .info {
            width: 60%;
        }
        .worker-card .phone {
            width: 35%;
            text-align: center;
        }
        .worker-card .label {
            font-weight: bold;
            color: #333;
        }
        .worker-card .value {
            color: #555;
            margin-bottom: 10px;
        }
        .worker-card h3 {
            margin-top: 0;
        }
        .error {
            text-align: center;
            color: red;
            font-size: 18px;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Find Workers by Location and Profession</h1>

        <div class="search-form">
            <!-- Form for selecting location and profession -->
            <form action="/search" method="get">
                <select name="location">
                    <option value="">Select Location</option>
                    <option value="Hyderabad">Hyderabad</option>
                    <option value="Warangal">Warangal</option>
                    <option value="Nizamabad">Nizamabad</option>
                    <option value="Khammam">Khammam</option>
                    <option value="Karimnagar">Karimnagar</option>
                    <option value="Suryapet">Suryapet</option>
                    <option value="Mahabubnagar">Mahabubnagar</option>
                    <option value="Rangareddy">Rangareddy</option>
                    <option value="Medak">Medak</option>
                    <option value="Adilabad">Adilabad</option>
                </select>

                <select name="profession">
                    <option value="">Select Profession</option>
                    <option value="Mason">Mason</option>
                    <option value="Plumber">Plumber</option>
                    <option value="Electrician">Electrician</option>
                    <option value="Carpenter">Carpenter</option>
                    <option value="Housemaid">Housemaid</option>
                    <option value="Painter">Painter</option>
                    <option value="Driver">Driver</option>
                    <option value="Construction Laborer">Construction Laborer</option>
                    <option value="Security Guard">Security Guard</option>
                    <option value="Agricultural Worker">Agricultural Worker</option>
                    <option value="Handyman">Handyman</option>
                </select>

                <button type="submit">Search</button>
            </form>
        </div>

        <div class="worker-list">
            <!-- Placeholder for worker results -->
            <% if (workers.length > 0) { %>
                <% workers.forEach(worker => { %>
                    <div class="worker-card">
                        <div class="info">
                            <h3><%= worker.name %></h3>
                            <div><span class="label">Profession:</span> <span class="value"><%= worker.profession %></span></div>
                            <div><span class="label">Location:</span> <span class="value"><%= worker.location %></span></div>
                        </div>
                        <div class="phone">
                            <div><span class="label">Phone:</span> <span class="value"><%= worker.phone %></span></div>
                        </div>
                    </div>
                <% }); %>
            <% } else { %>
                <div class="error">No workers found</div>
            <% } %>
        </div>

        <!-- Register Button -->
        <div style="text-align: center; margin-top: 20px;">
            <a href="/register" style="padding: 10px 20px; font-size: 16px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 5px;">Register as Worker</a>
        </div>
    </div>
</body>
</html>
