# awabwdbashry-sketch/employee_attendance architecture

> Architecture diagram of the GitHub repository awabwdbashry-sketch/employee_attendance, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/awabwdbashry-sketch/employee_attendance
- Repository: https://github.com/awabwdbashry-sketch/employee_attendance

## Overview

This is a PHP/MySQL employee attendance and leave-management web application for employees, managers, and HR administrators. Employees use the dashboard to reach signed QR attendance or submit leave requests; managers and admins review requests, while administrators maintain staff, organization structure, schedules, and audit settings. Attendance, leave, notifications, dashboards, and reports are distinct functional areas. Shared PHP modules provide authentication, policy calculations, and presentation. The graph follows documented capabilities and visible references; unsampled areas are included at their exact tree paths, with uncertain runtime links omitted.

Main entry points: [`includes/leave.php`](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/leave.php) (Leave rules and balances), [`includes/attendance.php`](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/attendance.php) (Attendance rules), [`config/db.example.php`](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/config/db.example.php) (MySQL data), [`includes/layout.php`](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/layout.php) (Page layout and guards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and dashboards"]
  node_auth["Login and session<br/>[login.php]"]
  node_dashboard["Role dashboards<br/>[index.php]"]
  node_shared["Shared access utilities<br/>[functions.php]"]
  node_layout["Page layout and guards<br/>[layout.php]"]
  node_dash_logic["Dashboard data<br/>[dash.php]"]
end

subgraph group_workforce["Workforce administration"]
  node_employees["Employee records<br/>[form.php]"]
  node_employee_profile["Employee profile<br/>[view.php]"]
  node_departments["Departments<br/>[index.php]"]
  node_positions["Positions<br/>[index.php]"]
end

subgraph group_attendance["Attendance"]
  node_attendance_ui["Scan and attendance views<br/>[scan.php]"]
  node_scan_api["QR scan endpoint<br/>[api_scan.php]"]
  node_qr_check["Signed QR verification<br/>[check.php]"]
  node_attendance_logic["Attendance rules<br/>[attendance.php]"]
  node_employee_qr["Employee QR token<br/>[qr_token.php]"]
  node_attendance_history["History and calendar<br/>[history.php]"]
end

subgraph group_leave["Leave management"]
  node_leave_request["Employee leave requests<br/>[leaves.php]"]
  node_leave_rules["Leave rules and balances<br/>[leave.php]"]
  node_leave_admin["Approvals and leave setup<br/>[approvals.php]"]
  node_leave_calendar["Leave calendar<br/>[calendar.php]"]
end

subgraph group_insight["Insights and operations"]
  node_reports_logic["Report functions<br/>[reports.php]"]
  node_reports_ui["Attendance and leave reports<br/>[attendance.php]"]
  node_notifications["Notifications<br/>[index.php]"]
  node_settings["Schedule and holidays<br/>[index.php]"]
  node_audit["Audit log<br/>[audit.php]"]
end

node_employee(("Employee / manager / admin"))
node_database[("MySQL data<br/>[db.example.php]")]

node_employee -->|"signs in"| node_auth
node_auth -->|"checks session"| node_shared
node_dashboard -->|"loads layout"| node_layout
node_dashboard -->|"loads dashboard data"| node_dash_logic
node_dash_logic -->|"uses attendance rules"| node_attendance_logic
node_employees -->|"loads layout"| node_layout
node_employee_profile -->|"uses attendance logic"| node_attendance_logic
node_departments -->|"loads layout"| node_layout
node_positions -->|"loads layout"| node_layout
node_attendance_ui -->|"loads layout"| node_layout
node_scan_api -->|"records attendance"| node_attendance_logic
node_qr_check -->|"verifies QR"| node_attendance_logic
node_employee_qr -->|"creates QR token"| node_attendance_logic
node_attendance_logic -->|"checks leave and holidays"| node_leave_rules
node_attendance_history -->|"loads leave rules"| node_leave_rules
node_leave_request -->|"uses leave rules"| node_leave_rules
node_leave_admin -->|"uses leave rules"| node_leave_rules
node_leave_calendar -->|"uses leave rules"| node_leave_rules
node_reports_ui -->|"builds reports"| node_reports_logic
node_reports_logic -->|"loads leave rules"| node_leave_rules
node_notifications -->|"loads layout"| node_layout
node_settings -->|"uses settings helpers"| node_leave_rules
node_auth -.->|"queries data"| node_database
node_attendance_logic -.->|"reads and writes records"| node_database
node_leave_rules -.->|"reads and writes records"| node_database
node_dashboard -.->|"queries dashboard data"| node_database
node_reports_logic -.->|"queries report data"| node_database
node_settings -.->|"stores settings"| node_database
node_notifications -.->|"reads notifications"| node_database
node_audit -.->|"uses shared utilities"| node_shared

click node_auth "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/login.php"
click node_dashboard "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/index.php"
click node_shared "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/functions.php"
click node_layout "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/layout.php"
click node_employees "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employees/form.php"
click node_employee_profile "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employees/view.php"
click node_departments "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/departments/index.php"
click node_positions "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/positions/index.php"
click node_attendance_ui "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/scan.php"
click node_scan_api "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/api_scan.php"
click node_qr_check "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/check.php"
click node_attendance_logic "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/attendance.php"
click node_employee_qr "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employees/qr_token.php"
click node_attendance_history "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/history.php"
click node_leave_request "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employee/leaves.php"
click node_leave_rules "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/leave.php"
click node_leave_admin "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/leaves/approvals.php"
click node_leave_calendar "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/leaves/calendar.php"
click node_reports_logic "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/reports.php"
click node_reports_ui "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/reports/attendance.php"
click node_notifications "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/notifications/index.php"
click node_settings "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/settings/index.php"
click node_audit "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/settings/audit.php"
click node_dash_logic "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/dash.php"
click node_database "https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/config/db.example.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth,node_dashboard,node_shared,node_layout,node_dash_logic toneBlue
class node_employees,node_employee_profile,node_departments,node_positions,node_database toneAmber
class node_attendance_ui,node_scan_api,node_qr_check,node_attendance_logic,node_employee_qr,node_attendance_history toneMint
class node_leave_request,node_leave_rules,node_leave_admin,node_leave_calendar toneRose
class node_reports_logic,node_reports_ui,node_notifications,node_settings,node_audit,node_employee toneIndigo
```

## Components

### Access and dashboards

- [Login and session](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/login.php): `login.php`
- [Role dashboards](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/index.php): `index.php`
- [Shared access utilities](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/functions.php): `includes/functions.php`
- [Page layout and guards](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/layout.php): `includes/layout.php`
- [Dashboard data](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/dash.php): `includes/dash.php`

### Workforce administration

- [Employee records](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employees/form.php): `employees/form.php`
- [Employee profile](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employees/view.php): `employees/view.php`
- [Departments](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/departments/index.php): `departments/index.php`
- [Positions](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/positions/index.php): `positions/index.php`

### Attendance

- [Scan and attendance views](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/scan.php): `attendance/scan.php`
- [QR scan endpoint](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/api_scan.php): `attendance/api_scan.php`
- [Signed QR verification](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/check.php): `attendance/check.php`
- [Attendance rules](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/attendance.php): `includes/attendance.php`
- [Employee QR token](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employees/qr_token.php): `employees/qr_token.php`
- [History and calendar](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/attendance/history.php): `attendance/history.php`

### Leave management

- [Employee leave requests](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/employee/leaves.php): `employee/leaves.php`
- [Leave rules and balances](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/leave.php): `includes/leave.php`
- [Approvals and leave setup](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/leaves/approvals.php): `leaves/approvals.php`
- [Leave calendar](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/leaves/calendar.php): `leaves/calendar.php`

### Insights and operations

- [Report functions](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/includes/reports.php): `includes/reports.php`
- [Attendance and leave reports](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/reports/attendance.php): `reports/attendance.php`
- [Notifications](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/notifications/index.php): `notifications/index.php`
- [Schedule and holidays](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/settings/index.php): `settings/index.php`
- [Audit log](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/settings/audit.php): `settings/audit.php`

### Other components

- **Employee / manager / admin**
- [MySQL data](https://github.com/awabwdbashry-sketch/employee_attendance/blob/main/config/db.example.php): `config/db.example.php`

## Connections

- Employee / manager / admin → Login and session: signs in (evidence: `README.md`)
- Login and session → Shared access utilities: checks session (evidence: `login.php`)
- Role dashboards → Page layout and guards: loads layout (evidence: `index.php`)
- Role dashboards → Dashboard data: loads dashboard data (evidence: `index.php`)
- Dashboard data → Attendance rules: uses attendance rules (evidence: `includes/dash.php`)
- Employee records → Page layout and guards: loads layout (evidence: `employees/form.php`)
- Employee profile → Attendance rules: uses attendance logic (evidence: `employees/view.php`)
- Departments → Page layout and guards: loads layout (evidence: `departments/index.php`)
- Positions → Page layout and guards: loads layout (evidence: `positions/index.php`)
- Scan and attendance views → Page layout and guards: loads layout (evidence: `attendance/scan.php`)
- QR scan endpoint → Attendance rules: records attendance (evidence: `attendance/api_scan.php`)
- Signed QR verification → Attendance rules: verifies QR (evidence: `attendance/check.php`)
- Employee QR token → Attendance rules: creates QR token (evidence: `employees/qr_token.php`)
- Attendance rules → Leave rules and balances: checks leave and holidays (evidence: `includes/attendance.php`)
- History and calendar → Leave rules and balances: loads leave rules (evidence: `attendance/history.php`)
- Employee leave requests → Leave rules and balances: uses leave rules (evidence: `employee/leaves.php`)
- Approvals and leave setup → Leave rules and balances: uses leave rules (evidence: `leaves/approvals.php`)
- Leave calendar → Leave rules and balances: uses leave rules (evidence: `leaves/calendar.php`)
- Attendance and leave reports → Report functions: builds reports (evidence: `reports/attendance.php`)
- Report functions → Leave rules and balances: loads leave rules (evidence: `includes/reports.php`)
- Notifications → Page layout and guards: loads layout (evidence: `notifications/index.php`)
- Schedule and holidays → Leave rules and balances: uses settings helpers (evidence: `settings/index.php`)
- Login and session → MySQL data: queries data
- Attendance rules → MySQL data: reads and writes records
- Leave rules and balances → MySQL data: reads and writes records
- Role dashboards → MySQL data: queries dashboard data
- Report functions → MySQL data: queries report data
- Schedule and holidays → MySQL data: stores settings
- Notifications → MySQL data: reads notifications
- Audit log → Shared access utilities: uses shared utilities
