## Mutiara Group HR Portal

Unified web system for Advance Salary, Leave, and Invoice/Claim workflows with Staff, Approver (Pelulus), and Admin roles.

### Architecture

```
app/
  controllers/        # MVC controllers
  models/             # PDO models
  views/              # Bootstrap 5 views + email templates
  helpers/            # Session, CSRF, Mailer, Exporter utilities
config/
  config.php          # runtime config (copy from config.example.php)
  database.php        # PDO bootstrap
public/
  index.php           # front controller & router
  assets/css|js       # UI styles + dark mode/UX helpers
  uploads/claims      # stored claim documents
sql/schema.sql        # database schema & seed data
```

### Features

- Secure login/logout, RBAC sessions, CSRF tokens, hashed passwords.
- Staff portals for Advance Salary, Leave (auto day calculation), and Claim submissions (file uploads).
- Login menggunakan ID 12 digit (tiada email), dengan kata laluan boleh diset semula oleh Admin.
- Approver dashboard for triaging pending requests with inline approve/reject + remarks.
- Admin dashboard with summaries, filtering-ready tables, CSV/PDF exports, payroll totals, and user management.
- Email notifications (pending → approver, approved → admin, rejected → staff) via PHPMailer.
- Search/filter-friendly models, pagination hooks, audit logs, notification tracking.
- Responsive Bootstrap 5 UI, dark mode toggle, mobile-friendly navigation.
- Admin boleh tetapkan logo, nama/tagline, alamat, email & telefon syarikat melalui halaman tetapan khusus.

### Quick Start

1. **Clone & install deps**
   ```bash
   cd /Applications/XAMPP/xamppfiles/htdocs
   git clone <repo> mutiaragroupapp
   cd mutiaragroupapp
   composer install
   ```

2. **Configure environment**
   ```bash
   cp config/config.example.php config/config.php
   ```
   Update DB + SMTP credentials or export as environment variables.

3. **Create database**
   ```bash
   mysql -u root -p < sql/schema.sql
   ```

4. **Set permissions**
   ```bash
   chmod -R 775 public/uploads/claims public/uploads/branding
   ```

5. **Run via XAMPP/Apache**
   - Document root: `public/`
   - Ensure `.htaccess` is enabled (`AllowOverride All`).

6. **Default Accounts (Login ID / Password)**
   - Admin: `999999999999 / 999999999999`
   - Approver: `888888888888 / 888888888888`
   - Staff: `111111111111 / 111111111111`
   - Kemudian buka `Admin → Tetapan Syarikat` untuk kemas kini logo/nama/alamat syarikat dan pastikan folder `public/uploads/branding` boleh ditulis.

### Deployment Notes

- Use HTTPS in production and configure SMTP credentials for PHPMailer.
- Back up `public/uploads/claims` and `sql/schema.sql`.
- Update `config/config.php` for the production base URL.
- Schedule cron or supervisor to process additional notifications/log exports if needed.

For full deployment steps refer to `INSTALL.md`.

