Implements a working in-memory ERP demo inspired by Mago4, covering the core modules: dashboard with KPI widgets, customers, suppliers, products, sales orders, purchase orders, and warehouse inventory. - FastAPI backend with Pydantic models and REST API (auto-docs at /docs) - Jinja2 HTML templates with Mago4-style UI (dark sidebar, blue/orange/ green/red palette, Material Design icons) - In-memory fake database seeded with sample customers, suppliers, products, and orders — ready to swap for SQLAlchemy + SQL Server - Workarounds for Python 3.14 + Starlette 1.3 / Jinja2 compatibility (cache_size=0, new TemplateResponse(request, name, ctx) signature) - launch.json for one-click preview; run.bat for manual startup Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
119 lines
3.7 KiB
Markdown
119 lines
3.7 KiB
Markdown
# Mago4 Demo - ERP Gestionale
|
|
|
|
Demo funzionante di un gestionale ERP ispirato a **Mago4**, realizzato con **Python FastAPI**.
|
|
|
|
## 🎯 Caratteristiche
|
|
|
|
- **Dashboard interattivo** con KPI e widget
|
|
- **Gestione Clienti** - Anagrafica e crediti
|
|
- **Gestione Fornitori** - Anagrafica e debiti
|
|
- **Catalogo Articoli** - Inventario con alert sottosorta
|
|
- **Ordini Vendita** - Creazione e tracciamento
|
|
- **Ordini Acquisto** - Gestione forniture
|
|
- **Magazzino** - Inventario con controllo giacenze
|
|
- **API REST** completamente documentata
|
|
- **Database in-memoria** per demo (facilmente migrabile a SQL)
|
|
- **UI ispirata a Mago4** - Design moderno con Material Icons
|
|
|
|
## 🚀 Quick Start
|
|
|
|
### 1. Installare dipendenze
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### 2. Avviare l'applicazione
|
|
|
|
```bash
|
|
python main.py
|
|
```
|
|
|
|
L'app sarà disponibile su: **http://127.0.0.1:8000**
|
|
|
|
### 3. Accedere alle sezioni
|
|
|
|
- **Dashboard**: http://127.0.0.1:8000/
|
|
- **API Docs**: http://127.0.0.1:8000/docs
|
|
- **Clienti**: http://127.0.0.1:8000/customers
|
|
- **Fornitori**: http://127.0.0.1:8000/suppliers
|
|
- **Articoli**: http://127.0.0.1:8000/products
|
|
- **Ordini Vendita**: http://127.0.0.1:8000/sales-orders
|
|
- **Ordini Acquisto**: http://127.0.0.1:8000/purchase-orders
|
|
- **Magazzino**: http://127.0.0.1:8000/warehouse
|
|
|
|
## 📁 Struttura del Progetto
|
|
|
|
```
|
|
mago4-demo/
|
|
├── main.py # FastAPI app principale
|
|
├── models.py # Modelli dati (Pydantic)
|
|
├── database.py # Database in-memoria
|
|
├── requirements.txt # Dipendenze Python
|
|
├── templates/ # Template HTML (Jinja2)
|
|
│ ├── base.html # Layout con sidebar
|
|
│ ├── dashboard.html # Dashboard KPI
|
|
│ ├── customers.html # Gestione clienti
|
|
│ ├── suppliers.html # Gestione fornitori
|
|
│ ├── products.html # Catalogo articoli
|
|
│ ├── sales_orders.html # Ordini vendita
|
|
│ ├── purchase_orders.html # Ordini acquisto
|
|
│ └── warehouse.html # Magazzino
|
|
└── static/ # Assets frontend
|
|
├── css/style.css # Stili (colori Mago4)
|
|
└── js/app.js # Funzionalità JS
|
|
```
|
|
|
|
## 🎨 Design & Colori (ispirato a Mago4)
|
|
|
|
- **Blu**: #1976D2 (Azioni, statistiche)
|
|
- **Arancione**: #F57C00 (Avvisi, acquisti)
|
|
- **Verde**: #388E3C (Conferme, OK)
|
|
- **Rosso**: #D32F2F (Errori, sottosorta)
|
|
|
|
## 📊 Dati Inclusi
|
|
|
|
- **4 Clienti**: Acme, TechFlow, European Logistics, Alpine Manufacturing
|
|
- **3 Fornitori**: Global Components, Asia Electronics, Nordic Materials
|
|
- **5 Articoli**: Widget, Connectors, Brackets, Bearings, Control Module
|
|
- **3 Ordini Vendita**: SO-2024-0001/0002/0003
|
|
- **3 Ordini Acquisto**: PO-2024-0001/0002/0003
|
|
|
|
## 🔌 API REST
|
|
|
|
Tutti gli endpoint sono auto-documentati su `/docs` (Swagger UI)
|
|
|
|
### Principali endpoint:
|
|
- `GET/POST /api/customers`
|
|
- `GET/POST /api/suppliers`
|
|
- `GET/POST /api/products`
|
|
- `GET/POST /api/sales-orders`
|
|
- `GET/POST /api/purchase-orders`
|
|
- `GET /api/warehouse/stats`
|
|
- `GET /api/info`
|
|
|
|
## 🔄 Migrazione a SQL
|
|
|
|
Pronto per SQLAlchemy + SQL Server/PostgreSQL:
|
|
```bash
|
|
pip install sqlalchemy sqlmodel
|
|
```
|
|
|
|
Sostituire `database.py` con modelli SQLModel e aggiungere connection string.
|
|
|
|
## ⚙️ Tech Stack
|
|
|
|
- **Backend**: FastAPI (async Python)
|
|
- **Template**: Jinja2
|
|
- **Validazione**: Pydantic
|
|
- **DB Demo**: In-memoria (list)
|
|
- **Frontend**: HTML5 + CSS3 + JavaScript vanilla
|
|
- **Icons**: Material Design Icons
|
|
- **Font**: Roboto (Google Fonts)
|
|
|
|
## ⚠️ Note
|
|
|
|
- Demo con dati fittizi in-memoria
|
|
- Per produzione: aggiungere auth, DB reale, validazione completa, HTTPS
|
|
- Facilmente estendibile con nuovi moduli
|