✅ Company Standard: Annual Leave 8 days / year
✅ Company Standard: Sick Leave 14 days / year
Stack: Next.js 16 + Tailwind 4 + Supabase

🗄️ Supabase Database Schema

-- Profiles Table
create table profiles (
  id uuid references auth.users primary key,
  employee_id text unique not null,
  full_name text not null,
  email text unique not null,
  department text not null,
  manager_id uuid references profiles,
  join_date date not null,
  is_manager boolean default false,
  created_at timestamp default now()
);

-- Leave Balances Table
create table leave_balances (
  id uuid primary key default gen_random_uuid(),
  employee_id uuid references profiles not null,
  year int not null,
  leave_type text not null,
  total_days int not null,
  used_days int default 0,
  unique(employee_id, year, leave_type)
);

-- Leave Requests Table
create table leave_requests (
  id uuid primary key default gen_random_uuid(),
  employee_id uuid references profiles not null,
  leave_type text not null,
  start_date date not null,
  end_date date not null,
  total_days decimal(3,1) not null,
  reason text,
  status text default 'pending',
  approved_by uuid references profiles,
  created_at timestamp default now()
);

-- Attendance Table
create table attendances (
  id uuid primary key default gen_random_uuid(),
  employee_id uuid references profiles not null,
  check_in timestamp,
  check_out timestamp,
  status text default 'present'
);

🌱 Seed Data Example

-- 25 Employees Seed Data
insert into profiles (employee_id, full_name, department, is_manager) values
('BIG001', 'Nurul Aisyah Binti Omar', 'Management', true),
('BIG002', 'Lim Ah Keong', 'Engineering', false),
('BIG003', 'Suresh A/L Krishnan', 'Engineering', false),
('BIG004', 'Tan Mei Ling', 'Marketing', false),
('BIG005', 'Muhammad Hafiz', 'Operations', false),
-- + 20 more employees for all departments

-- Initialize Leave Balance for 2025
insert into leave_balances (employee_id, year, leave_type, total_days)
select id, 2025, 'annual', 8 from profiles union all
select id, 2025, 'sick', 14 from profiles union all
select id, 2025, 'emergency', 3 from profiles;

-- Sample Leave Requests
insert into leave_requests values
(gen_random_uuid(), (select id from profiles where employee_id='BIG002'),
'annual', '2025-06-12', '2025-06-14', 3, 'Family trip back to Penang',
'pending', null, now());