# Features

This document describes each feature module in **El Sewedy In Sawa**, with an honest **live / prepared** status. Modules live under `lib/features/*`.

## Status Legend

- **LIVE** — wired end-to-end against the API.
- **PARTIAL** — built and usable, but part of the flow is confirmation-based or uses sample data.
- **PREPARED** — code exists but is scaffolded / not yet activated.

## Authentication — LIVE

- **Login** with employee code + password + device id.
- **Self-registration** via `/access/onboard`, which is **gated by admin approval**. After registering, the user lands on an **Approval Required** screen that polls every 15 seconds via a silent login until an administrator approves, then auto-enters the app.
- **Change password** (`/access/credentials`) and **forgot password** screen.
- **Logout** (`/access/revoke`) — server-side revoke plus local credential clearing.
- **Auto-login / silent re-authentication** from securely stored credentials.

## Home / Dashboard — LIVE

Backed by `HomeCubit` → `/staff/dashboard`. Shows a personalized greeting, today's general shift card, a primary **check-in** action wired to attendance, and recent requests plus balance sections.

## Attendance — LIVE (punch & geofencing)

`AttendanceCubit` drives a **swipe check-in/out** control with a live shift clock. GPS is read via `geolocator`; assigned work locations load from `/tracking/coordinates`. The `AttendanceLocationResolver` picks a site:

- `location_free == true` → remote site, auto-passes.
- Otherwise a **Haversine geofence** check runs against each site's radius; if the user is outside every site, an error is shown.

A punch is posted to `/attendance/log-entry` with date, time, `punch_type` (IN/OUT), `location_free`, `location_id`, lat, and lon. Screens also present a **monthly attendance summary** (Present / Absent / Late) and a **day-by-day working-hours log** (Attendance Details).

## Requests / Leave — PARTIAL

`RequestType` covers **remote work**, **permissions**, and **annual leave**. The new-request form provides a type picker, a from/to date range, an extra "Permissions Period" range shown only for permissions, and a reason note. Submitting shows a success dialog ("We will notify you once it reviewed").

The module also presents **balances** (remote work days, permissions hours, annual leave days), request **history**, and a **status calendar** with pending / approved / rejected pills. In the current source, request submission is **confirmation-based** and the leave screens use placeholder/sample data.

## Payroll — LIVE (screens)

`PayrollMonthSelector` and `PayrollBreakdownTable` render a monthly salary overview across multiple payroll **runs**: earnings vs. deductions (basic salary, housing allowance, overtime, social insurance, tax pool, etc.), gross totals, and **Total Net Salary**. A month-range filter modal (from/to month + year) and per-run breakdown detail are included. Finance endpoints: `/finance/active-cycle`, `/finance/download-slip`, `/finance/history-lookup`, `/finance/statement-data`.

## Profile — LIVE

General, Personal, and Professional information screens (job title, department, company, sector, division, contract dates, contacts, marital/military status, family info). **Editing personal info submits a request** and shows "It will be updated automatically once the admin approves." The profile menu covers Employee Data, Settings, Information, Support, and Logout.

## Organization Chart (Hierarchy) — LIVE

`HierarchyCubit` → `/staff/structure` renders an interactive org chart: managers → current employee → direct reports. Each colleague's avatar is preloaded concurrently via `/staff/avatar` (gateway-first, then direct-URL fallback), with in-memory caching of both the tree and avatar bytes.

## Notifications — PARTIAL / PREPARED

The notifications screen renders a **static local list** via `NotificationCard`, and the profile bell badge is a hardcoded count. The **Firebase push pipeline is scaffolded but fully commented out** — see [FIREBASE.md](./FIREBASE.md).

## Settings — LIVE

Dark-mode toggle (`AppSettingsCubit`, persisted), language switch EN/AR (persisted), and OS location-permission management (`PermissionsCubit`).

## Onboarding — LIVE

A 2.5s brand splash (navy + white logo), then session bootstrap: valid token → app; credentials only → silent re-auth; otherwise → login.

## Info — LIVE (static content)

About (company), Help & Support (department contacts), Privacy Policy, and Terms & Conditions.

## Layout Shell — LIVE

An app shell using an `IndexedStack` of five bottom-nav tabs: **Home, Requests (Leave), Attendance, Payroll, Profile**.

See [SCREENSHOTS.md](./SCREENSHOTS.md) for the visual gallery and [API_SUMMARY.md](./API_SUMMARY.md) for endpoint detail.
