# mohaelbadry/projet_web_tp architecture

> Architecture diagram of the GitHub repository mohaelbadry/projet_web_tp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohaelbadry/projet_web_tp
- Repository: https://github.com/mohaelbadry/projet_web_tp

## Overview

##### Project type and purpose
- This is a monolithic, full-stack LAMP-style (PHP + MySQL) web application for inventory and stock management.
- It exposes two user-facing consoles:
- A public “Customer” storefront (Customer/) for browsing products.
- An admin “Back Office” (Presentation/) for managing categories, clients, suppliers, orders, supplies, and cashier sessions.

##### File structure
- Top-level directories:
- Customer/ – customer-facing PHP pages, CSS, JS.
- Presentation/ – admin UI, organized by feature modules (Categorie, Client, Commande, etc.), templates, PDF CSS, session checks.
- Metier/ – business-logic classes (Produit, Commande, Approvisionnement, etc.).
- DAO/ – data-access layer (DAO.php).
- assets/ – static assets (CSS framework, JS libraries: Bootstrap, Chart.js, Day.js, etc.).
- Other files: index.php (front controller), DB_.sql (schema), README.md, RAPPORT-WEB.pdf.

##### README
- Confirms web stack (Apache/Nginx + PHP + MySQL), features: manage products, suppliers, clients, orders, supplies, cashier, sessions, PDF reports.

##### Detail
- Individual module groups if space allows (e.g., under Presentation: Categorie, Client, Commande, Approvisionnement).
- Session management and PDF report paths.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph "Clients"
        Customer["Public (Customer)"]:::client
        Admin["Admin (Staff)"]:::client
    end

    %% Web Server and Entry
    WebServer["Web Server (Apache/Nginx + PHP)"]:::server
    index["Front Controller (index.php)"]:::server

    %% Presentation Layer
    subgraph "Presentation Layer"
        CustPages["Customer UI"]:::presentation
        AdminUI["Admin Dashboard"]:::presentation

        subgraph "Admin Modules"
            categorie["Categories Module"]:::presentation
            clientMod["Clients Module"]:::presentation
            fourn["Suppliers Module"]:::presentation
            commande["Orders Module"]:::presentation
            appro["Supplies Module"]:::presentation
            produit["Products Module"]:::presentation
            caisse["Cashier Session Module"]:::presentation
        end

        templates["Shared Templates"]:::presentation
        pdfOrder["PDF Generator - Orders"]:::presentation
        pdfSupply["PDF Generator - Supplies"]:::presentation
        assets["Static Assets"]:::presentation
    end

    %% Business Logic Layer
    metier["Business Logic Layer (Metier)"]:::business

    %% Data Access Layer
    dao["Data Access Layer (DAO)"]:::dataaccess

    %% Database
    db["MySQL Database"]:::database
    dbscript["DB Schema Script (DB_.sql)"]:::database

    %% External Libraries
    subgraph "JS & CSS Libraries"
        chartjs["Chart.js"]:::library
        dayjs["Day.js"]:::library
        mazercss["UI Framework CSS (app.css)"]:::library
        mazerjs["UI Framework JS (mazer.js)"]:::library
        plugins["JS Extensions & Plugins"]:::library
    end

    %% Connections
    Customer -->|HTTP Request| WebServer
    Admin -->|HTTP Request| WebServer
    WebServer --> index
    index --> CustPages
    index --> AdminUI

    CustPages -->|includes & calls| metier
    AdminUI -->|includes & calls| metier

    metier -->|uses| dao
    dao -->|CRUD| db

    dbscript -->|initializes| db

    CustPages --> assets
    AdminUI --> assets
    assets --> chartjs
    assets --> dayjs
    assets --> mazercss
    assets --> mazerjs
    assets --> plugins

    Customer -->|AJAX/JS calls| chartjs
    Customer -->|AJAX/JS calls| dayjs

    %% Click Events
    click Customer "https://github.com/mohaelbadry/projet_web_tp/tree/main/Customer/"
    click AdminUI "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/"
    click categorie "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/Categorie/"
    click clientMod "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/Client/"
    click fourn "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/Fournisseur/"
    click commande "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/Commande/"
    click appro "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/Approvisionnement/"
    click produit "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/Produit/"
    click caisse "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/caisse/"
    click templates "https://github.com/mohaelbadry/projet_web_tp/tree/main/Presentation/templates/"
    click pdfOrder "https://github.com/mohaelbadry/projet_web_tp/blob/main/Presentation/Commande/pdf.php"
    click pdfSupply "https://github.com/mohaelbadry/projet_web_tp/blob/main/Presentation/Approvisionnement/pdf.php"
    click metier "https://github.com/mohaelbadry/projet_web_tp/tree/main/Metier/"
    click dao "https://github.com/mohaelbadry/projet_web_tp/blob/main/DAO/DAO.php"
    click index "https://github.com/mohaelbadry/projet_web_tp/blob/main/index.php"
    click dbscript "https://github.com/mohaelbadry/projet_web_tp/blob/main/DB_.sql"
    click assets "https://github.com/mohaelbadry/projet_web_tp/tree/main/assets/"
    click chartjs "https://github.com/mohaelbadry/projet_web_tp/tree/main/assets/extensions/chart.js/"
    click dayjs "https://github.com/mohaelbadry/projet_web_tp/tree/main/assets/extensions/dayjs/"
    click mazercss "https://github.com/mohaelbadry/projet_web_tp/blob/main/assets/css/main/app.css"
    click mazerjs "https://github.com/mohaelbadry/projet_web_tp/blob/main/assets/js/mazer.js"
    click plugins "https://github.com/mohaelbadry/projet_web_tp/tree/main/assets/js/extensions/"

    %% Styles
    classDef client fill:#add8e6,stroke:#000,stroke-width:1px
    classDef server fill:#b3e6b3,stroke:#000,stroke-width:1px
    classDef presentation fill:#90ee90,stroke:#000,stroke-width:1px
    classDef business fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef dataaccess fill:#ffa500,stroke:#000,stroke-width:1px
    classDef database fill:#ffdead,stroke:#000,stroke-width:1px
    classDef library fill:#ffe4e1,stroke:#000,stroke-width:1px
```
