Add Employee Recognition feature to notifications system

- Add Recognition notification type (ID 5) with blue color
- Add employeesso field to notifications table
- Create carousel display for Recognition on shopfloor dashboard
- Show employee names (lookup from wjf_employees) instead of SSO
- Auto-set starttime to NOW and endtime to 4AM next day
- Auto-enable shopfloor display for Recognition type
- Add Achievements tab to employee profile (displayprofile.asp)
- Hide Recognition from calendar view
- Add lookupemployee.asp AJAX endpoint for name preview
- Fix datetime double-formatting bug in save/update files
- Fix URL parameter loading on shopfloor dashboard init

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-01-09 07:27:37 -05:00
parent dd8729393f
commit 28e8071570
10 changed files with 938 additions and 51 deletions

View File

@@ -14,7 +14,7 @@ businessUnitFilter = Request.QueryString("businessunit")
strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, " & _
"n.ticketnumber, n.link, n.isactive, n.isshopfloor, n.businessunitid, " & _
"nt.typename, nt.typecolor, bu.businessunit, " & _
"n.employeesso, nt.typename, nt.typecolor, bu.businessunit, " & _
"CASE " & _
" WHEN n.starttime <= NOW() AND (n.endtime IS NULL OR n.endtime >= NOW()) THEN 1 " & _
" WHEN n.endtime IS NOT NULL AND n.endtime < NOW() AND DATE_ADD(n.endtime, INTERVAL 30 MINUTE) >= NOW() THEN 1 " & _
@@ -82,7 +82,9 @@ Do While Not rs.EOF
End If
jsonOutput = jsonOutput & """typename"":""" & JSEscape(rs("typename") & "") & ""","
jsonOutput = jsonOutput & """typecolor"":""" & JSEscape(rs("typecolor") & "") & ""","
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ""
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ","
jsonOutput = jsonOutput & """employeesso"":" & StrOrNull(rs("employeesso")) & ","
jsonOutput = jsonOutput & """employeename"":" & StrOrNull(LookupEmployeeNames(rs("employeesso"))) & ""
jsonOutput = jsonOutput & "}"
End If
@@ -116,7 +118,9 @@ Do While Not rs.EOF
jsonOutput = jsonOutput & """isshopfloor"":true,"
jsonOutput = jsonOutput & """typename"":""" & JSEscape(rs("typename") & "") & ""","
jsonOutput = jsonOutput & """typecolor"":""" & JSEscape(rs("typecolor") & "") & ""","
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ""
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ","
jsonOutput = jsonOutput & """employeesso"":" & StrOrNull(rs("employeesso")) & ","
jsonOutput = jsonOutput & """employeename"":" & StrOrNull(LookupEmployeeNames(rs("employeesso"))) & ""
jsonOutput = jsonOutput & "}"
End If
@@ -163,4 +167,64 @@ Function StrOrNull(s)
StrOrNull = """" & JSEscape(s & "") & """"
End If
End Function
' Look up employee name(s) from SSO(s)
Function LookupEmployeeNames(ssoInput)
If IsNull(ssoInput) Or Len(ssoInput & "") = 0 Then
LookupEmployeeNames = ""
Exit Function
End If
Dim empConn, empCmd, empRs, ssoList, names, i, sso, firstName, lastName
On Error Resume Next
Set empConn = Server.CreateObject("ADODB.Connection")
empConn.ConnectionString = GetEmployeeConnectionString()
empConn.Open
If Err.Number <> 0 Then
' DEBUG: Return error info
LookupEmployeeNames = "[DB Error: " & Err.Description & "]"
Exit Function
End If
ssoList = Split(ssoInput & "", ",")
names = ""
For i = 0 To UBound(ssoList)
sso = Trim(ssoList(i))
If IsNumeric(sso) And Len(sso) > 0 Then
Set empCmd = Server.CreateObject("ADODB.Command")
empCmd.ActiveConnection = empConn
empCmd.CommandText = "SELECT First_Name, Last_Name FROM employees WHERE SSO = ?"
empCmd.CommandType = 1
empCmd.Parameters.Append empCmd.CreateParameter("@sso", 3, 1, , CLng(sso))
Set empRs = empCmd.Execute()
If Err.Number = 0 And Not empRs.EOF Then
firstName = empRs("First_Name") & ""
lastName = empRs("Last_Name") & ""
If Len(names) > 0 Then names = names & ", "
names = names & firstName & " " & lastName
End If
If Not empRs Is Nothing Then
If empRs.State = 1 Then empRs.Close
Set empRs = Nothing
End If
Set empCmd = Nothing
End If
Next
empConn.Close
Set empConn = Nothing
On Error GoTo 0
If Len(names) > 0 Then
LookupEmployeeNames = names
Else
' DEBUG: No names found
LookupEmployeeNames = "[Not found: " & ssoInput & "]"
End If
End Function
%>