# moonslope/it6-proj-copy architecture

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

- Interactive diagram: https://gitdiagram.com/moonslope/it6-proj-copy
- Repository: https://github.com/moonslope/it6-proj-copy

## Overview

##### File structure
- Top-level directories and their intent:
- AdminUI, CashierUI – Presentation layer (PHP pages for Admin and Cashier workflows)
- Operations – Business logic and data-access operations (op_add_*, op_edit_*, op_delete_* scripts)
- Database – Connection script (db_connect.php)
- global – Shared includes (head.php)
- CSS, images – Static assets (style.css, image files)
- SQL files (cocop.sql, l300_copy1.sql) – Schema and data dumps

##### README
- Minimal metadata (“# IT6-PROJ-COPY”), confirming no pre-drawn architecture. We infer architecture solely from file structure.

##### Main components
a. Presentation Layer (UI)
- AdminUI module
- CashierUI module
b. Business Logic Layer
- Operations folder (CRUD scripts linking UI to DB)
c. Data Access Layer
- Database/db_connect.php & underlying MySQL database (schema from SQL dumps)
d. Shared Components
- global/head.php include
- CSS/style.css & images
e. External Actor
- Web browser (Admin/Cashier)
- Web server running PHP

##### Relationships and interactions
- Browser → HTTP request → PHP UI page
- UI page → include head.php → render HTML form/table
- Form submit → operations/op_*.php script → uses db_connect.php to run SQL
- Database ←→ operations scripts (CRUD queries)
- Results returned to UI → rendered to browser
- CSS/images served alongside UI pages

##### Architectural patterns and design principles
- Layered architecture (Presentation → Business Logic → Data Access)
- Entity-based modularization (each domain entity gets its own UI folder + operations)
- Shared includes for common UI elements (global/head.php)
- Separation of concerns but no service decoupling (monolith)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Actor
    Browser["Web Browser"]:::external
    Server["Web Server (PHP)"]:::external

    Browser -->|"HTTP Request"| Presentation
    Server --> Presentation

    subgraph "Presentation Layer" 
        direction TB
        %% Admin UI
        AdminUI["adminDashboard.php"]:::ui
        %% Cashier UI
        CashierUI["cashierUI.php"]:::ui
        DepartOp["depart_operation.php"]:::ui
        GetDriver["get_driver.php"]:::ui
        GetRoutePts["get_route_points.php"]:::ui
        CreatePass["op_create_travel_pass.php"]:::ui
        OpRoutePt["op_route_point.php"]:::ui
        PassHist["travel_pass_history.php"]:::ui
        %% Entity UI Pages
        subgraph "Card Color UI"
            direction TB
            AddCardColor["add_card_color.php"]:::ui
            ViewCardColor["view_card_color.php"]:::ui
        end
        subgraph "Cashier UI"
            direction TB
            AddCashier["add_cashier.php"]:::ui
            EditCashier["edit_cashier.php"]:::ui
            ViewCashier["view_cashier.php"]:::ui
        end
        subgraph "Driver UI"
            direction TB
            AddDriverUI["add_driver.php"]:::ui
            EditDriverUI["edit_driver.php"]:::ui
            ViewDriverUI["view_driver.php"]:::ui
        end
        subgraph "Route UI"
            direction TB
            AddRouteUI["add_route.php"]:::ui
            EditRouteUI["edit_route.php"]:::ui
            ViewRouteUI["view_route.php"]:::ui
        end
        subgraph "Route Point UI"
            direction TB
            AddRPUI["add_route_point.php"]:::ui
            EditRPUI["edit_route_point.php"]:::ui
            ViewRPUI["view_route_point.php"]:::ui
        end
        subgraph "Vehicle UI"
            direction TB
            AddVehicleUI["add_vehicle.php"]:::ui
            EditVehicleUI["edit_vehicle.php"]:::ui
            ViewVehicleUI["view_vehicle.php"]:::ui
        end
    end

    Presentation -->|Includes| Shared
    Presentation -->|"Form Submit"| Logic

    subgraph "Business Logic Layer" 
        direction TB
        subgraph Operations
            direction TB
            opAddCardColor["op_add_card_color.php"]:::logic
            opDelCardColor["op_delete_card_color.php"]:::logic
            opAddCashier["op_add_cashier.php"]:::logic
            opEditCashier["op_edit_cashier.php"]:::logic
            opDelCashier["op_delete_cashier.php"]:::logic
            opAddDriver["op_add_driver.php"]:::logic
            opEditDriver["op_edit_driver.php"]:::logic
            opDelDriver["op_delete_driver.php"]:::logic
            opAddRoute["op_add_route.php"]:::logic
            opEditRoute["op_edit_route.php"]:::logic
            opDelRoute["op_delete_route.php"]:::logic
            opAddVehicle["op_add_vehicle.php"]:::logic
            opEditVehicle["op_edit_vehicle.php"]:::logic
            opDelVehicle["op_delete_vehicle.php"]:::logic
        end
    end

    Logic -->|"SQL Queries"| DataAccess
    DataAccess -->|"Results"| Logic

    subgraph "Data Access Layer"
        direction TB
        DBConnect["db_connect.php"]:::shared
        Database["MySQL Database"]:::data
    end

    Shared["Shared Assets & Includes"]:::shared
    subgraph "Static Assets"
        direction TB
        CSS["style.css"]:::shared
        Images["images/"]:::shared
    end

    Presentation -->|Loads| CSS
    Presentation -->|Loads| Images

    Database -->|"Schema/Data Dumps"| SQL
    subgraph "SQL Dumps"
        direction TB
        Cocop["cocop.sql"]:::data
        L300["l300_copy1.sql"]:::data
    end

    %% Click Events
    click AdminUI "https://github.com/moonslope/it6-proj-copy/blob/main/AdminUI/adminDashboard.php"
    click CashierUI "https://github.com/moonslope/it6-proj-copy/blob/main/CashierUI/cashierUI.php"
    click DepartOp "https://github.com/moonslope/it6-proj-copy/blob/main/CashierUI/depart_operation.php"
    click GetDriver "https://github.com/moonslope/it6-proj-copy/blob/main/CashierUI/get_driver.php"
    click GetRoutePts "https://github.com/moonslope/it6-proj-copy/blob/main/CashierUI/get_route_points.php"
    click CreatePass "https://github.com/moonslope/it6-proj-copy/blob/main/CashierUI/op_create_travel_pass.php"
    click OpRoutePt "https://github.com/moonslope/it6-proj-copy/blob/main/CashierUI/op_route_point.php"
    click PassHist "https://github.com/moonslope/it6-proj-copy/blob/main/CashierUI/travel_pass_history.php"
    click AddCardColor "https://github.com/moonslope/it6-proj-copy/blob/main/Card-color/add_card_color.php"
    click ViewCardColor "https://github.com/moonslope/it6-proj-copy/blob/main/Card-color/view_card_color.php"
    click AddCashier "https://github.com/moonslope/it6-proj-copy/blob/main/Cashier/add_cashier.php"
    click EditCashier "https://github.com/moonslope/it6-proj-copy/blob/main/Cashier/edit_cashier.php"
    click ViewCashier "https://github.com/moonslope/it6-proj-copy/blob/main/Cashier/view_cashier.php"
    click AddDriverUI "https://github.com/moonslope/it6-proj-copy/blob/main/Driver/add_driver.php"
    click EditDriverUI "https://github.com/moonslope/it6-proj-copy/blob/main/Driver/edit_driver.php"
    click ViewDriverUI "https://github.com/moonslope/it6-proj-copy/blob/main/Driver/view_driver.php"
    click AddRouteUI "https://github.com/moonslope/it6-proj-copy/blob/main/Route/add_route.php"
    click EditRouteUI "https://github.com/moonslope/it6-proj-copy/blob/main/Route/edit_route.php"
    click ViewRouteUI "https://github.com/moonslope/it6-proj-copy/blob/main/Route/view_route.php"
    click AddRPUI "https://github.com/moonslope/it6-proj-copy/blob/main/Route_Point/add_route_point.php"
    click EditRPUI "https://github.com/moonslope/it6-proj-copy/blob/main/Route_Point/edit_route_point.php"
    click ViewRPUI "https://github.com/moonslope/it6-proj-copy/blob/main/Route_Point/view_route_point.php"
    click opAddCardColor "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_add_card_color.php"
    click opDelCardColor "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_delete_card_color.php"
    click opAddCashier "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_add_cashier.php"
    click opEditCashier "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_edit_cashier.php"
    click opDelCashier "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_delete_cashier.php"
    click opAddDriver "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_add_driver.php"
    click opEditDriver "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_edit_driver.php"
    click opDelDriver "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_delete_driver.php"
    click opAddRoute "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_add_route.php"
    click opEditRoute "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_edit_route.php"
    click opDelRoute "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_delete_route.php"
    click opAddVehicle "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_add_vehicle.php"
    click opEditVehicle "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_edit_vehicle.php"
    click opDelVehicle "https://github.com/moonslope/it6-proj-copy/blob/main/Operations/op_delete_vehicle.php"
    click DBConnect "https://github.com/moonslope/it6-proj-copy/blob/main/Database/db_connect.php"
    click Cocop "https://github.com/moonslope/it6-proj-copy/blob/main/cocop.sql"
    click L300 "https://github.com/moonslope/it6-proj-copy/blob/main/l300_copy1.sql"
    click CSS "https://github.com/moonslope/it6-proj-copy/blob/main/CSS/style.css"
    click Images "https://github.com/moonslope/it6-proj-copy/tree/main/images/"

    %% Styles
    classDef ui fill:#E0F7FA,stroke:#006064,color:#004D40
    classDef logic fill:#E8F5E9,stroke:#1B5E20,color:#1B5E20
    classDef data fill:#FFE0B2,stroke:#E65100,color:#BF360C
    classDef shared fill:#ECEFF1,stroke:#90A4AE,color:#546E7A
    classDef external fill:#E1BEE7,stroke:#4A148C,color:#4A148C
```
