diff --git a/README.md b/README.md index f63715f..db1ebf1 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,7 @@ docker exec -it procurement-postgres psql -U postgres -d procurement The databases are **not** in git — Docker volumes hold the data. To let everyone see the same system state, the repo ships exact database dumps in -`backups/` (taken 2026-09-02). After a fresh boot: +`backups/`. After a fresh boot: ```powershell powershell -ExecutionPolicy Bypass -File .\backups\restore.ps1 # Windows @@ -209,16 +209,26 @@ bash backups/restore.sh # Linux / Git ``` This **replaces all data** in the `procurement` and `casdoor` databases with -the committed state (users + roles, projects, warehouses, quotes with -receipts, inventory rows, Casdoor org/app/users). To create a fresh dump of -your own current state: +the committed state — a clean, realistic demo: 3 projects × 2 warehouses, +4 suppliers, 12 materials across all 8 categories, and 4 quotes covering +every lifecycle state (offered / in-transit / partially received / +completed) with matching stock. -```powershell -docker compose stop api casdoor -docker exec procurement-postgres pg_dump -U postgres -d procurement -Fc > backups/procurement.dump # (Git Bash: use -f inside the container + docker cp) -docker exec procurement-postgres pg_dump -U postgres -d casdoor -Fc > backups/casdoor.dump -docker compose start casdoor api -``` +Two alternative ways to get a clean state: + +1. **App seeder** (realistic demo data, keeps the Casdoor org as-is): + ```powershell + docker exec procurement-api sh -c "cd /srv/backend && python -m tools.seed" + ``` +2. **Casdoor seeder** (creates org `inventory` + app + users razaei / + mousavi / mohaghegh / tester — run once after a fresh volume): + ```powershell + python backend/tools/seed_casdoor.py # from the host, or from the api container + ``` + +To create a fresh dump of your own current state: stop `api` + `casdoor`, +`docker exec procurement-postgres pg_dump -U postgres -d procurement -Fc` +(+ the `casdoor` DB) into `backups/`, then start them again. ## Common operations diff --git a/backups/procurement.dump b/backups/procurement.dump index fc2bae1..f5368d8 100644 Binary files a/backups/procurement.dump and b/backups/procurement.dump differ diff --git a/docs/casdoor-auth.md b/docs/casdoor-auth.md index 76fd8ed..39abae1 100644 --- a/docs/casdoor-auth.md +++ b/docs/casdoor-auth.md @@ -235,6 +235,39 @@ After that, log in as the admin and use the Organization panel query params are dropped (previously `project_id=undefined` → 400 → empty dropdowns). +### Later batch (ledger fulfillment, demo data, hub-and-spoke) + +- **Ledger fulfillment split** («رسید جزیی»): the quotation card shows a + counter badge («رسید: X از Y قلم» / «تکمیل شد» / «در راه»); each line item + visually splits into its received part (رسید شده ✓ + date + warehouse from + the receipt allocations) and the in-transit remainder — quantities always + sum to the original line (totals unchanged). Display-only split, agreed to + keep the receipt/decision chain intact. +- **Demo data seeder** (`backend/tools/seed.py`): wipes the app tables and + seeds a clean realistic dataset (3 projects × 2 warehouses, 4 suppliers, + 12 materials across the 8 categories, 4 quotes in offered / in-transit / + partial / completed states with matching stock and receipts). Roles are + bound to the Casdoor users by username (run `seed_casdoor.py` first). + `backups/*.dump` are refreshed after seeding — teammates restore with + `backups/restore.ps1`. +- **Topics are API-driven**: the 8-topic grids (suppliers, wizard, units) + now come from `/material-categories` via the store instead of a hardcoded + list (which had a mismatched label «ابزار و تجهیزات ساخت»). +- **Hub-and-spoke navigation**: the tab strip lives only on «داشبورد انبار»; + sub-views (تغییر موجودی، کنترل روزانه، انبارها، کالاهای در راه، سازماندهی) + hide it and return via «بازگشت به داشبورد». «افزایش موجود» became the + «تغییر موجودی» entry button. +- **Stock count**: submission goes through a confirmation modal showing + current vs counted vs variance (کسری/مازاد) before the STOCK_COUNT + transaction is posted. +- **Found-items ceiling**: `found_qty ≤ missing balance` enforced client-side + (red input + inline warning, submit disabled) and server-side (422 with the + remaining balance); fully recovered losses drop off the pending list. +- **Semantic colors**: emerald = inflow (خرید/برگشت/پیدا شده), rose = + outflow (برداشت/ضایعات/اتلاف/مفقودی), blue = neutral (انتقال/شمارش + موجودی) across the warehouse module; quantities are shown as absolute + values with color-coded badges instead of ± signs. + ## 9. Managing Casdoor yourself - **Console:** http://localhost:8080 — log in as **admin / 123**. From there