Skip to content

dev-lou/OJT-Qr-Pass

Repository files navigation



πŸŽ“ OJT Qr Pass β€” QR-Based Intern Attendance Utility

A fast, lightweight QR attendance tracker & printable ID generator

Created to help the ISUFST Dingle Campus Β· College of Information and Communications Technology


A practical utility built to make time tracking faster and simpler. Replaces slow paper logs with a quick QR scan interface, instant automated DTR reports, and printable QR passes for the department's interns.


πŸ“‹ Table of Contents


🌐 Overview

OJT Track is a production-ready web application designed to digitize and streamline the On-the-Job Training (OJT) attendance process for university departments. Built for the ISUFST Dingle Campus β€” CICT Department, the system replaces manual paper-based Daily Time Records (DTR) with a fast, accurate, and tamper-resistant QR code scanning workflow.

The platform provides two distinct role-based portals:

Role Access Capabilities
πŸ” Administrator /admin Dashboard analytics, QR scanning, intern management, DTR report generation, ID printing, leave request review
πŸ‘€ Intern /intern Personal QR code display, OJT progress tracking, attendance logbook, leave request submission

✨ Key Features

πŸ”΄ Admin Portal

Feature Description
πŸ“Š Real-Time Dashboard Live analytics showing morning & afternoon check-in/out counts, pending leave requests, and total intern stats β€” all in one view
πŸ“· QR Code Scanner Camera-based HTML5 QR scanner with support for Morning/Afternoon sessions, overtime override, and manual time entry for late arrivals
πŸ“΄ Offline Mode Scans are queued locally when internet is unavailable and automatically synced to Supabase when connectivity is restored
πŸ—‚ Intern Management Add, search, edit required hours, delete interns, and manage individual attendance logs with a paginated table
πŸ“… Attendance Logbook Full system-wide attendance log with Daily / Monthly / All-Time filtering, AM/PM session columns, and stale check-in detection
πŸ“„ Monthly DTR Reports Generate pixel-perfect PDF Daily Time Records per intern with ISUFST official letterhead, signature blocks, Late/Undertime flags, and bulk ZIP export for all interns
πŸ“€ CSV Export Export filtered attendance data as spreadsheet-ready .csv files per month
πŸͺͺ Printable ID Generator Auto-generate standard CR80 ID cards with embedded QR codes for all registered interns, optimized for print layout
βœ… Leave Request Review Approve or reject intern leave requests with optional admin notes from the dashboard

🟒 Intern Portal

Feature Description
πŸ“² Personal QR Pass Holographic-styled card with unique UUID-encoded QR code for scanning at the admin terminal
πŸ“ˆ OJT Progress Tracker Animated SVG donut chart showing rendered hours vs. required hours (default: 600h) with percentage completion
πŸ““ Attendance Logbook Filterable personal attendance log with AM/PM session columns, paginated and grouped by date
πŸ“† Leave Request System Submit excused absence requests with date and reason; track status (Pending / Approved / Rejected) with admin notes
✏️ Profile Self-Management Update full name, username, and password directly from the dashboard
πŸ“… Monthly Summary Quick glance at current month's hours rendered and days present

πŸ›  Tech Stack

Layer Technology Version
Framework Next.js (App Router) 16.1.6
UI Library React 19.2.3
Database & BaaS Supabase (PostgreSQL) 2.99.1
Animations Framer Motion 12.35.2
QR Scanning html5-qrcode 2.3.8
QR Generation react-qr-code 2.0.18
PDF Generation jsPDF 4.2.0
Canvas Rendering html2canvas 1.4.1
File Downloads file-saver 2.0.5
ZIP Packaging JSZip 3.10.1
Alert Dialogs SweetAlert2 11.26.22
Styling Vanilla CSS (Custom Properties / CSS Variables) β€”
Linting ESLint + eslint-config-next 9.x

πŸ— System Architecture

