Commit Graph

29 Commits

Author SHA1 Message Date
20720ba541 Fix SQL syntax error in pg_cron.schedule() calls
Replace dollar-quoted strings with simple single-quoted strings in cron.schedule()
function calls. The cron.schedule() function expects text literals, not dollar-quoted
blocks. Use quote_literal() for the interval value in the cleanup query to properly
escape the string.
2026-03-20 18:28:24 +08:00
d484f62cbd Implement push notification reminder system with 9 notification types
Adds comprehensive push notification reminders using pg_cron + pg_net:
- Shift check-in reminder (15 min before, with countdown banner)
- Shift check-out reminder (hourly, persistent until checkout)
- Overtime idle reminder (15 min without task)
- Overtime checkout reminder (30 min after task completion)
- IT service request event reminder (1 hour before event)
- IT service request evidence reminder (daily)
- Paused task reminder (daily)
- Backlog reminder (15 min before shift end)
- Pass slip expiry reminder (15 min before 1-hour limit, with countdown banner)

Database: Extended scheduled_notifications table to support polymorphic references
(schedule_id, task_id, it_service_request_id, pass_slip_id) with unique constraint
and epoch column for deduplication. Implemented 8 enqueue functions + master dispatcher.
Uses pg_cron every minute to enqueue and pg_net to trigger process_scheduled_notifications
edge function, eliminating need for external cron job. Credentials stored in vault with
GUC fallback for flexibility.

Flutter: Added ShiftCountdownBanner and PassSlipCountdownBanner widgets that display
persistent countdown timers for active shifts and pass slips. Both auto-dismiss when
user completes the action. FCM handler triggers shift countdown on start_15 messages.
navigate_to field in data payload enables flexible routing to any screen.

Edge function: Updated process_scheduled_notifications to handle all 9 types with
appropriate titles, bodies, and routing. Includes pass_slip_id in idempotency tracking.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-20 18:26:48 +08:00
4b63b55812 Initial commit for shift push notification reminders 2026-03-18 22:03:50 +08:00
3af7a1e348 Added configurable shift types and holiday settings 2026-03-18 16:51:34 +08:00
3e3e4d560e Ensures allowing assigned IT Staff to check in outside geofence when and IT Service Request venue is outside premise 2026-03-17 07:20:24 +08:00
81853c4367 Added programmer role and fixed snackbar not showing 2026-03-16 07:23:20 +08:00
9f7791e56f Migration to add leave_of_absence(id) and pass_slips(id) on notifications table 2026-03-15 22:37:42 +08:00
6fd3b66251 OTA Updates for adnroid app and web apk uploader 2026-03-15 19:24:34 +08:00
b8ec5dbf69 weekend on call shifts 2026-03-09 18:24:16 +08:00
aee4604fed Team color read access 2026-03-09 17:52:55 +08:00
ac38a21f9a Fixed attendance checkout postgrest unable to choose the best function candidate 2026-03-09 13:37:25 +08:00
0f675d4274 Attendance log now record both check in and out photos and allow IT Staffs, Dispatchers and Admins to view for verification 2026-03-08 18:45:31 +08:00
9178b438a2 rotation config migration 2026-03-08 17:32:13 +08:00
ce82a88e04 Migrations 2026-03-08 16:58:05 +08:00
94088a8796 Implemented Task Pause and Resume 2026-03-04 07:12:00 +08:00
bfcca47353 Reports migrations 2026-03-03 18:15:45 +08:00
b9153a070f Fixed migrations 2026-03-01 19:12:13 +08:00
830c99a3ff Migrations 2026-03-01 18:51:53 +08:00
0a8e388757 Move push notification to client instead of db trigger 2026-02-28 16:19:08 +08:00
6ccf820438 FCM push Notifications 2026-02-25 23:37:08 +08:00
5979a04254 * Push Notification Setup and attempt
* Office Ordering
* Allow editing of Task and Ticket Details after creation
2026-02-24 21:06:46 +08:00
9a0cf7a89d Added migration non admin read only service table 2026-02-23 18:26:25 +08:00
46a84b4d95 Added Service 2026-02-21 21:57:31 +08:00
6238c701c0 Added Task number 2026-02-21 21:37:36 +08:00
1478667bbf Added Action Taken on Task 2026-02-21 15:44:12 +08:00
8d31a629ac Added Type, Category and Signatories on task 2026-02-21 14:33:22 +08:00
4811621dc5 Swap Accept, Reject and Escalate 2026-02-21 08:31:20 +08:00
5ec57a1cec Auto Task Assignment 2026-02-18 23:14:50 +08:00
04fd874a48 chore: remove unused profile lock migration and admin_profile_service 2026-02-18 18:13:10 +08:00