Commit Graph

169 Commits

Author SHA1 Message Date
f223d1f958 iOS PWA and IT Job Checklist for IT Staff view 2026-04-11 07:40:12 +08:00
5cb6561924 added ruflo 2026-04-09 19:01:53 +08:00
872c2aab87 UI Enhancements in IT Service Request, Announcements, Workforce and notification fixes 2026-03-22 18:00:10 +08:00
049ab2c794 Added My Schedule tab in attendance screen
Allow 1 Day, Whole Week and Date Range swapping
2026-03-22 11:52:25 +08:00
ba155885c0 Immediate feedback on sending IT Job Reminder 2026-03-21 19:28:53 +08:00
beb21e48d0 Announcements: Show snackbar on event and enhanced comment notification messages 2026-03-21 19:28:18 +08:00
3fb6fd5c93 Announcements and IT Job Checklist 2026-03-21 18:51:04 +08:00
7d9096963a finalized reminder notification system migrations 2026-03-21 12:58:38 +08:00
b2c3202317 Enhaced m3 motion 2026-03-21 12:57:41 +08:00
758869920c Fix push notifications never delivered — 3 root causes
1. CRITICAL: Double idempotency check silently discarded every notification.
   process_scheduled_notifications called try_mark_notification_pushed first,
   then send_fcm called it again and saw "already pushed" → skipped FCM send.
   Fix: Remove the check from process_scheduled_notifications; send_fcm's
   own check is sufficient (and needed for direct Flutter client calls).

2. SEND_FCM_URL env var crash: If not configured, edge function crashed on
   module load. Fix: Derive from SUPABASE_URL (always auto-set) as fallback.

3. Timing windows too narrow: ±30s windows with 60s cron intervals could
   miss events between runs. Fix: Widen to ±90s. ON CONFLICT DO NOTHING
   prevents duplicates, making wider windows safe.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 20:50:45 +08:00
d81e2cde26 Fix RAISE NOTICE syntax in migration error handler
Use parameterized RAISE NOTICE with %L placeholders instead of trying to
concatenate strings inside quoted literals. This fixes the syntax error where
|| operators were being treated as string content instead of SQL operators.
2026-03-20 18:30:19 +08:00
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
74197c525d Enhanced material design 3 implementation 2026-03-20 15:15:38 +08:00
27ebb89052 Added Claude Skills 2026-03-20 15:14:21 +08:00
a39e33bc6b Added Team Activity Dashboard 2026-03-18 22:04:15 +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
4eaf9444f0 Enhanced Logbook layout 2026-03-18 10:56:31 +08:00
84837c4bf2 Show overtime checkin when a user does not have a schedule for the day or the schedule ended for the day 2026-03-18 04:51:45 +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
eeab3b1fcf render overtime anytime needed 2026-03-16 19:46:51 +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
885b543fb5 Pass Slip and Leave approval/rejection push notifications 2026-03-15 22:36:33 +08:00
6fd3b66251 OTA Updates for adnroid app and web apk uploader 2026-03-15 19:24:34 +08:00
9bbaf67fef A more robust self hosted OTA updates implementation 2026-03-13 07:15:28 +08:00
9267ebee2c No need update check for web 2026-03-12 20:38:19 +08:00
0bd2a94ece OTA Update attempt 2026-03-11 22:28:38 +08:00
f8c79acbbc Fixed Leave rejection and approvals 2026-03-11 18:59:28 +08:00
21e6d68910 Fixed In Progress ISR not reflecting on IT Staff Pulse Dashboard Status Pill
Made the Location Tracking more persistent
2026-03-11 07:43:14 +08:00
24ecca9f06 Background location notification icon and a much more user friendly Location Tracking toggle 2026-03-09 22:57:28 +08:00
ccc1c62262 Background location tracking 2026-03-09 22:33:35 +08:00
1e1c7d9552 Fixed freezing on start up for some devices 2026-03-09 18:24:44 +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
f8502f01b6 Whereaboutes and dashboard IT Staff Pulse enhancements 2026-03-08 18:08:03 +08:00
9178b438a2 rotation config migration 2026-03-08 17:32:13 +08:00
8bf0dc13d7 Workforce rotation settings and location permission handling 2026-03-08 17:31:39 +08:00
ce82a88e04 Migrations 2026-03-08 16:58:05 +08:00
d87b5e73d7 Team Color, image compression for attendance verification, improved wherebouts 2026-03-08 12:23:28 +08:00
a8751ca728 Face Recognition with Liveness Detection for Web Support 2026-03-08 10:19:03 +08:00
d3da8901a4 Fixed Shift Labels in Logbook and made Verified/Unverified badge clickable 2026-03-08 08:45:30 +08:00
88432551c8 IT Service Request 2026-03-08 07:54:20 +08:00
e4391ac465 Minor layout fixes 2026-03-08 04:26:33 +08:00
c644143198 Added dependecies image_picker, flutter_liveness_check, google_mlkit_face_detection and qr_flutter 2026-03-07 23:48:20 +08:00
4f2fe38c15 platform specific registry 2026-03-07 23:47:18 +08:00
3dbebd4006 Attendance validation involving Location Detection + Facial Recoginition with Liveness Detection 2026-03-07 23:46:43 +08:00