ojt-attendance/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/      # Live analytics & system logbook
β”‚   β”‚   β”‚   β”œβ”€β”€ scanner/        # QR camera scanner (offline-capable)
β”‚   β”‚   β”‚   β”œβ”€β”€ interns/        # Intern CRUD management
β”‚   β”‚   β”‚   β”œβ”€β”€ reports/        # DTR PDF & CSV export engine
β”‚   β”‚   β”‚   β”œβ”€β”€ ids/            # Printable QR ID card generator
β”‚   β”‚   β”‚   └── login/          # Admin authentication
β”‚   β”‚   β”œβ”€β”€ intern/
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/      # Personal QR pass, progress, logbook
β”‚   β”‚   β”‚   β”œβ”€β”€ login/          # Intern authentication
β”‚   β”‚   β”‚   └── register/       # Intern self-registration
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”‚   └── scan/           # Server-side scan processing endpoint
β”‚   β”‚   β”œβ”€β”€ globals.css         # Design system (CSS custom properties)
β”‚   β”‚   └── layout.js           # Root layout
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ CustomDatePicker.js       # Calendar date picker component
β”‚   β”‚   β”œβ”€β”€ CustomMonthPicker.js      # Month selector component
β”‚   β”‚   └── ManageAttendanceModal.js  # Per-intern attendance CRUD modal
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   └── supabase-browser.js       # Supabase client singleton
β”‚   └── utils/
β”‚       β”œβ”€β”€ time.js             # Manila timezone helpers & hour calculations
β”‚       β”œβ”€β”€ swal-configs.js     # SweetAlert2 themed alert presets
β”‚       β”œβ”€β”€ debounce.js         # QR scan debouncer & UUID validator
β”‚       β”œβ”€β”€ logo-isufst.js      # ISUFST logo (Base64) for PDF headers
β”‚       └── logo-bagong.js      # Bagong Pilipinas logo (Base64) for DTR
β”œβ”€β”€ database/
β”‚   └── supabase_schema.sql     # Full database schema (safe to re-run)
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ success.mp3             # Audio feedback on successful scan
β”‚   └── error.mp3               # Audio feedback on scan error
└── next.config.mjs

πŸ—„ Database Schema

The system uses 3 core tables in Supabase (PostgreSQL):

-- Registered OJT interns
interns (
  id              BIGINT PRIMARY KEY,
  uuid            UUID UNIQUE,          -- encoded in QR code
  full_name       TEXT,
  username        TEXT UNIQUE,
  password        TEXT,
  required_hours  NUMERIC DEFAULT 600,
  created_at, updated_at
)

-- Time-in / time-out records
attendance (
  id          BIGINT PRIMARY KEY,
  intern_id   BIGINT β†’ interns(id),
  time_in     TIMESTAMPTZ,
  time_out    TIMESTAMPTZ,             -- NULL while still checked in
  created_at
)

-- Excused absence requests
leave_requests (
  id            UUID PRIMARY KEY,
  intern_id     BIGINT β†’ interns(id),
  date_of_leave DATE,
  reason        TEXT,
  status        TEXT  CHECK (pending | approved | rejected),
  admin_notes   TEXT,
  created_at, updated_at
)

All tables include Row Level Security (RLS) policies and relevant indexes for performance. Auto-update triggers maintain updated_at fields automatically.


πŸ“Έ Screenshots & User Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     ADMIN FLOW                              β”‚
β”‚  Login β†’ Dashboard (stats + logbook) β†’ Scanner (QR cam)    β”‚
β”‚       β†’ Interns (CRUD) β†’ Reports (DTR PDF/CSV)             β”‚
β”‚       β†’ Printable IDs β†’ Leave Request Review               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     INTERN FLOW                             β”‚
β”‚  Register β†’ Login β†’ Dashboard (QR pass + progress chart)   β”‚
β”‚          β†’ Attendance Logbook β†’ Leave Request Submission    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  SCAN FLOW (QR Terminal)                    β”‚
β”‚  Select Session (AM/PM) + Mode (In/Out)                    β”‚
β”‚  β†’ Start Camera β†’ Intern presents QR β†’ UUID validated      β”‚
β”‚  β†’ POST /api/scan β†’ Supabase upsert β†’ Audio + Alert        β”‚
β”‚  [Offline] β†’ Queue to localStorage β†’ Sync on reconnect     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Getting Started

