Sep 14 - Update the check-ins pages to force employee to select the type of work

This commit is contained in:
2026-09-14 12:18:53 -04:00
parent d92cff81e5
commit 4fc500707b
4 changed files with 87 additions and 13 deletions
+19 -5
View File
@@ -547,12 +547,15 @@ Toggle UI in `create_qr_code.html` and `edit_qr_code.html` — uses `addEventLis
### Type of Work — Check-In Dropdown (Sept 2026)
The check-in page carries a **Type of Work / Tipo de Trabajo** `<select>` directly after
the Employee ID field. The employee enters a **numeric-only** ID and picks the type;
`Regular` is selected by default.
the Employee ID field. The employee enters a **numeric-only** ID and picks the type.
**There is no default (Sept 14, 2026)** — the dropdown opens on a disabled placeholder
and submit is blocked (red outline + bilingual message) until a type is chosen, because
employees were leaving it on Regular without looking.
| Option value | Label shown (bilingual, one plain string) |
|---|---|
| `""` | Regular / Trabajo Regular |
| `""` (disabled, selected) | -- Select type of work / Seleccione tipo de trabajo -- |
| `R` | Regular / Trabajo Regular — stored as the plain numeric ID |
| `PW` | Periodic Work / Trabajo Periódico (PW) |
| `SP` | Special Project / Proyecto Especial (SP) |
| `C` | Covering / Cobertura (C) |
@@ -564,7 +567,11 @@ languages share one label separated by `/`.
the format every calculator and export already parses:
```python
work_type = request.form.get('work_type', '').strip().upper() # '' = Regular
work_type = request.form.get('work_type', '').strip().upper()
if not work_type:
return jsonify({...}), 400 # nothing chosen — rejected
if work_type == 'R':
work_type = '' # Regular — no code appended
if work_type and work_type not in VALID_CHECKIN_WORK_TYPES: # ('SP','PW','PT','C')
return jsonify({...}), 400 # reject unknown codes
if employee_id and work_type:
@@ -670,7 +677,7 @@ load (i.e. after the fetch resolves) and caches plain GETs aggressively:
### Check-In Flow
1. Employee scans QR → `qr_destination.html`
2. Enters numeric ID and picks Type of Work (Regular by default); GPS captured by browser
2. Enters numeric ID and **must** pick Type of Work (no default); GPS captured by browser
3. On a Check Out scan the page pre-selects the open check-in's work type
4. Work-type code appended to the ID server-side (`1234``1234SP`)
5. 30-min interval guard (configurable via `TIME_INTERVAL`)
@@ -1190,6 +1197,13 @@ exact-match test is what dropped every SP/PW/PT row the query had already return
| `templates/time_attendance_records.html` | Tooltip on the Export by Building button |
| — | Replaces the manual "Copilot" procedure (delete PM rows + SP rows, then build a weekly table). Decisions: PM IDs removed from both sheets; SP hours excluded from weekly hours |
### Set 19 — Type of Work Must Be Selected (Sept 14, 2026)
| File | Change |
|---|---|
| `templates/qr_destination.html` | Disabled placeholder option is the default; Regular value `""``R`; `required`; submit guard + `.work-type-missing` red outline; check-out suggestion maps server `""``R` |
| `static/js/qr_destination.js` | Same guard in `submitCheckin()` |
| `routes/qr_codes.py` | `qr_checkin` rejects an empty `work_type` with HTTP 400; `R` normalised to `''` (Regular). `last-work-type` still returns `""` for Regular |
---
## 21. Infrastructure & Deployment