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

@@ -58,6 +58,9 @@ Option Explicit
<%
' Use parameterized query to prevent SQL injection
Dim employeeFound
employeeFound = False
Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = objconn
cmd.CommandText = "SELECT * FROM employees WHERE SSO = ?"
@@ -65,27 +68,34 @@ Option Explicit
cmd.Parameters.Append cmd.CreateParameter("@sso", 3, 1, , sso)
Set rs = cmd.Execute()
If rs.EOF Then
' Default to SSO 1 if not found
rs.Close
Set rs = Nothing
Set cmd = Nothing
Set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = objconn
cmd.CommandText = "SELECT * FROM employees WHERE SSO = ?"
cmd.CommandType = 1
cmd.Parameters.Append cmd.CreateParameter("@sso", 3, 1, , 1)
Set rs = cmd.Execute()
If Not rs.EOF Then
employeeFound = True
End If
Set cmd = Nothing
%>
If employeeFound Then
%>
<img class="img-fluid" src="https://tsgwp00525.rd.ds.ge.com/EmployeeDBAPP/images/<%=Server.HTMLEncode(rs("Picture") & "")%>" alt="Card image cap">
</div>
<div class="card-body pt-5">
<h5 class="card-title"><%=Server.HTMLEncode(rs("First_Name") & "")%>&nbsp;<%=Server.HTMLEncode(rs("Last_Name") & "")%></h5>
</div>
<%
Else
%>
<div style="height:200px; background:#f8f9fa; display:flex; align-items:center; justify-content:center;">
<i class="zmdi zmdi-account-circle zmdi-hc-5x text-muted"></i>
</div>
</div>
<div class="card-body pt-5">
<h5 class="card-title text-muted">Employee Not Found</h5>
<p class="text-muted mb-0">SSO: <%=Server.HTMLEncode(sso)%></p>
</div>
<%
End If
%>
<%
If employeeFound Then
' Easter Egg for SSO 570005354
Dim showEasterEgg
showEasterEgg = False
@@ -238,6 +248,7 @@ ELSE
</div>
<%
END IF
End If ' employeeFound
%>
</div>
@@ -253,10 +264,14 @@ END IF
<li class="nav-item">
<a href="javascript:void();" data-target="#usbhistory" data-toggle="pill" class="nav-link"><i class="zmdi zmdi-usb"></i> <span class="hidden-xs">USB History</span></a>
</li>
<li class="nav-item">
<a href="javascript:void();" data-target="#achievements" data-toggle="pill" class="nav-link"><i class="zmdi zmdi-star"></i> <span class="hidden-xs">Achievements</span></a>
</li>
</ul>
<div class="tab-content p-3">
<div class="tab-pane active" id="profile">
<h5 class="mb-3">Profile</h5>
<% If employeeFound Then %>
<div class="row">
<div class="col-md-3">
<h6><%=Server.HTMLEncode(rs("First_Name") & "")%>&nbsp;<%=Server.HTMLEncode(rs("Last_Name") & "")%></h6>
@@ -276,6 +291,15 @@ END IF
</div>
</div>
<!--/row-->
<% Else %>
<div class="text-center text-muted py-4">
<i class="zmdi zmdi-alert-circle zmdi-hc-3x"></i>
<p class="mt-2">No employee record found for SSO: <strong><%=Server.HTMLEncode(sso)%></strong></p>
<a href="./search.asp" class="btn btn-outline-primary btn-sm mt-2">
<i class="zmdi zmdi-search"></i> Search Again
</a>
</div>
<% End If %>
</div>
<div class="tab-pane" id="usbhistory">
@@ -526,6 +550,98 @@ End If
</div>
</div>
<div class="tab-pane" id="achievements">
<h5 class="mb-3"><i class="zmdi zmdi-star" style="color:#0d6efd;"></i> Achievements & Recognition</h5>
<%
' Query achievements from notifications table (Recognition type)
Dim objConnAchieve, achieveAvailable
achieveAvailable = False
On Error Resume Next
Set objConnAchieve = Server.CreateObject("ADODB.Connection")
objConnAchieve.ConnectionString = GetConnectionString()
objConnAchieve.Open
If Err.Number = 0 Then
achieveAvailable = True
Else
Err.Clear
End If
On Error Goto 0
If achieveAvailable And IsNumeric(sso) Then
' Get achievements for this SSO (all-time)
Dim cmdAchieve, rsAchieve
Dim achieveSQL, achieveCount
achieveCount = 0
' Recognition type ID is 5, search for SSO in employeesso field
achieveSQL = "SELECT n.notification, n.starttime " & _
"FROM notifications n " & _
"WHERE n.notificationtypeid = 5 " & _
"AND n.employeesso LIKE ? " & _
"ORDER BY n.starttime DESC"
Set cmdAchieve = Server.CreateObject("ADODB.Command")
cmdAchieve.ActiveConnection = objConnAchieve
cmdAchieve.CommandText = achieveSQL
cmdAchieve.CommandType = 1
cmdAchieve.Parameters.Append cmdAchieve.CreateParameter("@sso", 200, 1, 100, "%" & sso & "%")
On Error Resume Next
Set rsAchieve = cmdAchieve.Execute
If Err.Number = 0 Then
%>
<div class="list-group">
<%
Do While Not rsAchieve.EOF
achieveCount = achieveCount + 1
Dim achieveDate, achieveText
achieveDate = ""
achieveText = rsAchieve("notification") & ""
If Not IsNull(rsAchieve("starttime")) Then
achieveDate = FormatDateTime(rsAchieve("starttime"), 2)
End If
%>
<div class="list-group-item">
<div class="d-flex w-100 justify-content-between">
<h6 class="mb-1"><%=Server.HTMLEncode(achieveText)%></h6>
<small class="text-muted"><%=achieveDate%></small>
</div>
</div>
<%
rsAchieve.MoveNext
Loop
rsAchieve.Close
Set rsAchieve = Nothing
%>
</div>
<%
If achieveCount = 0 Then
%>
<div class="text-center text-muted py-4">
<i class="zmdi zmdi-star-outline zmdi-hc-3x"></i>
<p class="mt-2">No achievements recorded yet.</p>
</div>
<%
End If
End If
Set cmdAchieve = Nothing
objConnAchieve.Close
Set objConnAchieve = Nothing
Else
%>
<div class="alert alert-info">
<i class="zmdi zmdi-info"></i> Achievements not available.
</div>
<%
End If
%>
</div>
</div>
</div>
</div>