Apply 30-minute fade timer to all notification types

Extended the shopfloor-dashboard's 30-minute fade/removal logic from
incidents-only to ALL notification types (Changes, Awareness, TBD).

Changes to api_shopfloor.asp:
- Removed typecolor='danger' restriction from is_current and is_resolved
- Now shows all completed notifications for 30 minutes regardless of type
- All notification types fade progressively over 30 minutes after completion

Changes to displaynotifications.asp:
- Added TIMESTAMPDIFF to calculate minutes_since_end
- Added is_complete flag for completed notifications
- Filter query to only show active OR recently completed (within 30 minutes)
- Progressive opacity fade: 100% → 50% over 30 minutes
- Changed status badge to "Complete" (info) for completed items
- Automatically hides notifications 30 minutes after endtime

Behavior:
- Notification is marked complete (endtime passed)
- Shows at 100% opacity initially
- Fades to 50% opacity over next 30 minutes
- Automatically removed from display after 30 minutes
- Works for ALL types: Incident, Change, Awareness, TBD

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-11-18 08:59:42 -05:00
parent 91ac55a111
commit e1e54eded1
2 changed files with 30 additions and 6 deletions

View File

@@ -17,11 +17,11 @@ strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, " & _
"nt.typename, nt.typecolor, bu.businessunit, " & _
"CASE " & _
" WHEN n.starttime <= NOW() AND (n.endtime IS NULL OR n.endtime >= NOW()) THEN 1 " & _
" WHEN nt.typecolor = 'danger' AND n.endtime IS NOT NULL AND n.endtime < NOW() AND DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW() THEN 1 " & _
" WHEN n.endtime IS NOT NULL AND n.endtime < NOW() AND DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW() THEN 1 " & _
" ELSE 0 " & _
"END as is_current, " & _
"CASE " & _
" WHEN nt.typecolor = 'danger' AND n.endtime IS NOT NULL AND n.endtime < NOW() THEN 1 " & _
" WHEN n.endtime IS NOT NULL AND n.endtime < NOW() THEN 1 " & _
" ELSE 0 " & _
"END as is_resolved, " & _
"CASE " & _
@@ -34,7 +34,7 @@ strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, " & _
"LEFT JOIN businessunits bu ON n.businessunitid = bu.businessunitid " & _
"WHERE n.isshopfloor = 1 AND (" & _
" n.isactive = 1 OR " & _
" (n.isactive = 0 AND nt.typecolor = 'danger' AND n.endtime IS NOT NULL AND " & _
" (n.isactive = 0 AND n.endtime IS NOT NULL AND " & _
" DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW())" & _
")"