- 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>
77 lines
2.0 KiB
Plaintext
77 lines
2.0 KiB
Plaintext
<%@ Language=VBScript %>
|
|
<%
|
|
Response.ContentType = "application/json"
|
|
Response.Charset = "UTF-8"
|
|
Response.AddHeader "Access-Control-Allow-Origin", "*"
|
|
Response.AddHeader "Cache-Control", "no-cache, no-store, must-revalidate"
|
|
%><!--#include file="./includes/wjf_employees-sql.asp"--><%
|
|
|
|
' Employee lookup API for Recognition notifications
|
|
' Input: sso (single SSO or comma-separated list)
|
|
' Output: JSON with employee names
|
|
|
|
Dim ssoInput, ssoList, names, jsonOutput
|
|
ssoInput = Trim(Request.QueryString("sso"))
|
|
|
|
If Len(ssoInput) = 0 Then
|
|
Response.Write "{""success"":false,""error"":""SSO parameter required""}"
|
|
Response.End
|
|
End If
|
|
|
|
' Split by comma for multiple SSOs
|
|
ssoList = Split(ssoInput, ",")
|
|
names = ""
|
|
|
|
Dim i, sso, cmd, rs, firstName, lastName
|
|
For i = 0 To UBound(ssoList)
|
|
sso = Trim(ssoList(i))
|
|
|
|
' Validate SSO is numeric
|
|
If IsNumeric(sso) And Len(sso) > 0 Then
|
|
' Query employee database
|
|
Set cmd = Server.CreateObject("ADODB.Command")
|
|
cmd.ActiveConnection = objconn
|
|
cmd.CommandText = "SELECT First_Name, Last_Name FROM employees WHERE SSO = ?"
|
|
cmd.CommandType = 1
|
|
cmd.Parameters.Append cmd.CreateParameter("@sso", 3, 1, , CLng(sso))
|
|
|
|
On Error Resume Next
|
|
Set rs = cmd.Execute()
|
|
|
|
If Err.Number = 0 And Not rs.EOF Then
|
|
firstName = rs("First_Name") & ""
|
|
lastName = rs("Last_Name") & ""
|
|
If Len(names) > 0 Then names = names & ", "
|
|
names = names & firstName & " " & lastName
|
|
End If
|
|
|
|
If Not rs Is Nothing Then
|
|
If rs.State = 1 Then rs.Close
|
|
Set rs = Nothing
|
|
End If
|
|
Set cmd = Nothing
|
|
On Error GoTo 0
|
|
End If
|
|
Next
|
|
|
|
If Len(names) > 0 Then
|
|
jsonOutput = "{""success"":true,""names"":""" & JSEscape(names) & """}"
|
|
Else
|
|
jsonOutput = "{""success"":false,""error"":""No employees found""}"
|
|
End If
|
|
|
|
Response.Write jsonOutput
|
|
objconn.Close
|
|
|
|
Function JSEscape(s)
|
|
Dim r
|
|
r = s
|
|
r = Replace(r, "\", "\\")
|
|
r = Replace(r, """", "\""")
|
|
r = Replace(r, Chr(13), "")
|
|
r = Replace(r, Chr(10), "\n")
|
|
r = Replace(r, Chr(9), "\t")
|
|
JSEscape = r
|
|
End Function
|
|
%>
|