# IGF HR Frontend

React app for the HR tool. Login is performed against the CRM (igf-ems); the HR backend is used only after login for `/api/me` and future HR features.

## Auth flow

1. User enters email/password on the login screen.
2. **POST** to **CRM** `REACT_APP_CRM_API_URL/api/auth/user-login` (same as igf-ems user login).
3. Store the returned **JWT** in `localStorage` as `"token"`.
4. **GET** HR backend `REACT_APP_HR_API_URL/api/me` with `Authorization: Bearer <token>`.
5. Redirect by `role`: `manager` → `/manager`, `employee` → `/employee`.

## Files

| File | Purpose |
|------|--------|
| `src/App.js` | Router; `ProtectedRoute` redirects to `/login` if no token. |
| `src/Login.js` | Login form; submits to CRM user-login, stores token, calls /api/me, redirects by role. |
| `src/api.js` | Axios instance for HR backend; adds `Authorization: Bearer <token>` to every request. |
| `src/ManagerDashboard.js` | Placeholder manager dashboard (logout only). |
| `src/EmployeeDashboard.js` | Placeholder employee dashboard (logout only). |

## Branding

Login and Admin login use the same look and feel as IGF-CRM: **background image** and **logo** from `public/images/` (copied from igf-ems). Product name on both pages: **IGF HR Tool**. Styles in `src/css/Login.css` match CRM colors (e.g. #00573C, #BFA253) and fonts (Poppins, Josefin Sans).

## Setup

1. Copy `.env.example` to `.env`.
2. Set `REACT_APP_CRM_API_URL` to the CRM base URL (e.g. `http://localhost:5000`).
3. Set `REACT_APP_HR_API_URL` to the HR backend URL (e.g. `http://localhost:5001`).
4. `npm install && npm start`.

No holiday or working hours UI yet; only login and role-based redirect.
