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:
@@ -65,10 +65,18 @@
|
||||
|
||||
<%
|
||||
Dim strSQL, rs
|
||||
strSQL = "SELECT n.*, nt.typename, nt.typecolor, bu.businessunit " & _
|
||||
strSQL = "SELECT n.*, nt.typename, nt.typecolor, bu.businessunit, " & _
|
||||
"TIMESTAMPDIFF(MINUTE, n.endtime, NOW()) as minutes_since_end, " & _
|
||||
"CASE " & _
|
||||
" WHEN n.endtime IS NOT NULL AND n.endtime < NOW() THEN 1 " & _
|
||||
" ELSE 0 " & _
|
||||
"END as is_complete " & _
|
||||
"FROM notifications n " & _
|
||||
"LEFT JOIN notificationtypes nt ON n.notificationtypeid = nt.notificationtypeid " & _
|
||||
"LEFT JOIN businessunits bu ON n.businessunitid = bu.businessunitid " & _
|
||||
"WHERE n.isactive = 1 OR " & _
|
||||
" (n.isactive = 0 AND n.endtime IS NOT NULL AND " & _
|
||||
" DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW()) " & _
|
||||
"ORDER BY n.notificationid DESC"
|
||||
Set rs = objconn.Execute(strSQL)
|
||||
|
||||
@@ -76,7 +84,7 @@
|
||||
Response.Write("<tr><td colspan='9' class='text-center text-muted'>No notifications found.</td></tr>")
|
||||
Else
|
||||
Do While Not rs.EOF
|
||||
Dim statusText, statusClass, typeText, typeColor
|
||||
Dim statusText, statusClass, typeText, typeColor, rowOpacity, rowStyle
|
||||
If CBool(rs("isactive")) = True Then
|
||||
statusText = "Active"
|
||||
statusClass = "success"
|
||||
@@ -85,6 +93,20 @@
|
||||
statusClass = "secondary"
|
||||
End If
|
||||
|
||||
' Calculate opacity for completed notifications (fade over 30 minutes)
|
||||
rowOpacity = 1.0
|
||||
If rs("is_complete") = 1 And Not IsNull(rs("minutes_since_end")) Then
|
||||
' Fade from 1.0 to 0.5 over 30 minutes
|
||||
Dim minutesSinceEnd
|
||||
minutesSinceEnd = CDbl(rs("minutes_since_end"))
|
||||
If minutesSinceEnd >= 0 Then
|
||||
rowOpacity = 1.0 - (minutesSinceEnd / 30) * 0.5
|
||||
If rowOpacity < 0.5 Then rowOpacity = 0.5
|
||||
End If
|
||||
statusText = "Complete"
|
||||
statusClass = "info"
|
||||
End If
|
||||
|
||||
' Get notification type info
|
||||
If IsNull(rs("typename")) Or rs("typename") = "" Then
|
||||
typeText = "TBD"
|
||||
@@ -102,7 +124,9 @@
|
||||
businessUnitText = Server.HTMLEncode(rs("businessunit"))
|
||||
End If
|
||||
|
||||
Response.Write("<tr>")
|
||||
' Apply opacity style
|
||||
rowStyle = "opacity: " & rowOpacity & ";"
|
||||
Response.Write("<tr style='" & rowStyle & "'>")
|
||||
Response.Write("<td>" & Server.HTMLEncode(rs("notification") & "") & "</td>")
|
||||
Response.Write("<td><span class='badge badge-" & typeColor & "'>" & typeText & "</span></td>")
|
||||
Response.Write("<td>" & businessUnitText & "</td>")
|
||||
|
||||
Reference in New Issue
Block a user