Vite + React + TS + Tailwind v4, runtime config.js and base-href contract (same shape as HDFC-Loan-Desk). Dealer: home, place order with the scheme engine live beside the form (query-kind record views over simulate()), orders with the Advisor's advice and one-click confirm-as-advised, schemes with progress to the next slab, incentives. Supplier: clusters + near-slab sweeps, dealers and dealer 360, advisories, scheme catalogue with draft → Analyst costing → approval, settlement runs with release/hold. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
56 lines
3.0 KiB
Markdown
56 lines
3.0 KiB
Markdown
# Dealer Scheme Advisor — console
|
|
|
|
The custom frontend for the **Meru Cement · Dealer Scheme Advisor** demo app on the
|
|
Zino platform (dev: org 900000123 / app 900000123). Two personas behind one login:
|
|
|
|
- **Dealer portal** (`/d`): this month at a glance, place an order with the scheme
|
|
engine live beside the form, my orders with the Advisor's advice and one-click
|
|
"take the advice", my schemes with progress to the next slab, incentives and
|
|
credit notes.
|
|
- **Supplier console** (`/s`, roles asm / rso_manager / ho_scheme_admin): clusters
|
|
and the near-slab sweep, dealers and a dealer 360 with "ask the Advisor", advisories,
|
|
the scheme catalogue with drafts → Analyst costing → RSO approval, settlement runs.
|
|
|
|
Vite + React 18 + TypeScript + Tailwind v4, built by frontgen on push. The platform
|
|
config this talks to is seeded from `sm2/custom-apps/dealer-schemes/`.
|
|
|
|
## Runtime contract (do not break)
|
|
|
|
- `VITE_ZINO_API_URL` is read at **runtime** from `config.js`, which frontgen writes
|
|
when it places the build (`frontgen.projects.zino_api_url`). Nothing is compiled in;
|
|
one build is promoted between environments unchanged. For `npm run dev` the value
|
|
comes from `.env` (copy `.env.example`).
|
|
- The router basename comes from the `<base href>` frontgen writes into `index.html`
|
|
(`<!--BASE_HREF-->`), and `vite.config.ts` keeps `base: './'`.
|
|
- Every colour is a token in `src/styles.css`; dark mode redefines the tokens. No
|
|
literal colours in components. Amber (`accent`) is reserved for money at stake;
|
|
violet (`ai`) for what the AI wrote.
|
|
|
|
## How the data flows
|
|
|
|
| Need | Call |
|
|
|---|---|
|
|
| Sign in | `POST /usr/login` (org_id as a string) → JWT; `GET /usr/me` for roles |
|
|
| Who am I in the estate | record view `dsa-rv-portal_user` (email → dealer code / territory) |
|
|
| Lists | `POST /app/900000123/view/recordview` with `rv_template_uid` + `search_query.filters` (`customer_no`, `rso_code`, `instance_id` …) |
|
|
| **The engine, live** | the same endpoint with `params`: `dsa-rv-simulate` (`customer_no`, `hypo_json`), `dsa-rv-dealer_snapshot`, `dsa-rv-monthly_history`, `dsa-rv-upcoming_schemes` — query-kind RDBMS templates over `scheme_erp.simulate()` and friends |
|
|
| Act | `POST /app/900000123/start` / `/activity` with the activity's field keys; forms render from `POST /app/900000123/view/form-screens` (`ActivityForm`) |
|
|
| What the AI did | `/app/900000123/view/audit?instance_id=` + `/monitor/decisions?instance_id=` |
|
|
|
|
The AI never runs in the browser: placing an order creates a Draft, the trigger wakes
|
|
the Scheme Advisor on the platform, and the order screen polls until the advice and
|
|
the recommendation rows land.
|
|
|
|
## Run
|
|
|
|
```bash
|
|
npm install
|
|
cp .env.example .env # VITE_ZINO_API_URL=https://dev.getzino.in
|
|
npm run dev # http://localhost:5175
|
|
npm run build # tsc -b && vite build → dist/
|
|
```
|
|
|
|
Demo logins (password in the sm2 README): `sharma@dealers.meru.example` (dealer, the
|
|
hero), `rso.bengaluru@meru.example` (RSO), `asm.hubballi@meru.example` (ASM),
|
|
`ho.schemes@meru.example` (HO).
|