# FeatureRequest Portal

[![Version](https://img.shields.io/badge/version-1.01-1fbbb8.svg)](config/constants.php)
[![PHP](https://img.shields.io/badge/PHP-8.2%2B-8892BF.svg)](https://www.php.net/)
[![MySQL](https://img.shields.io/badge/MySQL-8.0%2B-4479A1.svg)](https://www.mysql.com/)
[![Tailwind CSS](https://img.shields.io/badge/Tailwind_CSS-v3-38B2AC.svg)](https://tailwindcss.com/)

> **FeatureRequest Portal** is an enterprise internal feature intake and evaluation portal designed to bridge cross-functional submitters (Staff & Team Leads) with the Product Development Committee. It provides a structured 7-step intake wizard, 5-criteria weighted scoring engine, 6-column Drag-and-Drop Kanban implementation board, and real-time FCM push notifications.

---

## 🎨 Brand System & Design Tokens

- **Master Primary (CTA/Interactive)**: `#1fbbb8`
- **Accent Header**: `#0eb7fa` (Sky Blue)
- **Typography**: Google Fonts — *Plus Jakarta Sans* (Universal font for body & headings)
- **Style Directives**: Solid, flat surfaces with **strictly NO gradients**
- **Theme**: Full Light Mode & Dark Mode with `localStorage` preference persistence.

---

## 🔑 Initial System Admin Credentials

The database comes initialized with a single System Admin account for a clean slate deployment:

| Role | Email | Initial Password | Department |
|------|-------|------------------|------------|
| **System Admin** | `admin@bual.asia` | `Bual@!23` | System Administration |

> **Note**: Additional users (Committee Members, Team Leads, Staff) can be created by the System Admin through the built-in **User Management** panel at `/admin/users`.

---

## 🚀 Quick Setup Guide

### 1. Prerequisites
- **PHP**: 8.1 or higher (with `pdo_mysql` enabled)
- **MySQL**: 8.0+ or MariaDB 10.4+
- **Web Server**: Apache / Nginx or PHP Built-in CLI Server

### 2. Database Setup
1. Create database and import `database/schema.sql`:
   ```bash
   mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS bual_ifr DEFAULT CHARACTER SET utf8mb4;"
   mysql -u root -p bual_ifr < database/schema.sql
   ```
2. The database schema will create all 14 required tables, default categories, target applications, and the initial System Admin account (`admin@bual.asia`).

### 3. Configure Database Connection
Edit `config/database.php` if your local MySQL configuration differs:
```php
return [
    'host' => '127.0.0.1',
    'port' => 3306,
    'dbname' => 'bual_ifr',
    'username' => 'root',
    'password' => '', // Add your MySQL root password here
];
```

### 4. Running the Development Server
Navigate to the project root directory and start the PHP development server pointing to `public/`:

```bash
php -S localhost:8000 -t public
```

Open your browser and navigate to **`http://localhost:8000`**.

---

## ✨ Key Features & Capability Matrix

### 1. 📱 Target Applications Identifier & Admin Management
- **Pre-Seeded Applications**: Includes 10 initial target applications (`BlastOFF`, `Bual CloudPhone Android`, `Bual CloudPhone iOS`, `Bual Support System`, `Bual Feature Request`, `Maya`, `Oversee`, `Overtask`, `TM UCS Android`, `TM UCS iOS`).
- **Admin Management Panel (`/admin/applications`)**: System Admins can add new applications with custom color badges, edit details, and toggle active status.
- **Intake & Filter Integration**: Target Application selector in Section 2 of intake wizard, filter bars, table/card views, and CSV exports.

### 2. 📝 Intake Form (7-Step Multi-Step Wizard)
- **Step 1**: Submitter Information (auto-filled)
- **Step 2**: Feature Details, Category & Target Application
- **Step 3**: Problem Statement & Current Workaround
- **Step 4**: Proposed Solution & Success Metrics
- **Step 5**: Business Impact Assessment (Revenue estimate, Urgency level)
- **Step 6**: Target Personas & Customers Affected
- **Step 7**: Review & Final Submit
- Persistent **"Save as Draft"** functionality at any step.

### 3. 🔢 Custom Sequential FR ID Generator
- Format: **`IFR-YY###`** (e.g. `IFR-26001`, `IFR-26002`).
- Uses row-level transactional database locking (`fr_id_sequence` table) to prevent ID collision.

### 4. ⚖️ 5-Criteria Weighted Scoring Engine
Calculates real-time weighted evaluation scores out of 5.00:
- Strategic Alignment (25%)
- Revenue Impact (25%)
- Customer Value (20%)
- Technical Feasibility (20%)
- Urgency (10%)

### 5. 📊 Flexible Committee Evaluation & Override
- Committee Members and Admins can evaluate and record decisions (`Approved`, `Rejected`, `Deferred`).
- No strict quorum restriction lock — higher-ups can update or override decisions at any time.

### 6. 📋 Implementation Kanban Board (`/kanban`)
- 6 Interactive Columns: `Backlog` | `In Design` | `In Development` | `Testing` | `UAT` | `Released`.
- Native HTML5 Drag-and-Drop integration with real-time AJAX background synchronization.

### 7. 🔔 FCM Push Notifications & In-App Inbox
- Firebase Cloud Messaging integration (`firebase-messaging-sw.js` + `fcm.js`).
- Soft-ask banner prompt on dashboard.
- Fallback in-app notification bell with unread badge counter.

### 8. 📂 Attachment Uploads
- Strict **10MB** file size validation.
- Allowed MIME formats: `PDF, DOCX, XLSX, PNG, JPG`.

### 9. 🗃️ CSV Data Export & Audit Log
- One-click UTF-8 BOM formatted **CSV Export** respecting user role permissions.
- Full activity log recording all score submissions, status changes, and user actions.

### 10. 🖼️ Responsive Layout & Theme Switcher
- Dedicated panel sidebar collapse toggle with `localStorage` state persistence.
- Responsive Light & Dark Mode affecting both top navbar and sidebar navigation.
- Version footer badge (`v1.01`) in sidebar layout.

---

## 📁 Repository Structure

```
InternalFeatureRequest/
├── app/
│   ├── Controllers/         # MVC Controllers (Auth, FR, Committee, Admin, etc.)
│   ├── Core/                # Base Framework (Router, Auth, Database PDO, BaseModel)
│   ├── Helpers/             # Utilities (FcmNotifier, Security)
│   ├── Models/              # Database Models (FeatureRequest, Application, User, etc.)
│   └── Views/               # UI Templates & Components
│       ├── admin/           # User & Application Management views
│       ├── auth/            # Login view
│       ├── dashboard/       # Dashboard view with Chart.js
│       ├── fr/              # FR Create, Edit, Index, Show views
│       ├── implementation/  # Kanban Board view
│       └── layouts/         # Layout frame (main.php)
├── config/                  # App constants & DB connection config
├── database/                # Database DDL schema.sql
├── public/                  # Public web root
│   ├── assets/              # CSS, JS modules, logo assets
│   ├── uploads/             # Attachment uploads directory
│   └── index.php            # Front controller
├── .gitignore               # Git ignore configuration
└── README.md                # Project documentation
```

---

## 📄 License

Internal Enterprise Application &copy; <?= date('Y') ?> Feature Request. All rights reserved.
