# abdra7/damaged-vehicle-check-web architecture

> Architecture diagram of the GitHub repository abdra7/damaged-vehicle-check-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdra7/damaged-vehicle-check-web
- Repository: https://github.com/abdra7/damaged-vehicle-check-web

## Overview

##### Project Type and Purpose
- This is a full-stack web-based application. Its primary goal is to assist users in uploading images of damaged vehicles to generate detailed damage reports. The system also supports multiple roles—regular users, experts, and workshop managers—each with dedicated dashboards and functionalities.
- The README clearly outlines functionalities for user authentication, image submission, damage reporting, booking repair services, and dynamic dashboard interactions.

##### File Structure
- Top-level files like index.php, login.php, register.php, and various dashboard pages indicate that the application handles both front-end presentation (with integrated HTML templates like header.php and footer.php) and back-end logic.
- The includes/ directory (with auth.php and functions.php) consolidates shared logic, such as security/authentication routines and utility functions.
- Static assets are present (script.js, style.css) for client-side interactivity and responsive design.
- Other key PHP files like booking.php, ratings.php, report.php, upload.php, update_report.php, and workshop_dashboard.php indicate task-specific modules.
- That configuration and database connection files (e.g., db_connections.php) are fundamental in connecting the application logic to the backend database.

##### Architectural Components from the README
- The application is structured around clear modules:
- User Authentication: Register, login, logout with role-based redirection to dashboards.
- Damage Reporting: Image uploads handled by upload.php and reporting pages displaying user activities.
- Role-Specific Dashboards: Custom navigation (user_dashboard.php, workshop_dashboard.php) that filter data according to role permissions.
- Booking and Repair Notes: Booking requests and repair report updates are managed, with data stored in the database.
- The README explicitly mentions a MySQL database backend storing user data, uploaded images, and user activities.
- The emphasis on responsive design and interactive elements, via style.css and script.js, demonstrates an integrated front-end design philosophy.

##### Specific Elements
- Optionally, include a note on error handling and user session management (e.g., how sessions are initiated after login and maintained during role-specific dashboard operations).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client/UI Layer
    subgraph "Client/UI Layer"
        ui_index("index.php"):::frontend
        ui_header("header.php"):::frontend
        ui_footer("footer.php"):::frontend
        ui_style("style.css"):::frontend
        ui_script("script.js"):::frontend
    end

    %% Server/Backend Modules
    subgraph "Server/Backend Modules"
        %% User Authentication Module
        subgraph "User Authentication Module"
            auth_login("login.php"):::backend
            auth_register("register.php"):::backend
            auth_logout("logout.php"):::backend
            auth_auth("includes/auth.php"):::backend
        end

        %% Damage Reporting Module
        subgraph "Damage Reporting Module"
            dr_upload("upload.php"):::backend
            dr_report("report.php"):::backend
            dr_update("update_report.php"):::backend
        end

        %% Booking and Repair Notes Module
        subgraph "Booking and Repair Module"
            bk_booking("booking.php"):::backend
        end

        %% Role-Specific Dashboards
        subgraph "Role-Specific Dashboards"
            dash_user("user_dashboard.php"):::backend
            dash_workshop("workshop_dashboard.php"):::backend
        end

        %% Additional User Interactions
        subgraph "Additional User Interactions"
            ai_ratings("ratings.php"):::backend
            ai_workshops("workshops.php"):::backend
        end

        %% Shared Utilities and Database Connectivity
        shared_util("includes/functions.php"):::backend
        db_conn("db_connections.php"):::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        mysql_db(["MySQL Database"]):::database
    end

    %% Data Flow from Client to Backend Modules
    ui_index -->|"login_request"| auth_login
    ui_index -->|"upload_image"| dr_upload
    ui_index -->|"booking_request"| bk_booking
    ui_index -->|"dashboard_load"| dash_user
    ui_index -->|"ratings_action"| ai_ratings

    %% Backend Modules using Shared Utilities
    auth_login --> shared_util
    auth_register --> shared_util
    auth_logout --> shared_util
    auth_auth --> shared_util
    dr_upload --> shared_util
    dr_report --> shared_util
    dr_update --> shared_util
    bk_booking --> shared_util
    dash_user --> shared_util
    dash_workshop --> shared_util
    ai_ratings --> shared_util
    ai_workshops --> shared_util

    %% Shared Utilities interfacing with Database Connectivity and Database
    shared_util --> db_conn
    db_conn --> mysql_db

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1e88e5,stroke-width:2px;
    classDef backend fill:#c8e6c9,stroke:#43a047,stroke-width:2px;
    classDef database fill:#ffe082,stroke:#fb8c00,stroke-width:2px;

    %% Click Events for Client/UI Layer
    click ui_index "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/index.php"
    click ui_header "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/header.php"
    click ui_footer "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/footer.php"
    click ui_style "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/style.css"
    click ui_script "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/script.js"

    %% Click Events for User Authentication Module
    click auth_login "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/login.php"
    click auth_register "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/register.php"
    click auth_logout "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/logout.php"
    click auth_auth "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/includes/auth.php"

    %% Click Events for Damage Reporting Module
    click dr_upload "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/upload.php"
    click dr_report "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/report.php"
    click dr_update "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/update_report.php"

    %% Click Event for Booking and Repair Notes Module
    click bk_booking "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/booking.php"

    %% Click Events for Role-Specific Dashboards
    click dash_user "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/user_dashboard.php"
    click dash_workshop "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/workshop_dashboard.php"

    %% Click Events for Additional User Interactions
    click ai_ratings "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/ratings.php"
    click ai_workshops "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/workshops.php"

    %% Click Events for Shared Utilities and Database Connectivity
    click shared_util "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/includes/functions.php"
    click db_conn "https://github.com/abdra7/damaged-vehicle-check-web/blob/main/db_connections.php"
```
