# DHA Bahawalpur Equipment Management System

## Project Vision
Our goal was to build a robust, digital **Equipment Management System** (or Asset System) for DHA Bahawalpur. The system is designed to streamline and digitalize the process of submitting IT demands and hardware repair complaints. By transitioning from manual paper-based processes to a digital workflow, we aim to ensure transparency, accountability, and faster resolution times across all directorates.

---

## Tech Stack & Architecture
The system is built as a modern Single Page Application (SPA) using the following technologies:
- **Backend**: [Laravel 11](https://laravel.com/) (PHP Framework)
- **Frontend**: [Vue.js 3](https://vuejs.org/) (Composition API)
- **Bridge**: [Inertia.js](https://inertiajs.com/) (Connects Laravel and Vue without building an API)
- **Styling**: [Tailwind CSS](https://tailwindcss.com/)
- **Database**: SQLite (currently configured for development/testing, easily switchable to MySQL)
- **Authentication**: Laravel Breeze (modified for role-based access control)

---

## Database Structure
The core of the application relies on the following database schema to manage users, assets, and tickets efficiently:

### 1. `users` Table
Manages authentication and role-based access. Includes Employees.
- `id`: Primary Key
- `name`: Full Name
- `email`: Unique Login ID
- `password`: Hashed Password
- `role`: Role linked via `role_id` (`Super_Admin`, `Clerk`, `Director`, `IT_Admin`, `IT_Director`, `Technician`, `Employee`)
- `branch_id`: Foreign Key linking to the `branches` table.

### 2. `directorates` & `branches` Tables
Represents the various branches/departments in DHA Bahawalpur.
- A `Directorate` has multiple `Branches`.

### 3. `tickets` Table
The central entity for tracking all demands and complaints.
- `id`: Primary Key
- `case_no`: Unique auto-generated tracking number (e.g., `IT-CASE-2026-0001`)
- `user_id`: Foreign Key referencing the user who created the ticket.
- `employee_id`: The employee for whom the ticket is created.
- `asset_id`: The asset associated with the complaint/demand.
- `status`: Enum (`Draft`, `Pending_Director`, `Pending_ICT`, `Pending_IT_Director`, `Approved_IT_Director`, `In_Progress`, `Resolved`, `Rejected`, `Pending_Verification`).
- `assigned_technician_id`: The technician assigned to resolve the issue.
- **Timestamps**: `assigned_at` (when given to technician) and `resolved_at` (when technician finishes) for performance tracking.

---

## Methodologies & Workflow
We employed an **Iterative/Agile Methodology**, building the application piece-by-piece based on continuous feedback. The system uses a strict **Role-Based Access Control (RBAC)** architecture to mirror the real-world hierarchical workflow of the organization.

### The Detailed Ticket Workflow
1. **Initiation (`Pending_Director`)**: A **Clerk** from any directorate generates an "ICT Request Performa" on behalf of an employee. 
2. **Branch Approval (`Pending_ICT`)**: The ticket is sent to the **Director** of that specific branch to digitally approve it.
3. **IT Admin Assessment (`Pending_IT_Director` / Assigned to Technician)**: The **IT Admin** reviews the explanation. They can assign it to a **Technician** (which sets `assigned_at`), or forward it to the IT Director for approval.
4. **IT Director Approval (`Approved_IT_Director`)**: The **IT Director (ADDL DIR)** reviews and approves the solution.
5. **Execution & Resolution (`Resolved`)**: The assigned **Technician** processes the task and resolves it (setting `resolved_at`). 
6. **Technician Emergency Log**: Technicians can independently log emergency completed tasks which go to `Pending_Verification` for the branch clerk to verify.

---

## What We Have Built So Far (Summary)
1. **Database & Migrations**: Configured custom tables for `Directorates`, `Branches`, `Employees`, `Assets`, and `Tickets` with detailed audit and performance timestamps (`assigned_at`, `resolved_at`).
2. **Middleware**: Created custom middleware to secure routes based on user roles (`Clerk`, `Director`, `IT_Admin`, `IT_Director`, `Technician`).
3. **Dashboards**: 
   - **Clerk Dashboard**: For tracking generated requests.
   - **Director Dashboard**: For approving branch-level requests.
   - **IT Admin / Command Center**: A complex dashboard categorized into *Queue*, *Process Ticket*, *Worker Performance*, and *Reports*.
   - **Technician Panel**: For receiving assigned tasks and logging independent emergency tasks.
4. **Performance Tracking**: Built an automated performance engine that measures exact "Time Taken" by a technician from assignment (`assigned_at`) to completion (`resolved_at`).
5. **Digital Performa**: Built a highly detailed, print-ready digital performa that accurately mirrors the physical paper form.
