Files
shopdb/calendar.asp
cproudlock 65b622c361 Add USB checkout system and SSO profile page
New Features:
- USB Device checkout/check-in system with barcode scanning
  - displayusb.asp: List all USB devices with status
  - addusb.asp: Add new USB devices via barcode scan
  - checkout_usb.asp/savecheckout_usb.asp: Check out USB to SSO
  - checkin_usb.asp/savecheckin_usb.asp: Check in with wipe confirmation
  - usb_history.asp: Full checkout history with filters
  - api_usb.asp: JSON API for AJAX lookups
- displayprofile.asp: SSO profile page showing user info and USB history
- Date/time format changed to 12-hour (MM/DD/YYYY h:mm AM/PM)
- SSO links in USB history now link to profile page via search

Database:
- New machinetypeid 44 for USB devices
- New usb_checkouts table for tracking checkouts

Cleanup:
- Removed v2 folder (duplicate/old files)
- Removed old debug/test files
- Removed completed migration documentation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:16:14 -05:00

295 lines
9.4 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<!--#include file="./includes/header.asp"-->
<!--#include file="./includes/sql.asp"-->
<!-- FullCalendar CSS -->
<link href="assets/plugins/fullcalendar/css/fullcalendar.min.css" rel="stylesheet"/>
<style>
#calendar {
max-width: 1200px;
margin: 0 auto;
}
.fc-event {
cursor: pointer;
border: none;
padding: 2px 5px;
}
/* Notification type colors */
.fc-event.event-type-tbd {
background-color: #6c757d !important; /* Gray - TBD */
color: #fff !important;
}
.fc-event.event-type-awareness {
background-color: #28a745 !important; /* Green - Awareness */
color: #fff !important;
}
.fc-event.event-type-change {
background-color: #ffc107 !important; /* Yellow - Change */
color: #212529 !important; /* Dark text for yellow background */
}
.fc-event.event-type-incident {
background-color: #dc3545 !important; /* Red - Incident */
color: #fff !important;
}
/* Inactive notifications - slightly transparent */
.fc-event.event-inactive {
opacity: 0.6;
}
.fc-time {
font-weight: bold;
}
/* Minimal today indicator - just remove the ugly yellow background */
.fc-today {
background-color: rgba(102, 126, 234, 0.08) !important;
}
/* Popup background fixes for dark themes - ONLY targets the more popup */
.fc-popover.fc-more-popover {
background-color: #2a2a2a !important;
border: 1px solid #444 !important;
}
.fc-more-popover .fc-header.fc-widget-header {
background-color: #1e1e1e !important;
}
.fc-more-popover .fc-body.fc-widget-content {
background-color: #2a2a2a !important;
}
</style>
</head>
<%
theme = Request.Cookies("theme")
IF theme = "" THEN
theme="bg-theme1"
END IF
%>
<body class="bg-theme <%Response.Write(theme)%>">
<!-- start loader -->
<div id="pageloader-overlay" class="visible incoming"><div class="loader-wrapper-outer"><div class="loader-wrapper-inner" ><div class="loader"></div></div></div></div>
<!-- end loader -->
<!-- Start wrapper-->
<div id="wrapper">
<!--#include file="./includes/leftsidebar.asp"-->
<!--Start topbar header-->
<!--#include file="./includes/topbarheader.asp"-->
<!--End topbar header-->
<div class="clearfix"></div>
<div class="content-wrapper">
<div class="container-fluid">
<div class="row mt-3">
<div class="col-12">
<div class="card">
<div class="card-body">
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:20px;">
<h5 class="card-title" style="margin:0;">
<i class="zmdi zmdi-calendar"></i> Notification Calendar
</h5>
<div>
<a href="./shopfloor-dashboard/" class="btn btn-info" target="_blank">
<i class="zmdi zmdi-tv"></i> Shopfloor Display
</a>
<a href="./displaynotifications.asp" class="btn btn-secondary">
<i class="zmdi zmdi-view-list"></i> List View
</a>
<a href="./addnotification.asp" class="btn btn-primary">
<i class="zmdi zmdi-plus-circle"></i> Add Notification
</a>
</div>
</div>
<div id="calendar"></div>
</div>
</div>
</div>
</div><!--End Row-->
<!-- End container-fluid-->
</div><!--End content-wrapper-->
<!--Start Back To Top Button-->
<a href="javaScript:void();" class="back-to-top"><i class="fa fa-angle-double-up"></i> </a>
<!--End Back To Top Button-->
<!--Start footer-->
<footer class="footer">
<div class="container">
<div class="text-center">
</div>
</div>
</footer>
<!--End footer-->
</div><!--End wrapper-->
<!-- Bootstrap core JavaScript-->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<!-- simplebar js -->
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
<!-- sidebar-menu js -->
<script src="assets/js/sidebar-menu.js"></script>
<!-- Custom scripts -->
<script src="assets/js/app-script.js"></script>
<!-- FullCalendar JS -->
<script src="assets/plugins/fullcalendar/js/moment.min.js"></script>
<script src="assets/plugins/fullcalendar/js/fullcalendar.min.js"></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listMonth'
},
defaultView: 'month',
navLinks: true,
editable: false,
eventLimit: true,
events: [
<%
' Helper function to format datetime for FullCalendar (ISO 8601 format)
Function FormatDateISO(dt)
If IsNull(dt) Or dt = "" Then
FormatDateISO = ""
Else
FormatDateISO = Year(dt) & "-" & _
Right("0" & Month(dt), 2) & "-" & _
Right("0" & Day(dt), 2) & "T" & _
Right("0" & Hour(dt), 2) & ":" & _
Right("0" & Minute(dt), 2) & ":" & _
Right("0" & Second(dt), 2)
End If
End Function
' Fetch all ACTIVE notifications with type information and convert to FullCalendar events
Dim strSQL, rs, isFirst
strSQL = "SELECT n.notificationid, n.notification, n.starttime, n.endtime, n.isactive, n.ticketnumber, n.link, " & _
"nt.typename, nt.typecolor " & _
"FROM notifications n " & _
"LEFT JOIN notificationtypes nt ON n.notificationtypeid = nt.notificationtypeid " & _
"ORDER BY n.starttime ASC"
Set rs = objconn.Execute(strSQL)
isFirst = True
If Not rs.EOF Then
Do While Not rs.EOF
If Not isFirst Then
Response.Write("," & vbCrLf)
End If
isFirst = False
Dim notifTitle, notifStart, notifEnd, notifClass
' Properly escape JavaScript special characters
notifTitle = rs("notification") & ""
' Remove actual line breaks (replace with space)
notifTitle = Replace(notifTitle, vbCrLf, " ")
notifTitle = Replace(notifTitle, vbCr, " ")
notifTitle = Replace(notifTitle, vbLf, " ")
notifTitle = Replace(notifTitle, vbTab, " ")
' Escape backslashes first, then quotes
notifTitle = Replace(notifTitle, "\", "\\")
notifTitle = Replace(notifTitle, "'", "\'")
' Escape < and > to prevent </script> from breaking the JS block
notifTitle = Replace(notifTitle, "<", "\u003c")
notifTitle = Replace(notifTitle, ">", "\u003e")
notifStart = FormatDateISO(rs("starttime"))
' Handle NULL endtime - show ongoing notifications until end of current day
If IsNull(rs("endtime")) Or rs("endtime") = "" Then
' Indefinite notification - show until end of today (updates each day)
' This prevents ongoing notifications from cluttering future calendar dates
Dim todayDate
todayDate = Date() ' Current date without time
notifEnd = Year(todayDate) & "-" & _
Right("0" & Month(todayDate), 2) & "-" & _
Right("0" & Day(todayDate), 2) & "T23:59:59"
Else
notifEnd = FormatDateISO(rs("endtime"))
End If
' Determine event class based on notification type
Dim typeClass, typeName
If IsNull(rs("typename")) Or rs("typename") = "" Then
typeName = "TBD"
Else
typeName = rs("typename")
End If
' Map type name to CSS class
Select Case UCase(typeName)
Case "TBD"
notifClass = "event-type-tbd"
Case "AWARENESS"
notifClass = "event-type-awareness"
Case "CHANGE"
notifClass = "event-type-change"
Case "INCIDENT"
notifClass = "event-type-incident"
Case Else
notifClass = "event-type-tbd"
End Select
' Add indicator for indefinite notifications in title
Dim displayTitle
If IsNull(rs("endtime")) Or rs("endtime") = "" Then
displayTitle = notifTitle & " [ONGOING]"
Else
displayTitle = notifTitle
End If
Response.Write(" {" & vbCrLf)
Response.Write(" id: '" & rs("notificationid") & "'," & vbCrLf)
Response.Write(" title: '" & displayTitle & "'," & vbCrLf)
Response.Write(" start: '" & notifStart & "'," & vbCrLf)
Response.Write(" end: '" & notifEnd & "'," & vbCrLf)
Response.Write(" className: '" & notifClass & "'," & vbCrLf)
Response.Write(" allDay: false" & vbCrLf)
Response.Write(" }")
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
objConn.Close
%>
],
eventClick: function(event) {
// Redirect to edit notification page
window.location.href = './editnotification.asp?notificationid=' + event.id;
},
eventRender: function(event, element) {
// Add tooltip with full event details
element.attr('title', event.title);
}
});
});
</script>
</body>
</html>