Prerequisites

  • Node.js β‰₯ 18.x
  • npm β‰₯ 9.x (or yarn / pnpm)
  • A Supabase project (free tier works)

1. Clone the Repository

git clone https://github.com/your-username/ojt-track.git
cd ojt-track

2. Install Dependencies

npm install

3. Configure Environment Variables

Create a .env.local file in the project root:

NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key-here

4. Set Up the Database

Copy the contents of database/supabase_schema.sql and run it in your Supabase SQL Editor. It is idempotent and safe to re-run.

5. Run the Development Server

npm run dev

Open http://localhost:3000 in your browser.

Default Admin Access: Navigate to /admin/login and use the credentials configured in your database or Supabase dashboard.


πŸ”‘ Environment Variables

Variable Required Description
NEXT_PUBLIC_SUPABASE_URL βœ… Yes Your Supabase project URL
NEXT_PUBLIC_SUPABASE_ANON_KEY βœ… Yes Supabase anonymous/public API key

⚠️ Never commit your .env.local file. It is already included in .gitignore.


πŸ“ Project Structure

src/
β”œβ”€β”€ app/                    # Next.js App Router pages
β”‚   β”œβ”€β”€ admin/              # Protected admin-only routes
β”‚   β”œβ”€β”€ intern/             # Intern self-service routes
β”‚   └── api/scan/           # REST API for QR scan processing
β”œβ”€β”€ components/             # Reusable UI components
β”œβ”€β”€ lib/                    # Third-party client configurations
└── utils/                  # Pure helper functions & shared configs

πŸ”Œ API Reference

POST /api/scan

Processes a QR code scan event (check-in or check-out).

Request Body:

{
  "uuid": "string",           // Intern's unique UUID from QR code
  "mode": "time-in | time-out",
  "sessionType": "morning | afternoon",
  "overtime": false,           // Override time restrictions
  "explicitTime": "ISO string | null"  // Manual time entry
}

Response (per result):

{
  "results": [
    {
      "status": "ok | duplicate | already_checked_out | not_checked_in | missing | invalid_time",
      "name": "Intern Full Name",
      "session": "morning | afternoon"
    }
  ]
}

Status Codes:

Status Meaning
ok Scan successfully recorded
duplicate Intern already scanned for this session today
already_checked_out Time-out already recorded
not_checked_in Time-out attempted without a prior time-in
missing UUID not found in database
invalid_time Scan attempted outside allowed session window

πŸ“¦ Deployment

This project is optimized for deployment on Vercel (recommended for Next.js).

Deploy to Vercel

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel --prod

Add your environment variables in the Vercel Dashboard β†’ Project Settings β†’ Environment Variables.

Build for Production (Self-hosted)

npm run build
npm start

Ensure your hosting environment supports Node.js β‰₯ 18.x and has the required environment variables set.



🀝 Contributing

This project was developed as a helpful utility for ISUFST Dingle Campus. Contributions, issue reports, and suggestions are welcome to make it even more useful for the department.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m 'feat: add your feature'
  4. Push to the branch: git push origin feature/your-feature
  5. Open a Pull Request

πŸ“œ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Lou Vincent Baroro
BS Information Technology Β· ISUFST Dingle Campus

Developed as a practical workflow tool to help the College of Information and Communications Technology (CICT) department streamline trainee attendance, hours tracking, and printable QR pass generation.


Built with ❀️ using Next.js, React, and Supabase

About

Resources

Stars

41 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors