The user wants a payroll calendar with:
- Off-cycle controls - ability to run payroll outside the regular schedule
- Funding windows - showing when funding needs to happen
This should be a functional, interactive calendar interface. Let me think about what features to include:
-
Calendar View - Monthly calendar showing:
- Regular pay dates (highlighted)
- Funding deadlines (different color)
- Time entry deadlines
- Approval deadlines
-
Off-Cycle Controls:
- Button to create off-cycle payroll runs
- Modal/form to configure off-cycle details
- List of pending/approved off-cycle requests
-
Funding Windows:
- Visual representation of funding windows
- Show when funds need to be transferred
- Countdown/timeline indicators
-
Interactive Elements:
- Click on dates to see details
- Filter by payroll type
- Legend for different event types
- Hover effects showing deadlines
-
Design:
- Professional, corporate feel
- Clear visual hierarchy
- Good contrast
- Not the typical purple/blue gradient - let's go with a darker theme with teal/cyan accents, or maybe a light theme with orange/amber accents for a business feel
Let me create a comprehensive, interactive payroll calendar system.
Design approach:
- Dark theme with high contrast
- Accent color: Teal/Cyan (#0ea5e9 or similar)
- Secondary accent: Amber for warnings/deadlines
- Clean, corporate aesthetic
- Grid-based calendar layout
- Side panel for controls and details
Features to implement:
- Monthly calendar navigation
- Payroll events on calendar (regular, off-cycle, funding windows)
- Click to add off-cycle payroll
- Funding window visualization
- Legend
- Statistics/summary panel
- Animations for interactions
Payroll Calendar with Off-Cycle Controls & Funding Windows
I'll create a professional, interactive payroll calendar system with:
- Monthly calendar view with payroll events
- Off-cycle payroll controls with a request modal
- Funding windows visualization with countdown timers
- Event filtering and detailed views
- Dynamic statistics panel
Here's the complete implementation:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payroll Calendar System</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--bg-primary: #0f172a;
--bg-secondary: #1e293b;
--bg-tertiary: #334155;
--text-primary: #f1f5f9;
--text-secondary: #94a3b8;
--text-muted: #64748b;
--accent-primary: #06b6d4;
--accent-secondary: #0891b2;
--accent-glow: rgba(6, 182, 212, 0.3);
--warning: #f59e0b;
--warning-bg: rgba(245, 158, 11, 0.15);
--success: #10b981;
--success-bg: rgba(16, 185, 129, 0.15);
--danger: #ef4444;
--danger-bg: rgba(239, 68, 68, 0.15);
--purple: #8b5cf6;
--purple-bg: rgba(139, 92, 246, 0.15);
--border: #475569;
--radius: 8px;
--shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
background: var(--bg-primary);
color: var(--text-primary);
min-height: 100vh;
overflow-x: hidden;
}
/* Background animation */
.bg-pattern {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 0;
opacity: 0.5;
}
.bg-pattern::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: radial-gradient(circle at 20% 30%, var(--accent-glow) 0%, transparent 40%),
radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.15) 0%, transparent 40%);
animation: bgPulse 15s ease-in-out infinite;
}
@keyframes bgPulse {
0%, 100% { transform: translate(0, 0) scale(1); }
50% { transform: translate(-2%, 2%) scale(1.05); }
}
.container {
position: relative;
z-index: 1;
max-width: 1600px;
margin: 0 auto;
padding: 20px;
}
/* Header */
header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 24px;
padding-bottom: 20px;
border-bottom: 1px solid var(--border);
}
.logo {
display: flex;
align-items: center;
gap: 12px;
}
.logo-icon {
width: 48px;
height: 48px;
background: linear-gradient(135deg, var(--accent-primary), var(--purple));
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 20px;
}
.logo h1 {
font-size: 24px;
font-weight: 600;
}
.logo span {
font-size: 12px;
color: var(--text-secondary);
display: block;
}
.header-actions {
display: flex;
gap: 12px;
}
/* Buttons */
.btn {
padding: 10px 20px;
border-radius: var(--radius);
border: none;
cursor: pointer;
font-size: 14px;
font-weight: 500;
display: flex;
align-items: center;
gap: 8px;
transition: all 0.2s ease;
}
.btn-primary {
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
color: var(--bg-primary);
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-secondary {
background: var(--bg-tertiary);
color: var(--text-primary);
border: 1px solid var(--border);
}
.btn-secondary:hover {
background: var(--border);
}
.btn-danger {
background: var(--danger-bg);
color: var(--danger);
border: 1px solid var(--danger);
}
.btn-danger:hover {
background: var(--danger);
color: white;
}
/* Main Layout */
.main-grid {
display: grid;
grid-template-columns: 300px 1fr 280px;
gap: 20px;
}
@media (max-width: 1200px) {
.main-grid {
grid-template-columns: 1fr;
}
}
/* Cards */
.card {
background: var(--bg-secondary);
border-radius: 12px;
border: 1px solid var(--border);
overflow: hidden;
}
.card-header {
padding: 16px 20px;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
}
.card-header h3 {
font-size: 16px;
font-weight: 600;
}
.card-body {
padding: 20px;
}
/* Stats Panel */
.stat-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid var(--border);
}
.stat-item:last-child {
border-bottom: none;
}
.stat-label {
color: var(--text-secondary);
font-size: 14px;
}
.stat-value {
font-size: 18px;
font-weight: 600;
}
.stat-value.positive {
color: var(--success);
}
.stat-value.warning {
color: var(--warning);
}
/* Calendar */
.calendar-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 20px;
border-bottom: 1px solid var(--border);
}
.calendar-nav {
display: flex;
align-items: center;
gap: 16px;
}
.calendar-nav button {
width: 36px;
height: 36px;
border-radius: 8px;
background: var(--bg-tertiary);
border: 1px solid var(--border);
color: var(--text-primary);
cursor: pointer;
transition: all 0.2s;
}
.calendar-nav button:hover {
background: var(--accent-primary);
color: var(--bg-primary);
}
.calendar-nav h2 {
font-size: 20px;
min-width: 180px;
text-align: center;
}
.calendar-grid {
display: grid;
grid-template-columns: repeat(7, 1fr);
}
.calendar-day-header {
padding: 12px;
text-align: center;
font-size: 12px;
font-weight: 600;
color: var(--text-secondary);
text-transform: uppercase;
background: var(--bg-tertiary);
}
.calendar-day {
min-height: 100px;
padding: 8px;
border: 1px solid var(--border);
border-top: none;
cursor: pointer;
transition: all 0.2s;
position: relative;
}
.calendar-day:nth-child(7n) {
border-right: none;
}
.calendar-day:nth-child(7n+1) {
border-left: none;
}
.calendar-day:hover {
background: var(--bg-tertiary);
}
.calendar-day.other-month {
background: rgba(0, 0, 0, 0.2);
}
.calendar-day.other-month .day-number {
color: var(--text-muted);
}
.calendar-day.today {
background: var(--accent-glow);
}
.calendar-day.today .day-number {
background: var(--accent-primary);
color: var(--bg-primary);
}
.day-number {
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
font-size: 14px;
font-weight: 500;
margin-bottom: 4px;
}
.day-events {
display: flex;
flex-direction: column;
gap: 2px;
}
.event-pill {
font-size: 10px;
padding: 3px 6px;
border-radius: 4px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
transition: all 0.2s;
}
.event-pill:hover {
transform: scale(1.02);
}
.event-pill.payroll {
background: var(--success-bg);
color: var(--success);
border-left: 3px solid var(--success);
}
.event-pill.funding {
background: var(--warning-bg);
color: var(--warning);
border-left: 3px solid var(--warning);
}
.event-pill.off-cycle {
background: var(--danger-bg);
color: var(--danger);
border-left: 3px solid var(--danger);
}
.event-pill.deadline {
background: var(--purple-bg);
color: var(--purple);
border-left: 3px solid var(--purple);
}
/* Legend */
.legend {
display: flex;
flex-wrap: wrap;
gap: 12px;
padding: 12px 20px;
background: var(--bg-tertiary);
border-top: 1px solid var(--border);
}
.legend-item {
display: flex;
align-items: center;
gap: 6px;
font-size: 12px;
color: var(--text-secondary);
}
.legend-dot {
width: 10px;
height: 10px;
border-radius: 3px;
}
.legend-dot.payroll { background: var(--success); }
.legend-dot.funding { background: var(--warning); }
.legend-dot.off-cycle { background: var(--danger); }
.legend-dot.deadline { background: var(--purple); }
/* Funding Windows */
.funding-window {
padding: 16px;
border-radius: 8px;
margin-bottom: 12px;
border: 1px solid var(--border);
background: var(--bg-tertiary);
transition: all 0.3s;
}
.funding-window:hover {
border-color: var(--warning);
}
.funding-window-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 8px;
}
.funding-window-title {
font-size: 14px;
font-weight: 600;
}
.funding-window-amount {
font-size: 16px;
font-weight: 700;
color: var(--warning);
}
.funding-window-date {
font-size: 12px;
color: var(--text-secondary);
margin-bottom: 8px;
}
.funding-progress {
height: 4px;
background: var(--bg-secondary);
border-radius: 2px;
overflow: hidden;
}
.funding-progress-bar {
height: 100%;
background: linear-gradient(90deg, var(--warning), var(--success));
transition: width 0.5s ease;
}
.countdown {
display: flex;
gap: 8px;
margin-top: 8px;
}
.countdown-item {
text-align: center;
flex: 1;
}
.countdown-value {
font-size: 18px;
font-weight: 700;
color: var(--accent-primary);
}
.countdown-label {
font-size: 10px;
color: var(--text-muted);
}
/* Off-Cycle List */
.off-cycle-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px;
background: var(--bg-tertiary);
border-radius: 8px;
margin-bottom: 8px;
border: 1px solid var(--border);
transition: all 0.2s;
}
.off-cycle-item:hover {
border-color: var(--danger);
}
.off-cycle-info h4 {
font-size: 14px;
margin-bottom: 4px;
}
.off-cycle-info p {
font-size: 12px;
color: var(--text-secondary);
}
.off-cycle-status {
padding: 4px 10px;
border-radius: 12px;
font-size: 11px;
font-weight: 600;
}
.off-cycle-status.pending {
background: var(--warning-bg);
color: var(--warning);
}
.off-cycle-status.approved {
background: var(--success-bg);
color: var(--success);
}
/* Modal */
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
opacity: 0;
visibility: hidden;
transition: all 0.3s;
}
.modal-overlay.active {
opacity: 1;
visibility: visible;
}
.modal {
background: var(--bg-secondary);
border-radius: 16px;
border: 1px solid var(--border);
width: 90%;
max-width: 500px;
transform: scale(0.9) translateY(20px);
transition: all 0.3s;
}
.modal-overlay.active .modal {
transform: scale(1) translateY(0);
}
.modal-header {
padding: 20px 24px;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header h2 {
font-size: 18px;
}
.modal-close {
width: 32px;
height: 32px;
border-radius: 8px;
background: var(--bg-tertiary);
border: none;
color: var(--text-primary);
cursor: pointer;
font-size: 18px;
transition: all 0.2s;
}
.modal-close:hover {
background: var(--danger);
}
.modal-body {
padding: 24px;
}
.form-group {
margin-bottom: 20px;
}
.form-group label {
display: block;
font-size: 14px;
font-weight: 500;
margin-bottom: 8px;
color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
width: 100%;
padding: 12px;
background: var(--bg-tertiary);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text-primary);
font-size: 14px;
transition: all 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
outline: none;
border-color: var(--accent-primary);
box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16px;
}
.modal-footer {
padding: 16px 24px;
border-top: 1px solid var(--border);
display: flex;
justify-content: flex-end;
gap: 12px;
}
/* Filters */
.filters {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.filter-btn {
padding: 6px 12px;
border-radius: 6px;
border: 1px solid var(--border);
background: transparent;
color: var(--text-secondary);
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
}
.filter-btn:hover,
.filter-btn.active {
background: var(--accent-primary);
color: var(--bg-primary);
border-color: var(--accent-primary);
}
/* Tooltip */
.tooltip {
position: absolute;
background: var(--bg-primary);
border: 1px solid var(--border);
border-radius: 8px;
padding: 12px;
font-size: 12px;
z-index: 100;
min-width: 200px;
box-shadow: var(--shadow);
opacity: 0;
visibility: hidden;
transition: all 0.2s;
pointer-events: none;
}
.tooltip.active {
opacity: 1;
visibility: visible;
}
.tooltip h4 {
margin-bottom: 8px;
color: var(--text-primary);
}
.tooltip p {
color: var(--text-secondary);
margin-bottom: 4px;
}
/* Animations */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.animate-in {
animation: fadeInUp 0.5s ease forwards;
}
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
/* Responsive */
@media (max-width: 768px) {
.header-actions {
flex-wrap: wrap;
}
.calendar-day {
min-height: 70px;
}
.event-pill {
font-size: 9px;
padding: 2px 4px;
}
.form-row {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="bg-pattern"></div>
<div class="container">
<header class="animate-in">
<div class="logo">
<div class="logo-icon">PC</div>
<div>
<h1>Payroll Calendar</h1>
<span>Off-Cycle Controls & Funding Windows</span>
</div>
</div>
<div class="header-actions">
<button class="btn btn-secondary" onclick="exportCalendar()">
<span>Export</span>
</button>
<button class="btn btn-primary" onclick="openOffCycleModal()">
<span>+ Off-Cycle Run</span>
</button>
</div>
</header>
<div class="main-grid">
<!-- Left Panel -->
<div class="animate-in delay-1">
<div class="card" style="margin-bottom: 20px;">
<div class="card-header">
<h3>Pay Period Summary</h3>
</div>
<div class="card-body">
<div class="stat-item">
<span class="stat-label">Total Payroll</span>
<span class="stat-value">$2,847,500</span>
</div>
<div class="stat-item">
<span class="stat-label">Employees</span>
<span class="stat-value">1,247</span>
</div>
<div class="stat-item">
<span class="stat-label">Pending Approvals</span>
<span class="stat-value warning">3</span>
</div>
<div class="stat-item">
<span class="stat-label">Next Pay Date</span>
<span class="stat-value positive">Jan 15</span>
</div>
</div>
</div>
<div class="card">
<div class="card-header">
<h3>Off-Cycle Requests</h3>
</div>
<div class="card-body" id="offCycleList">
<!-- Populated by JS -->
</div>
</div>
</div>
<!-- Calendar -->
<div class="card animate-in delay-2">
<div class="calendar-header">
<div class="calendar-nav">
<button onclick="prevMonth()">‹</button>
<h2 id="currentMonth">January 2025</h2>
<button onclick="nextMonth()">›</button>
</div>
<div class="filters">
<button class="filter-btn active" data-filter="all">All</button>
<button class="filter-btn" data-filter="payroll">Payroll</button>
<button class="filter-btn" data-filter="funding">Funding</button>
<button class="filter-btn" data-filter="off-cycle">Off-Cycle</button>
<button class="filter-btn" data-filter="deadline">Deadlines</button>
</div>
</div>
<div class="calendar-grid" id="calendarGrid">
<!-- Populated by JS -->
</div>
<div class="legend">
<div class="legend-item">
<div class="legend-dot payroll"></div>
<span>Regular Payroll</span>
</div>
<div class="legend-item">
<div class="legend-dot funding"></div>
<span>Funding Window</span>
</div>
<div class="legend-item">
<div class="legend-dot off-cycle"></div>
<span>Off-Cycle Run</span>
</div>
<div class="legend-item">
<div class="legend-dot deadline"></div>
<span>Deadline</span>
</div>
</div>
</div>
<!-- Right Panel -->
<div class="animate-in delay-3">
<div class="card" style="margin-bottom: 20px;">
<div class="card-header">
<h3>Funding Windows</h3>
</div>
<div class="card-body" id="fundingWindows">
<!-- Populated by JS -->
</div>
</div>
<div class="card">
<div class="card-header">
<h3>Upcoming Deadlines</h3>
</div>
<div class="card-body" id="deadlinesList">
<!-- Populated by JS -->
</div>
</div>
</div>
</div>
</div>
<!-- Off-Cycle Modal -->
<div class="modal-overlay" id="offCycleModal">
<div class="modal">
<div class="modal-header">
<h2>Request Off-Cycle Payroll</h2>
<button class="modal-close" onclick="closeOffCycleModal()">×</button>
</div>
<div class="modal-body">
<form id="offCycleForm">
<div class="form-group">
<label>Run Type</label>
<select id="runType">
<option value="bonus">Bonus Payment</option>
<option value="correction">Pay Correction</option>
<option value="termination">Termination Pay</option>
<option value="commission">Commission</option>
<option value="manual">Manual Check</option>
</select>
</div>
<div class="form-row">
<div class="form-group">
<label>Process Date</label>
<input type="date" id="processDate">
</div>
<div class="form-group">
<label>Pay Date</label>
<input type="date" id="payDate">
</div>
</div>
<div class="form-group">
<label>Amount</label>
<input type="text" id="amount" placeholder="$0.00">
</div>
<div class="form-group">
<label>Employees / Departments</label>
<select id="employees">
<option value="all">All Employees</option>
<option value="engineering">Engineering</option>
<option value="sales">Sales</option>
<option value="hr">HR</option>
<option value="selected">Selected Employees</option>
</select>
</div>
<div class="form-group">
<label>Justification</label>
<textarea id="justification" rows="3" placeholder="Enter reason for off-cycle run..."></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" onclick="closeOffCycleModal()">Cancel</button>
<button class="btn btn-primary" onclick="submitOffCycle()">Submit Request</button>
</div>
</div>
</div>
<!-- Tooltip -->
<div class="tooltip" id="tooltip"></div>
<script>
// Data
const payrollEvents = [
{ id: 1, date: '2025-01-15', type: 'payroll', title: 'Regular Payroll', amount: 2847500, status: 'scheduled' },
{ id: 2, date: '2025-01-31', type: 'payroll', title: 'Regular Payroll', amount: 2847500, status: 'scheduled' },
{ id: 3, date: '2025-01-10', type: 'funding', title: 'Funding Window', amount: 2847500, status: 'open' },
{ id: 4, date: '2025-01-26', type: 'funding', title: 'Funding Window', amount: 2847500, status: 'open' },
{ id: 5, date: '2025-01-08', type: 'deadline', title: 'Time Entry Due', description: 'All time entries must be submitted' },
{ id: 6, date: '2025-01-24', type: 'deadline', title: 'Time Entry Due', description: 'All time entries must be submitted' },
{ id: 7, date: '2025-01-12', type: 'deadline', title: 'Manager Approval', description: 'Manager approvals due by 5PM' },
{ id: 8, date: '2025-01-28', type: 'deadline', title: 'Manager Approval', description: 'Manager approvals due by 5PM' },
{ id: 9, date: '2025-01-20', type: 'off-cycle', title: 'Bonus Run', amount: 125000, status: 'pending' },
{ id: 10, date: '2025-02-15', type: 'payroll', title: 'Regular Payroll', amount: 2847500, status: 'scheduled' },
{ id: 11, date: '2025-02-28', type: 'payroll', title: 'Regular Payroll', amount: 2847500, status: 'scheduled' },
];
const offCycleRequests = [
{ id: 1, type: 'Bonus Payment', date: 'Jan 20, 2025', amount: 125000, status: 'pending' },
{ id: 2, type: 'Pay Correction', date: 'Jan 10, 2025', amount: 2450, status: 'approved' },
{ id: 3, type: 'Termination', date: 'Jan 8, 2025', amount: 8750, status: 'approved' },
];
const fundingWindows = [
{ id: 1, title: 'Q1 Payroll Funding', date: 'Jan 10, 2025', amount: 2847500, progress: 75, days: 2, hours: 14, mins: 32 },
{ id: 2, title: 'End of Month', date: 'Jan 26, 2025', amount: 2847500, progress: 0, days: 18, hours: 6, mins: 45 },
];
const deadlines = [
{ title: 'Time Entry Closes', date: 'Jan 8', urgent: true },
{ title: 'Manager Approvals', date: 'Jan 12', urgent: false },
{ title: 'Funding Transfer', date: 'Jan 10', urgent: true },
{ title: 'Payroll Review', date: 'Jan 14', urgent: false },
];
// Calendar state
let currentDate = new Date(2025, 0, 1);
let currentFilter = 'all';
// Initialize
document.addEventListener('DOMContentLoaded', () => {
renderCalendar();
renderOffCycleList();
renderFundingWindows();
renderDeadlines();
setupFilters();
updateCountdowns();
setInterval(updateCountdowns, 1000);
});
// Render calendar
function renderCalendar() {
const grid = document.getElementById('calendarGrid');
const monthNames = ['January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'];
document.getElementById('currentMonth').textContent =
`${monthNames[currentDate.getMonth()]} ${currentDate.getFullYear()}`;
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
let html = days.map(d => `<div class="calendar-day-header">${d}</div>`).join('');
const firstDay = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
const lastDay = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
const startPadding = firstDay.getDay();
const totalDays = lastDay.getDate();
const today = new Date();
// Previous month days
const prevMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0);
for (let i = startPadding - 1; i >= 0; i--) {
const day = prevMonth.getDate() - i;
html += `<div class="calendar-day other-month">
<div class="day-number">${day}</div>
</div>`;
}
// Current month days
for (let day = 1; day <= totalDays; day++) {
const dateStr = `${currentDate.getFullYear()}-${String(currentDate.getMonth() + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
const isToday = today.getDate() === day &&
today.getMonth() === currentDate.getMonth() &&
today.getFullYear() === currentDate.getFullYear();
const dayEvents = payrollEvents.filter(e => e.date === dateStr);
const filteredEvents = currentFilter === 'all'
? dayEvents
: dayEvents.filter(e => e.type === currentFilter);
html += `<div class="calendar-day${isToday ? ' today' : ''}" data-date="${dateStr}" onclick="selectDate('${dateStr}')">
<div class="day-number">${day}</div>
<div class="day-events">
${filteredEvents.map(e => `
<div class="event-pill ${e.type}"
onmouseenter="showTooltip(event, ${JSON.stringify(e).replace(/"/g, '"')})"
onmouseleave="hideTooltip()">
${e.title}
</div>
`).join('')}
</div>
</div>`;
}
// Next month days
const endPadding = (7 - ((startPadding + totalDays) % 7)) % 7;
for (let i = 1; i <= endPadding; i++) {
html += `<div class="calendar-day other-month">
<div class="day-number">${i}</div>
</div>`;
}
grid.innerHTML = html;
}
function prevMonth() {
currentDate.setMonth(currentDate.getMonth() - 1);
renderCalendar();
}
function nextMonth() {
currentDate.setMonth(currentDate.getMonth() + 1);
renderCalendar();
}
// Render off-cycle list
function renderOffCycleList() {
const list = document.getElementById('offCycleList');
list.innerHTML = offCycleRequests.map(r => `
<div class="off-cycle-item">
<div class="off-cycle-info">
<h4>${r.type}</h4>
<p>${r.date} - $${r.amount.toLocaleString()}</p>
</div>
<span class="off-cycle-status ${r.status}">${r.status}</span>
</div>
`).join('');
}
// Render funding windows
function renderFundingWindows() {
const container = document.getElementById('fundingWindows');
container.innerHTML = fundingWindows.map(w => `
<div class="funding-window">
<div class="funding-window-header">
<div class="funding-window-title">${w.title}</div>
<div class="funding-window-amount">$${(w.amount / 1000000).toFixed(2)}M</div>
</div>
<div class="funding-window-date">Funding Date: ${w.date}</div>
<div class="funding-progress">
<div class="funding-progress-bar" style="width: ${w.progress}%"></div>
</div>
<div class="countdown" data-id="${w.id}">
<div class="countdown-item">
<div class="countdown-value days">${w.days}</div>
<div class="countdown-label">Days</div>
</div>
<div class="countdown-item">
<div class="countdown-value hours">${w.hours}</div>
<div class="countdown-label">Hrs</div>
</div>
<div class="countdown-item">
<div class="countdown-value mins">${w.mins}</div>
<div class="countdown-label">Min</div>
</div>
</div>
</div>
`).join('');
}
// Render deadlines
function renderDeadlines() {
const list = document.getElementById('deadlinesList');
list.innerHTML = deadlines.map(d => `
<div class="stat-item">
<div>
<span class="stat-label" style="color: ${d.urgent ? 'var(--danger)' : 'var(--text-secondary)'}">${d.title}</span>
</div>
<span class="stat-value" style="font-size: 14px; color: ${d.urgent ? 'var(--danger)' : 'var(--text-primary)'}">${d.date}</span>
</div>
`).join('');
}
// Setup filters
function setupFilters() {
document.querySelectorAll('.filter-btn').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.filter-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
currentFilter = btn.dataset.filter;
renderCalendar();
});
});
}
// Update countdowns
function updateCountdowns() {
fundingWindows.forEach(w => {
if (w.mins > 0) {
w.mins--;
} else if (w.hours > 0) {
w.hours--;
w.mins = 59;
} else if (w.days > 0) {
w.days--;
w.hours = 23;
w.mins = 59;
}
});
document.querySelectorAll('.countdown').forEach(el => {
const id = parseInt(el.dataset.id);
const w = fundingWindows.find(fw => fw.id === id);
if (w) {
el.querySelector('.days').textContent = w.days;
el.querySelector('.hours').textContent = w.hours;
el.querySelector('.mins').textContent = w.mins;
}
});
}
// Modal functions
function openOffCycleModal() {
document.getElementById('offCycleModal').classList.add('active');
document.getElementById('processDate').valueAsDate = new Date();
document.getElementById('payDate').valueAsDate = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);
}
function closeOffCycleModal() {
document.getElementById('offCycleModal').classList.remove('active');
}
function submitOffCycle() {
const type = document.getElementById('runType').value;
const payDate = document.getElementById('payDate').value;
const amount = document.getElementById('amount').value;
const typeLabels = {
bonus: 'Bonus Payment',
correction: 'Pay Correction',
termination: 'Termination',
commission: 'Commission',
manual: 'Manual Check'
};
offCycleRequests.unshift({
id: offCycleRequests.length + 1,
type: typeLabels[type],
date: new Date(payDate).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }),
amount: parseFloat(amount.replace(/[$,]/g, '')) || 0,
status: 'pending'
});
// Add to calendar
payrollEvents.push({
id: payrollEvents.length + 1,
date: payDate,
type: 'off-cycle',
title: typeLabels[type],
amount: parseFloat(amount.replace(/[$,]/g, '')) || 0,
status: 'pending'
});
renderOffCycleList();
renderCalendar();
closeOffCycleModal();
// Show confirmation
alert('Off-cycle payroll request submitted for approval.');
}
// Tooltip
function showTooltip(event, data) {
const tooltip = document.getElementById('tooltip');
let content = `<h4>${data.title}</h4>`;
if (data.amount) {
content += `<p><strong>Amount:</strong> $${data.amount.toLocaleString()}</p>`;
}
if (data.description) {
content += `<p>${data.description}</p>`;
}
content += `<p><strong>Status:</strong> ${data.status || 'Scheduled'}</p>`;
tooltip.innerHTML = content;
tooltip.classList.add('active');
const rect = event.target.getBoundingClientRect();
tooltip.style.left = rect.left + 'px';
tooltip.style.top = (rect.bottom + 8) + 'px';
}
function hideTooltip() {
document.getElementById('tooltip').classList.remove('active');
}
function selectDate(dateStr) {
console.log('Selected date:', dateStr);
// Could open a day detail view
}
function exportCalendar() {
alert('Calendar exported to Excel format.');
}
// Close modal on outside click
document.getElementById('offCycleModal').addEventListener('click', (e) => {
if (e.target.id === 'offCycleModal') {
closeOffCycleModal();
}
});
// Keyboard shortcuts
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
closeOffCycleModal();
}
});
</script>
</body>
</html>
Key Features Implemented:
1. Interactive Calendar
- Monthly navigation with smooth transitions
- Color-coded events (payroll, funding, off-cycle, deadlines)
- Today highlighting
- Hover tooltips with event details
- Filter by event type
2. Off-Cycle Controls
- Request modal with full form
- Run type selection (bonus, correction, termination, etc.)
- Date pickers for process and pay dates
- Amount and employee selection
- Justification field
- Live updating off-cycle request list
3. Funding Windows
- Visual progress bars showing funding status
- Live countdown timers (days, hours, minutes)
- Amount display
- Funding dates clearly shown
4. Dynamic Elements
- Animated background with gradient pulse
- Hover effects on all interactive elements
- Smooth modal transitions
- Real-time countdown updates
- Event filtering with immediate feedback
5. Statistics Panel
- Total payroll summary
- Employee count
- Pending approvals counter
- Next pay date display
The design uses a dark theme with cyan/teal accents and amber warnings, providing excellent contrast and a professional financial application feel.