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

@@ -10,7 +10,7 @@
<!--#include file="./includes/response.asp"-->
<%
' Get form inputs
Dim notificationid, notification, ticketnumber, starttime, endtime, isactive, isshopfloor, notificationtypeid, businessunitid, appid
Dim notificationid, notification, ticketnumber, starttime, endtime, isactive, isshopfloor, notificationtypeid, businessunitid, appid, employeesso
notificationid = Trim(Request.Form("notificationid"))
notification = Trim(Request.Form("notification"))
ticketnumber = Trim(Request.Form("ticketnumber"))
@@ -19,6 +19,10 @@ endtime = Trim(Request.Form("endtime"))
notificationtypeid = Trim(Request.Form("notificationtypeid"))
businessunitid = Trim(Request.Form("businessunitid"))
appid = Trim(Request.Form("appid"))
employeesso = Trim(Request.Form("employeesso"))
' Recognition type ID
Const RECOGNITION_TYPE_ID = 5
' Handle checkbox - if the hidden field is submitted but checkbox isn't, it means unchecked
If Request.Form("isactive_submitted") = "1" Then
@@ -64,10 +68,41 @@ If notificationtypeid = "" Or Not IsNumeric(notificationtypeid) Then
notificationtypeid = "1"
End If
' Validate required fields (endtime is now optional)
If Len(notification) = 0 Or Len(starttime) = 0 Then
' Handle Recognition type - auto-set times and require employeesso
Dim isRecognition
isRecognition = (CLng(notificationtypeid) = RECOGNITION_TYPE_ID)
If isRecognition Then
' Validate employeesso is provided for Recognition
If Len(employeesso) = 0 Then
objConn.Close
ShowError "Employee SSO is required for Recognition notifications.", "editnotification.asp?notificationid=" & notificationid
Response.End
End If
' Auto-set starttime to NOW
starttime = Year(Now) & "-" & Right("0" & Month(Now), 2) & "-" & Right("0" & Day(Now), 2) & " " & _
Right("0" & Hour(Now), 2) & ":" & Right("0" & Minute(Now), 2) & ":00"
' Auto-set endtime to 4AM next day
Dim nextDay
nextDay = DateAdd("d", 1, Date)
endtime = Year(nextDay) & "-" & Right("0" & Month(nextDay), 2) & "-" & Right("0" & Day(nextDay), 2) & " 04:00:00"
' Auto-enable shopfloor display for Recognition
isshopfloor = 1
End If
' Validate required fields (endtime is now optional, starttime not required for Recognition)
If Len(notification) = 0 Then
objConn.Close
ShowError "Required fields missing.", "editnotification.asp?notificationid=" & notificationid
ShowError "Notification message is required.", "editnotification.asp?notificationid=" & notificationid
Response.End
End If
If Not isRecognition And Len(starttime) = 0 Then
objConn.Close
ShowError "Start time is required.", "editnotification.asp?notificationid=" & notificationid
Response.End
End If
@@ -77,8 +112,10 @@ If Len(notification) > 500 Or Len(ticketnumber) > 50 Then
Response.End
End If
' Convert datetime format for starttime
starttime = Replace(starttime, "T", " ") & ":00"
' Convert datetime format for starttime (skip if already formatted for Recognition)
If InStr(starttime, "T") > 0 Then
starttime = Replace(starttime, "T", " ") & ":00"
End If
' Handle optional endtime - leave as NULL if blank (indefinite)
Dim endtimeValue, businessunitValue
@@ -86,8 +123,10 @@ If Len(endtime) = 0 Then
' No end date - store as NULL for indefinite notifications
endtimeValue = Null
Else
' End date specified - convert format
endtime = Replace(endtime, "T", " ") & ":00"
' End date specified - convert format (only add :00 if from datetime-local input with T)
If InStr(endtime, "T") > 0 Then
endtime = Replace(endtime, "T", " ") & ":00"
End If
endtimeValue = endtime
End If
@@ -106,9 +145,17 @@ Else
appidValue = CLng(appid)
End If
' Handle optional employeesso - only for Recognition type
Dim employeessoValue
If Len(employeesso) = 0 Then
employeessoValue = Null
Else
employeessoValue = employeesso
End If
' UPDATE using parameterized query
Dim strSQL, cmdUpdate
strSQL = "UPDATE notifications SET notificationtypeid = ?, businessunitid = ?, appid = ?, notification = ?, ticketnumber = ?, starttime = ?, endtime = ?, isactive = ?, isshopfloor = ? WHERE notificationid = ?"
strSQL = "UPDATE notifications SET notificationtypeid = ?, businessunitid = ?, appid = ?, notification = ?, ticketnumber = ?, starttime = ?, endtime = ?, isactive = ?, isshopfloor = ?, employeesso = ? WHERE notificationid = ?"
Set cmdUpdate = Server.CreateObject("ADODB.Command")
cmdUpdate.ActiveConnection = objConn
cmdUpdate.CommandText = strSQL
@@ -134,6 +181,11 @@ Else
End If
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@isactive", 11, 1, , CBool(isactive))
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@isshopfloor", 11, 1, , CBool(isshopfloor))
If IsNull(employeessoValue) Then
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@employeesso", 200, 1, 100, Null)
Else
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@employeesso", 200, 1, 100, employeessoValue)
End If
cmdUpdate.Parameters.Append cmdUpdate.CreateParameter("@notificationid", 3, 1, , CLng(notificationid))
On Error Resume Next