# Roadmap

Phase-by-phase build plan. `[x]` done · `[~]` partial · `[ ]` pending.

---

## ✅ Phase 0 — Foundation (DONE)

- [x] Laravel install + Valex theme integrated into Blade (layout, partials, assets)
- [x] MySQL database `amar_auto`
- [x] Multi-tenancy: `companies`, `company_settings`, tenant columns on `users`,
      `BelongsToCompany` trait (auto-scope), `SetActiveCompany` middleware
- [x] Module system: `config/modules.php` registry + per-company on/off + `module:` gate
- [x] Auth: themed login/logout, redirect by user_type
- [x] SuperAdmin panel: dashboard, Company CRUD, per-company module toggles, owner +
      system-roles auto-creation
- [x] Self-update engine: `update.json` + `UpdateHelper` + `app:update` + `/admin/system/update`
- [x] Multi-language: `_lang()`, en/bn files, locale switch
- [x] Permission system: catalog + `has_permission()` + `permission:` middleware

---

## 🚧 Phase 1 — Tenant core (NEXT)

Goal: a company owner logs in and runs their business day-to-day.

- [ ] **Company owner login flow** — landing on tenant dashboard, enabled modules only
- [ ] **Staff & Role management UI** (tenant side) — owner creates staff, assigns roles,
      edits role permissions from `config/permissions.php` catalog
- [ ] **Customer CRM module** (`crm_module`) — CRUD, GPS coordinate, category/profile,
      due balance, search/filter. *First full tenant CRUD — sets the pattern.*
- [ ] **Company settings page** — name/logo/currency/timezone, bill templates, VAT rate

## 🚚 Phase 2 — Assets & Delivery (the heart)

- [ ] **Asset module** (`asset_module`) — jar/dispenser/pump registry (table exists:
      `assets`), unique serial + **QR code generation**
- [ ] **QR scanning** — browser camera (`html5-qrcode`); in/out scan on delivery & return
- [ ] **Delivery logging** — deliveryman records delivery, scans QR, payment confirm
- [ ] **Consumption & refill analytics** — per-customer daily/weekly/monthly; jar lifespan
- [ ] **Deliveryman panel** (mobile-first) — duty shift, delivery counter, route/customer list
- [ ] **Driver & vehicle panel** — van assignment, meter mileage in/out, fuel log

## 💰 Phase 3 — Billing & Accounts

- [ ] **Billing module** (`billing_module`) — auto-generate invoices (tables exist:
      `invoices`, `invoice_items`) per customer category at day/week/month end
- [ ] **Payment collection** — cash/digital, due tracking, customer wallet/ledger
- [ ] **Omnichannel notifications** — WhatsApp / SMS / email bill + payment link *(needs
      queue workers — deferred earlier; revisit here)*
- [ ] **Accounts module** (`accounts_module`) — daily ledger (income/expense), chart of
      accounts, VAT/Tax calculation & compliance reports

## 👥 Phase 4 — HR & Payroll

- [ ] **HR module** (`hr_module`) — employee directory (factory/logistics/office)
- [ ] **Attendance & duty hours** — from deliveryman/driver duty sessions
- [ ] **Payroll** — auto salary from work-hours + attendance; advances/loans

## 📊 Phase 5 — Dashboards & Reports

- [ ] **Tenant dashboard with real data** — sales volume, live cash, jars in field
      (ApexCharts already in theme)
- [ ] **Reports module** (`reports_module`) — sales/revenue, due & collection efficiency,
      jar damage & servicing, km-vs-fuel analysis; daily/weekly/monthly filters; export

## 🔧 Phase 6 — Platform polish

- [ ] **SaaS billing/subscription** — packages, trial/subscription expiry, suspend gate
      (suspend page already wired) — like VMS membership-due enforcement
- [ ] **Queue workers** — notifications, bill generation, heavy reports (deferred from
      earlier; user chose parallel-build first)
- [ ] **PWA** — installable on phones, push notifications (if native-app feel needed)
- [ ] **Audit log / activity tracking**, **file manager**, **backups**

---

## Suggested next sprint

1. Tenant dashboard + company-owner login landing
2. Staff & Role management UI
3. **Customer CRM CRUD** ← establishes the reusable tenant-module pattern (controller +
   views + permission gating + `module:` + tenant scope)

Once CRM is done, every later module follows the same skeleton.
