Add employee search autocomplete and photo display for Recognition
- Add apiemployeesearch.asp for searching employees by name with Team info - Update addnotification.asp with autocomplete dropdown showing photo, name, team, SSO - Support custom names for non-system employees using NAME: prefix in employeesso field - Add theme-aware CSS for selected employee chips (light/dark themes) - Update apishopfloor.asp to detect NAME: prefix and extract custom names - Update shopfloor-dashboard to display employee photos (140px) with GE logo fallback Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -83,8 +83,22 @@ Do While Not rs.EOF
|
||||
jsonOutput = jsonOutput & """typename"":""" & JSEscape(rs("typename") & "") & ""","
|
||||
jsonOutput = jsonOutput & """typecolor"":""" & JSEscape(rs("typecolor") & "") & ""","
|
||||
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ","
|
||||
jsonOutput = jsonOutput & """employeesso"":" & StrOrNull(rs("employeesso")) & ","
|
||||
jsonOutput = jsonOutput & """employeename"":" & StrOrNull(LookupEmployeeNames(rs("employeesso"))) & ""
|
||||
' Handle employeesso - can be SSO or NAME:customname
|
||||
Dim empSsoRaw, empName, empPicture
|
||||
empSsoRaw = rs("employeesso") & ""
|
||||
If Left(empSsoRaw, 5) = "NAME:" Then
|
||||
' Custom name - extract name, no picture
|
||||
empName = Mid(empSsoRaw, 6)
|
||||
empPicture = ""
|
||||
jsonOutput = jsonOutput & """employeesso"":null,"
|
||||
Else
|
||||
' SSO - lookup name and picture
|
||||
empName = LookupEmployeeNames(empSsoRaw)
|
||||
empPicture = LookupEmployeePictures(empSsoRaw)
|
||||
jsonOutput = jsonOutput & """employeesso"":" & StrOrNull(empSsoRaw) & ","
|
||||
End If
|
||||
jsonOutput = jsonOutput & """employeename"":" & StrOrNull(empName) & ","
|
||||
jsonOutput = jsonOutput & """employeepicture"":" & StrOrNull(empPicture) & ""
|
||||
jsonOutput = jsonOutput & "}"
|
||||
End If
|
||||
|
||||
@@ -119,8 +133,21 @@ Do While Not rs.EOF
|
||||
jsonOutput = jsonOutput & """typename"":""" & JSEscape(rs("typename") & "") & ""","
|
||||
jsonOutput = jsonOutput & """typecolor"":""" & JSEscape(rs("typecolor") & "") & ""","
|
||||
jsonOutput = jsonOutput & """businessunit"":" & StrOrNull(rs("businessunit")) & ","
|
||||
jsonOutput = jsonOutput & """employeesso"":" & StrOrNull(rs("employeesso")) & ","
|
||||
jsonOutput = jsonOutput & """employeename"":" & StrOrNull(LookupEmployeeNames(rs("employeesso"))) & ""
|
||||
' Handle employeesso - can be SSO or NAME:customname
|
||||
empSsoRaw = rs("employeesso") & ""
|
||||
If Left(empSsoRaw, 5) = "NAME:" Then
|
||||
' Custom name - extract name, no picture
|
||||
empName = Mid(empSsoRaw, 6)
|
||||
empPicture = ""
|
||||
jsonOutput = jsonOutput & """employeesso"":null,"
|
||||
Else
|
||||
' SSO - lookup name and picture
|
||||
empName = LookupEmployeeNames(empSsoRaw)
|
||||
empPicture = LookupEmployeePictures(empSsoRaw)
|
||||
jsonOutput = jsonOutput & """employeesso"":" & StrOrNull(empSsoRaw) & ","
|
||||
End If
|
||||
jsonOutput = jsonOutput & """employeename"":" & StrOrNull(empName) & ","
|
||||
jsonOutput = jsonOutput & """employeepicture"":" & StrOrNull(empPicture) & ""
|
||||
jsonOutput = jsonOutput & "}"
|
||||
End If
|
||||
|
||||
@@ -227,4 +254,59 @@ Function LookupEmployeeNames(ssoInput)
|
||||
LookupEmployeeNames = "[Not found: " & ssoInput & "]"
|
||||
End If
|
||||
End Function
|
||||
|
||||
' Look up employee picture(s) from SSO(s)
|
||||
Function LookupEmployeePictures(ssoInput)
|
||||
If IsNull(ssoInput) Or Len(ssoInput & "") = 0 Then
|
||||
LookupEmployeePictures = ""
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
Dim empConn, empCmd, empRs, ssoList, pictures, i, sso, picture
|
||||
|
||||
On Error Resume Next
|
||||
Set empConn = Server.CreateObject("ADODB.Connection")
|
||||
empConn.ConnectionString = GetEmployeeConnectionString()
|
||||
empConn.Open
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
LookupEmployeePictures = ""
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
ssoList = Split(ssoInput & "", ",")
|
||||
pictures = ""
|
||||
|
||||
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 Picture 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
|
||||
picture = empRs("Picture") & ""
|
||||
If Len(picture) > 0 Then
|
||||
If Len(pictures) > 0 Then pictures = pictures & ","
|
||||
pictures = pictures & picture
|
||||
End If
|
||||
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
|
||||
|
||||
LookupEmployeePictures = pictures
|
||||
End Function
|
||||
%>
|
||||
|
||||
Reference in New Issue
Block a user