Comprehensive Leave Management
Our leave system is designed to be flexible while maintaining operational continuity.
Our leave system is designed to be flexible while maintaining operational continuity.




Exclusive documentation for System Administrator 8705. This section details the internal mechanics of the AJ STEEL HRMS.
Built using HTML5 Vanilla JS and CSS3. It is a Single Page Application (SPA) architecture that manages state locally to ensure high performance even on slow connections.
Powered by Node.js. The server handles API routing, authentication middleware, and secure communication with the database layer.
Uses Supabase (PostgreSQL). This provides robust relational data management with real-time sync capabilities for attendance logs.
Deployed on an Azure Virtual Machine (Ubuntu). Managed using PM2 for process monitoring and automatic restarts.
Step 1: The User Action (Frontend)
When an employee clicks "Apply for Leave," the JavaScript code creates a digital "package" containing the leave dates and the reason.
Step 2: The Secure Courier (HTTPS)
The Frontend sends this package over the internet using HTTPS. This ensures that no one can "eavesdrop" on the data while it's traveling.
Step 3: The Brain (Node.js & Express)
The envelope arrives at your Azure Virtual Machine. Express.js acts like a receptionist, directing the request to the correct department (API Endpoint), while Node.js processes the logic.
Step 4: The Storage (Supabase & TCP/IP)
The Brain sends a command to the Supabase Database through a TCP/IP connection (the secure phone line). The database saves the entry into its digital filing cabinet.
Step 5: The Confirmation
The message travels back: Database β Backend β Frontend. Finally, the user sees the Green Checkmark β
on their screen.
PM2: The "Security Guard" that keeps the system running 24/7 and restarts it instantly if it crashes.
TCP/IP: The "Secure Phone Line" used for reliable communication between the Server and the Database.
This section explains the core algorithms that drive the HRMS business logic.
Located in processAttendanceLogs, this engine converts raw punch strings into paired IN/OUT sessions.
IN, and after 14:00 as OUT.IN.// Direction Guessing Logic
if (isGeneral) {
dir = (hour < 14) ? 'in' : 'out';
} else {
const gap = timeMs - lastTime;
if (lastTime > 0 && gap > 16 * 60 * 60 * 1000) dir = 'in'; // Gap Reset
else if (gap > 600000) dir = (lastDir === 'in') ? 'out' : 'in'; // Toggle
}
The calculateOT function handles the complex arithmetic of payable hours.
// OT Formula
const potentialDur = outTime - nominalStart;
ot = Math.max(0, potentialDur - n - lateAdjustment);
For designated "Proxy" users, the system injects fuzzy punches if deadlines are missed.
The deployment is automated via a custom PowerShell script deploy.ps1. It uses scp to securely transfer files to the Azure production environment.
# Deployment Command
powershell -ExecutionPolicy Bypass -File .\deploy.ps1
# Target Server
IP: 40.119.176.75 (Azure)
User: azureuser
Path: /var/www/hrms
The heart of the system resides in calendar_logic.js. This script processes raw punch data from SmartOffice machines and applies business rules: