# hmimotech/fgfga architecture

> Architecture diagram of the GitHub repository hmimotech/fgfga, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hmimotech/fgfga
- Repository: https://github.com/hmimotech/fgfga

## Overview

SONATRACH’s application manages contracts, purchase orders and work attachments, then tracks invoices through multi-role payment approval. Internal staff use the authenticated workspace; suppliers have a separate read-oriented portal for their contracts and invoices. The graph groups the PHP pages by product domain and shows shared authorization and workflow logic. README statements support the broad capabilities; source excerpts and the index support the specific redirects, page calls and workflow invocation shown. Some portal and CRUD internals were not sampled, so their detailed links are omitted.

Main entry points: [`index.php`](https://github.com/hmimotech/fgfga/blob/main/index.php) (Application entry), [`includes/auth.php`](https://github.com/hmimotech/fgfga/blob/main/includes/auth.php) (Authentication and roles), [`contrats`](https://github.com/hmimotech/fgfga/tree/main/contrats) (Contract management), [`bons_paiement`](https://github.com/hmimotech/fgfga/tree/main/bons_paiement) (Payment orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shared services"]
  node_entry["Application entry<br/>[index.php]"]
  node_login["Login<br/>[login.php]"]
  node_auth["Authentication and roles<br/>[auth.php]"]
  node_denied["Access denied<br/>[403.php]"]
  node_db_config["Database connection<br/>[db.php]"]
  node_staff_layout["Staff layout<br/>[header.php]"]
  node_supplier_layout["Supplier layout"]
  node_footer["Shared page footer<br/>[footer.php]"]
  node_activity["Activity journal<br/>[auth.php]"]
  node_users["User administration<br/>[utilisateurs.php]"]
end

subgraph group_counterparties["Clients and suppliers"]
  node_clients["Client management"]
  node_suppliers["Supplier management"]
end

subgraph group_contracts["Contracts and commitments"]
  node_contracts["Contract management"]
  node_purchase_orders["Purchase orders and services"]
  node_attachments["Work attachments"]
end

subgraph group_payments["Invoice and payment processing"]
  node_dashboard["Staff dashboard<br/>[index.php]"]
  node_invoices["Invoice management"]
  node_payment_orders["Payment orders"]
  node_workflow["Approval workflow<br/>[workflow.php]"]
end

subgraph group_supplier_portal["Supplier portal"]
  node_supplier_dashboard["Supplier dashboard<br/>[dashboard.php]"]
  node_supplier_contracts["Supplier contracts<br/>[contrats.php]"]
  node_supplier_invoices["Supplier invoices<br/>[factures.php]"]
end

node_staff(("Internal staff"))
node_supplier_user(("Supplier user"))
node_mysql[("MySQL or MariaDB")]

node_staff -->|"opens"| node_entry
node_supplier_user -->|"opens"| node_entry
node_entry -->|"checks session"| node_auth
node_entry -->|"redirects staff"| node_dashboard
node_entry -->|"redirects supplier"| node_supplier_dashboard
node_login -->|"loads"| node_auth
node_auth -->|"loads connection"| node_db_config
node_auth -->|"includes on denial"| node_denied
node_auth -->|"records actions"| node_activity
node_staff -->|"manages"| node_clients
node_staff -->|"manages"| node_suppliers
node_staff -->|"manages"| node_contracts
node_staff -->|"manages"| node_purchase_orders
node_contracts -->|"creates from contract"| node_purchase_orders
node_staff -->|"records work"| node_attachments
node_contracts -->|"lists by contract"| node_attachments
node_staff -->|"manages"| node_invoices
node_invoices -->|"links invoice"| node_payment_orders
node_staff -->|"validates"| node_payment_orders
node_payment_orders -->|"applies actions"| node_workflow
node_dashboard -->|"checks available actions"| node_workflow
node_staff -->|"administers users"| node_users
node_supplier_user -->|"views overview"| node_supplier_dashboard
node_supplier_user -->|"views contracts"| node_supplier_contracts
node_supplier_user -->|"views invoices"| node_supplier_invoices
node_supplier_dashboard -->|"uses status labels"| node_workflow
node_db_config -.->|"connects"| node_mysql

click node_entry "https://github.com/hmimotech/fgfga/blob/main/index.php"
click node_login "https://github.com/hmimotech/fgfga/blob/main/login.php"
click node_auth "https://github.com/hmimotech/fgfga/blob/main/includes/auth.php"
click node_denied "https://github.com/hmimotech/fgfga/blob/main/includes/403.php"
click node_db_config "https://github.com/hmimotech/fgfga/blob/main/config/db.php"
click node_staff_layout "https://github.com/hmimotech/fgfga/blob/main/includes/header.php"
click node_supplier_layout "https://github.com/hmimotech/fgfga/blob/main/includes/header_fournisseur.php"
click node_footer "https://github.com/hmimotech/fgfga/blob/main/includes/footer.php"
click node_activity "https://github.com/hmimotech/fgfga/blob/main/includes/auth.php"
click node_clients "https://github.com/hmimotech/fgfga/tree/main/clients"
click node_suppliers "https://github.com/hmimotech/fgfga/tree/main/fournisseurs"
click node_users "https://github.com/hmimotech/fgfga/blob/main/admin/utilisateurs.php"
click node_contracts "https://github.com/hmimotech/fgfga/tree/main/contrats"
click node_purchase_orders "https://github.com/hmimotech/fgfga/tree/main/bons_commande"
click node_attachments "https://github.com/hmimotech/fgfga/tree/main/attachements"
click node_dashboard "https://github.com/hmimotech/fgfga/blob/main/dashboard/index.php"
click node_invoices "https://github.com/hmimotech/fgfga/tree/main/factures"
click node_payment_orders "https://github.com/hmimotech/fgfga/tree/main/bons_paiement"
click node_workflow "https://github.com/hmimotech/fgfga/blob/main/includes/workflow.php"
click node_supplier_dashboard "https://github.com/hmimotech/fgfga/blob/main/espace_fournisseur/dashboard.php"
click node_supplier_contracts "https://github.com/hmimotech/fgfga/blob/main/espace_fournisseur/contrats.php"
click node_supplier_invoices "https://github.com/hmimotech/fgfga/blob/main/espace_fournisseur/factures.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_login,node_auth,node_denied,node_db_config,node_staff_layout,node_supplier_layout,node_footer,node_activity,node_users,node_supplier_user toneBlue
class node_clients,node_suppliers,node_mysql toneAmber
class node_contracts,node_purchase_orders,node_attachments toneMint
class node_dashboard,node_invoices,node_payment_orders,node_workflow toneRose
class node_supplier_dashboard,node_supplier_contracts,node_supplier_invoices,node_staff toneIndigo
```

## Components

### Access and shared services

- [Application entry](https://github.com/hmimotech/fgfga/blob/main/index.php): `index.php`
- [Login](https://github.com/hmimotech/fgfga/blob/main/login.php): `login.php`
- [Authentication and roles](https://github.com/hmimotech/fgfga/blob/main/includes/auth.php): `includes/auth.php`
- [Access denied](https://github.com/hmimotech/fgfga/blob/main/includes/403.php): `includes/403.php`
- [Database connection](https://github.com/hmimotech/fgfga/blob/main/config/db.php): `config/db.php`
- [Staff layout](https://github.com/hmimotech/fgfga/blob/main/includes/header.php): `includes/header.php`
- [Supplier layout](https://github.com/hmimotech/fgfga/blob/main/includes/header_fournisseur.php): `includes/header_fournisseur.php`
- [Shared page footer](https://github.com/hmimotech/fgfga/blob/main/includes/footer.php): `includes/footer.php`
- [Activity journal](https://github.com/hmimotech/fgfga/blob/main/includes/auth.php): `includes/auth.php`
- [User administration](https://github.com/hmimotech/fgfga/blob/main/admin/utilisateurs.php): `admin/utilisateurs.php`

### Clients and suppliers

- [Client management](https://github.com/hmimotech/fgfga/tree/main/clients): `clients`
- [Supplier management](https://github.com/hmimotech/fgfga/tree/main/fournisseurs): `fournisseurs`

### Contracts and commitments

- [Contract management](https://github.com/hmimotech/fgfga/tree/main/contrats): `contrats`
- [Purchase orders and services](https://github.com/hmimotech/fgfga/tree/main/bons_commande): `bons_commande`
- [Work attachments](https://github.com/hmimotech/fgfga/tree/main/attachements): `attachements`

### Invoice and payment processing

- [Staff dashboard](https://github.com/hmimotech/fgfga/blob/main/dashboard/index.php): `dashboard/index.php`
- [Invoice management](https://github.com/hmimotech/fgfga/tree/main/factures): `factures`
- [Payment orders](https://github.com/hmimotech/fgfga/tree/main/bons_paiement): `bons_paiement`
- [Approval workflow](https://github.com/hmimotech/fgfga/blob/main/includes/workflow.php): `includes/workflow.php`

### Supplier portal

- [Supplier dashboard](https://github.com/hmimotech/fgfga/blob/main/espace_fournisseur/dashboard.php): `espace_fournisseur/dashboard.php`
- [Supplier contracts](https://github.com/hmimotech/fgfga/blob/main/espace_fournisseur/contrats.php): `espace_fournisseur/contrats.php`
- [Supplier invoices](https://github.com/hmimotech/fgfga/blob/main/espace_fournisseur/factures.php): `espace_fournisseur/factures.php`

### Other components

- **Internal staff**
- **Supplier user**
- **MySQL or MariaDB**

## Connections

- Internal staff → Application entry: opens
- Supplier user → Application entry: opens
- Application entry → Authentication and roles: checks session (evidence: `index.php`)
- Application entry → Staff dashboard: redirects staff (evidence: `index.php`)
- Application entry → Supplier dashboard: redirects supplier (evidence: `index.php`)
- Login → Authentication and roles: loads (evidence: `login.php`)
- Authentication and roles → Database connection: loads connection (evidence: `includes/auth.php`)
- Authentication and roles → Access denied: includes on denial (evidence: `includes/auth.php`)
- Authentication and roles → Activity journal: records actions (evidence: `includes/auth.php`)
- Internal staff → Client management: manages
- Internal staff → Supplier management: manages
- Internal staff → Contract management: manages
- Internal staff → Purchase orders and services: manages
- Contract management → Purchase orders and services: creates from contract (evidence: `bons_commande/add.php`)
- Internal staff → Work attachments: records work
- Contract management → Work attachments: lists by contract (evidence: `contrats/view.php`)
- Internal staff → Invoice management: manages
- Invoice management → Payment orders: links invoice (evidence: `factures/view.php`)
- Internal staff → Payment orders: validates
- Payment orders → Approval workflow: applies actions (evidence: `bons_paiement/view.php`)
- Staff dashboard → Approval workflow: checks available actions (evidence: `dashboard/index.php`)
- Internal staff → User administration: administers users
- Supplier user → Supplier dashboard: views overview
- Supplier user → Supplier contracts: views contracts
- Supplier user → Supplier invoices: views invoices
- Supplier dashboard → Approval workflow: uses status labels (evidence: `espace_fournisseur/dashboard.php`)
- Database connection → MySQL or MariaDB: connects
