# lasains/uas_pemrograman_lanjut architecture

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

- Interactive diagram: https://gitdiagram.com/lasains/uas_pemrograman_lanjut
- Repository: https://github.com/lasains/uas_pemrograman_lanjut

## Overview

This Laravel/Inertia café inventory system supports role-based operations across ingredient and batch management, FEFO-guided stock use, waste approval, and owner analytics. The principal workflow runs from staff through routed controllers and domain records to Inertia pages; batch expiry and valuation rules support monitoring and prioritization. Several controllers and views are represented from the tree and README rather than sampled implementation, so those relationships are shown only where routing or documentation supports them.

Main entry points: [`routes/web.php`](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/routes/web.php) (Application routes), [`app/Http/Controllers/IngredientBatchController.php`](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/IngredientBatchController.php) (Batch management), [`app/Http/Controllers/StockUsageController.php`](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/StockUsageController.php) (Stock usage), [`app/Http/Controllers/DashboardController.php`](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/DashboardController.php) (Role dashboards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Inventory operations"]
  node_ingredients["Ingredient catalog"]
  node_categories["Category management"]
  node_batches["Batch management"]
  node_batch_rules["FEFO expiry rules"]
  node_usage["Stock usage"]
  node_ingredients_model[("Ingredient records<br/>[Ingredient.php]")]
  node_batch_model[("Batch records")]
  node_usage_model[("Usage records<br/>[StockUsage.php]")]
  node_inventory_page["Inventory monitoring<br/>[Index.tsx]"]
  node_usage_page["Usage history<br/>[Index.tsx]"]
end

subgraph group_governance["Waste governance"]
  node_waste["Waste reporting approval"]
  node_waste_model[("Waste records<br/>[WasteLog.php]")]
  node_policies["Waste authorization<br/>[WasteLogPolicy.php]"]
  node_waste_page["Waste review<br/>[Index.tsx]"]
end

subgraph group_insights["Dashboards analytics"]
  node_dashboard["Role dashboards"]
  node_analytics["Financial analytics export"]
  node_analytics_page["Analytics view<br/>[Index.tsx]"]
  node_dashboard_page["Dashboard views<br/>[Dashboard.tsx]"]
end

subgraph group_platform["Web application"]
  node_authroutes["Auth routes<br/>[auth.php]"]
  node_session["Session authentication"]
  node_web_routes["Application routes<br/>[web.php]"]
  node_rbac["Role access control<br/>[RoleMiddleware.php]"]
  node_inertia["Inertia middleware"]
  node_ui["React pages layouts"]
end

node_staff(("Cafe staff"))
node_db[("Relational database")]

node_staff -->|"submits credentials"| node_authroutes
node_authroutes -->|"routes login"| node_session
node_session -->|"renders login"| node_ui
node_session -->|"redirects by role"| node_staff
node_staff -.->|"requests inventory"| node_web_routes
node_web_routes -.->|"applies role checks"| node_rbac
node_web_routes -.->|"routes batch actions"| node_batches
node_web_routes -.->|"routes catalog actions"| node_ingredients
node_web_routes -.->|"routes usage actions"| node_usage
node_web_routes -.->|"routes waste actions"| node_waste
node_web_routes -.->|"routes dashboards"| node_dashboard
node_batches -->|"orders FEFO batches"| node_batch_rules
node_batches -->|"reads ingredients"| node_ingredients_model
node_batches -->|"reads writes batches"| node_batch_model
node_batches -.->|"renders inventory"| node_inventory_page
node_ingredients -.->|"manages catalog"| node_ingredients_model
node_categories -.->|"manages categories"| node_db
node_usage -->|"reads ingredient"| node_ingredients_model
node_usage -->|"selects and updates batch"| node_batch_model
node_usage -->|"records consumption"| node_usage_model
node_usage -.->|"renders usage"| node_usage_page
node_waste -->|"updates batch stock"| node_batch_model
node_waste -->|"records approval"| node_waste_model
node_policies -->|"authorizes actions"| node_waste_model
node_waste -.->|"renders waste review"| node_waste_page
node_dashboard -->|"reads active batches"| node_batch_model
node_dashboard -->|"reads usage metrics"| node_usage_model
node_dashboard -->|"reads waste metrics"| node_waste_model
node_dashboard -->|"renders dashboard"| node_dashboard_page
node_analytics -->|"reads approved waste"| node_waste_model
node_analytics -->|"reads FEFO compliance"| node_usage_model
node_analytics -->|"renders analytics"| node_analytics_page
node_batch_model -.->|"persists batches"| node_db
node_ingredients_model -.->|"persists ingredients"| node_db
node_usage_model -.->|"persists usage"| node_db
node_waste_model -.->|"persists waste"| node_db
node_inertia -.->|"shares request data"| node_ui

click node_authroutes "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/routes/auth.php"
click node_session "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_web_routes "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/routes/web.php"
click node_rbac "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Middleware/RoleMiddleware.php"
click node_inertia "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Middleware/HandleInertiaRequests.php"
click node_ui "https://github.com/lasains/uas_pemrograman_lanjut/tree/develop/resources/js/Pages"
click node_ingredients "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/IngredientController.php"
click node_categories "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/CategoryController.php"
click node_batches "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/IngredientBatchController.php"
click node_batch_rules "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/IngredientBatch.php"
click node_usage "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/StockUsageController.php"
click node_ingredients_model "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/Ingredient.php"
click node_batch_model "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/IngredientBatch.php"
click node_usage_model "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/StockUsage.php"
click node_waste "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/WasteLogController.php"
click node_waste_model "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/WasteLog.php"
click node_policies "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Policies/WasteLogPolicy.php"
click node_dashboard "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/DashboardController.php"
click node_analytics "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/DashboardController.php"
click node_analytics_page "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Analytics/Index.tsx"
click node_inventory_page "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Inventory/Index.tsx"
click node_usage_page "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Usage/Index.tsx"
click node_waste_page "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Waste/Index.tsx"
click node_dashboard_page "https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Dashboard.tsx"

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_ingredients,node_categories,node_batches,node_batch_rules,node_usage,node_ingredients_model,node_batch_model,node_usage_model,node_inventory_page,node_usage_page toneBlue
class node_waste,node_waste_model,node_policies,node_waste_page,node_db toneAmber
class node_dashboard,node_analytics,node_analytics_page,node_dashboard_page toneMint
class node_authroutes,node_session,node_web_routes,node_rbac,node_inertia,node_ui toneRose
class node_staff toneIndigo
```

## Components

### Inventory operations

- [Ingredient catalog](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/IngredientController.php): `app/Http/Controllers/IngredientController.php`
- [Category management](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/CategoryController.php): `app/Http/Controllers/CategoryController.php`
- [Batch management](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/IngredientBatchController.php): `app/Http/Controllers/IngredientBatchController.php`
- [FEFO expiry rules](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/IngredientBatch.php): `app/Models/IngredientBatch.php`
- [Stock usage](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/StockUsageController.php): `app/Http/Controllers/StockUsageController.php`
- [Ingredient records](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/Ingredient.php): `app/Models/Ingredient.php`
- [Batch records](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/IngredientBatch.php): `app/Models/IngredientBatch.php`
- [Usage records](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/StockUsage.php): `app/Models/StockUsage.php`
- [Inventory monitoring](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Inventory/Index.tsx): `resources/js/Pages/Inventory/Index.tsx`
- [Usage history](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Usage/Index.tsx): `resources/js/Pages/Usage/Index.tsx`

### Waste governance

- [Waste reporting approval](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/WasteLogController.php): `app/Http/Controllers/WasteLogController.php`
- [Waste records](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Models/WasteLog.php): `app/Models/WasteLog.php`
- [Waste authorization](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Policies/WasteLogPolicy.php): `app/Policies/WasteLogPolicy.php`
- [Waste review](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Waste/Index.tsx): `resources/js/Pages/Waste/Index.tsx`

### Dashboards analytics

- [Role dashboards](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/DashboardController.php): `app/Http/Controllers/DashboardController.php`
- [Financial analytics export](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/DashboardController.php): `app/Http/Controllers/DashboardController.php`
- [Analytics view](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Analytics/Index.tsx): `resources/js/Pages/Analytics/Index.tsx`
- [Dashboard views](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/resources/js/Pages/Dashboard.tsx): `resources/js/Pages/Dashboard.tsx`

### Web application

- [Auth routes](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/routes/auth.php): `routes/auth.php`
- [Session authentication](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Application routes](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/routes/web.php): `routes/web.php`
- [Role access control](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Middleware/RoleMiddleware.php): `app/Http/Middleware/RoleMiddleware.php`
- [Inertia middleware](https://github.com/lasains/uas_pemrograman_lanjut/blob/develop/app/Http/Middleware/HandleInertiaRequests.php): `app/Http/Middleware/HandleInertiaRequests.php`
- [React pages layouts](https://github.com/lasains/uas_pemrograman_lanjut/tree/develop/resources/js/Pages): `resources/js/Pages`

### Other components

- **Cafe staff**
- **Relational database**

## Connections

- Cafe staff → Auth routes: submits credentials (evidence: `routes/auth.php`)
- Auth routes → Session authentication: routes login (evidence: `routes/auth.php`)
- Session authentication → React pages layouts: renders login (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Session authentication → Cafe staff: redirects by role (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Cafe staff → Application routes: requests inventory
- Application routes → Role access control: applies role checks
- Application routes → Batch management: routes batch actions
- Application routes → Ingredient catalog: routes catalog actions
- Application routes → Stock usage: routes usage actions
- Application routes → Waste reporting approval: routes waste actions
- Application routes → Role dashboards: routes dashboards
- Batch management → FEFO expiry rules: orders FEFO batches (evidence: `app/Http/Controllers/IngredientBatchController.php`)
- Batch management → Ingredient records: reads ingredients (evidence: `app/Http/Controllers/IngredientBatchController.php`)
- Batch management → Batch records: reads writes batches (evidence: `app/Http/Controllers/IngredientBatchController.php`)
- Batch management → Inventory monitoring: renders inventory
- Ingredient catalog → Ingredient records: manages catalog
- Category management → Relational database: manages categories
- Stock usage → Ingredient records: reads ingredient (evidence: `app/Http/Controllers/StockUsageController.php`)
- Stock usage → Batch records: selects and updates batch (evidence: `app/Http/Controllers/StockUsageController.php`)
- Stock usage → Usage records: records consumption (evidence: `app/Http/Controllers/StockUsageController.php`)
- Stock usage → Usage history: renders usage
- Waste reporting approval → Batch records: updates batch stock (evidence: `app/Http/Controllers/WasteLogController.php`)
- Waste reporting approval → Waste records: records approval (evidence: `app/Http/Controllers/WasteLogController.php`)
- Waste authorization → Waste records: authorizes actions (evidence: `app/Policies/WasteLogPolicy.php`)
- Waste reporting approval → Waste review: renders waste review
- Role dashboards → Batch records: reads active batches (evidence: `app/Http/Controllers/DashboardController.php`)
- Role dashboards → Usage records: reads usage metrics (evidence: `app/Http/Controllers/DashboardController.php`)
- Role dashboards → Waste records: reads waste metrics (evidence: `app/Http/Controllers/DashboardController.php`)
- Role dashboards → Dashboard views: renders dashboard (evidence: `app/Http/Controllers/DashboardController.php`)
- Financial analytics export → Waste records: reads approved waste (evidence: `app/Http/Controllers/DashboardController.php`)
- Financial analytics export → Usage records: reads FEFO compliance (evidence: `app/Http/Controllers/DashboardController.php`)
- Financial analytics export → Analytics view: renders analytics (evidence: `app/Http/Controllers/DashboardController.php`)
- Batch records → Relational database: persists batches
- Ingredient records → Relational database: persists ingredients
- Usage records → Relational database: persists usage
- Waste records → Relational database: persists waste
- Inertia middleware → React pages layouts: shares request data
