Register
Register with Google (simulated) or fill details below.
===== index.html =====
Rozgar dena
Register with Google (simulated) or fill details below.
Select a category to see people who need a worker (you can view contact numbers).
Select a category to see registered workers near you.
No entries yet.
'; } workCat.addEventListener('change', renderWork); renderWork(); } // Show workers on worker.html const workerCat = document.getElementById('workerCat'); const workersDiv = document.getElementById('workers'); if (workerCat) { function renderWorkers() { const cat = workerCat.value; const regs = loadDemoResults().filter(r => r.role === 'worker' && r.category === cat); workersDiv.innerHTML = regs.length ? regs.map(r => `No entries yet.
'; } workerCat.addEventListener('change', renderWorkers); renderWorkers(); } ===== README-Google-Apps-Script.md ===== # Google Sheets + Apps Script setup (to store registrations into a Sheet) 1. Create a new Google Sheet (e.g., "workandworker-registrations"). 2. In the Sheet, create headers in row 1: `timestamp`, `name`, `phone`, `nid`, `email`, `role`, `category`, `location`. 3. In the Google Sheet: Extensions → Apps Script. 4. Replace the default Code.gs with the provided Code.gs content (below). 5. Save, then click Deploy → New deployment → Select "Web app". - Execute as: **Me** - Who has access: **Anyone** (or Anyone with link) 6. Deploy and copy the Web app URL. 7. Paste the Web app URL into `script.js` constant FORM_ENDPOINT. Now when the site sends POST JSON to the Web App URL, Apps Script will append the row to your sheet. ===== Code.gs (Google Apps Script) ===== function doPost(e) { try { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var content = e.postData.contents; var data = JSON.parse(content); var row = [new Date().toLocaleString(), data.name || '', data.phone || '', data.nid || '', data.email || '', data.role || '', data.category || '', data.location || '']; sheet.appendRow(row); return ContentService.createTextOutput(JSON.stringify({ok:true})).setMimeType(ContentService.MimeType.JSON); } catch (err) { return ContentService.createTextOutput(JSON.stringify({ok:false, error:err.toString()})).setMimeType(ContentService.MimeType.JSON); } } ===== Notes & Next steps ===== - The frontend demo will store data locally (localStorage) unless you deploy Apps Script and update FORM_ENDPOINT. - For production you should: - Add server-side validation and CAPTCHA to prevent abuse - Add authentication for workers/business users - Implement map-based search (use Google Maps JavaScript API and store lat/lng) - Use a proper backend (Firebase, Supabase, or a custom server) for scale -- End of files --