Go to file
Samer Salameh a01c9324c3 Add a /v2/ build mode and nginx config for serving under mams.nafith.om
- .env.v2 and `npm run build:v2` (base /v2/, output dist-v2/)
- deploy/nginx-mams-v2.conf: serve the app at https://mams.nafith.om/v2/ so the existing reCAPTCHA key works

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 11:17:44 +03:00
deploy Add a /v2/ build mode and nginx config for serving under mams.nafith.om 2026-11-12 11:17:44 +03:00
public Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
scripts Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
src Feature work: events section, filters, form layouts, wizard fixes 2026-11-09 17:05:35 +03:00
.env.example Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
.env.production Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
.env.staging Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
.env.v2 Add a /v2/ build mode and nginx config for serving under mams.nafith.om 2026-11-12 11:17:44 +03:00
.gitignore Add a /v2/ build mode and nginx config for serving under mams.nafith.om 2026-11-12 11:17:44 +03:00
CLAUDE.md Add CLAUDE.md with the working rules, architecture and UI conventions 2026-11-08 16:58:03 +03:00
README.md Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
index.html Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
package-lock.json Upgrade dependencies: MUI 9, TypeScript 7 and patch updates 2026-11-09 17:05:35 +03:00
package.json Add a /v2/ build mode and nginx config for serving under mams.nafith.om 2026-11-12 11:17:44 +03:00
tsconfig.json Initial commit: new MAMS front end (React, Vite, TypeScript, MUI) 2026-11-08 16:55:26 +03:00
vite.config.ts Add a /v2/ build mode and nginx config for serving under mams.nafith.om 2026-11-12 11:17:44 +03:00

README.md

MAMS front end (React)

Replacement front end for the ColdFusion app OmanTCS_STG. The ColdFusion backend is unchanged; this app calls the same backend/core/controller.cfc endpoint.

Develop

npm install
npm run dev          # http://127.0.0.1:5173/mams/ , proxies /OmanTCS_stg to VITE_BACKEND_ORIGIN
npm run typecheck

Copy .env.example to .env to change VITE_API_BASE (default /OmanTCS_stg) or the dev proxy target.

How modules are built

Lists, search, view pages and Excel export are generic: they are driven by what the backend says per module (getGridStructure, search metadata, field metadata from getConfig). Only the form layout (section and field order) comes from the legacy pages:

node scripts/gen-layouts.mjs [path/to/legacy/frontend/entities]   # writes src/features/forms/generated-layouts.json

Run it again if a legacy page changes. src/features/forms/layouts.ts merges that file with the backend metadata, hand-written layouts (Users, Trucks) win, and owner / governorate-state-city pickers are wired automatically. A required dropdown the new UI has no data source for disables Save on that form (with a notice).

Menu: FLEET_TRACKING_SERVICES is hidden (HIDDEN_ENTITIES in src/layout/nav.ts); the old home-page dashboards live under the "Dashboard" menu (src/features/dashboard).

Run the production build on your PC (backend stays on 192.168.6.46)

npm start            # builds, then serves http://127.0.0.1:4173/mams/ with the backend proxied

Environments

Environment Command Frontend Backend
Local npm run dev http://localhost:5173/mams/ proxied to VITE_BACKEND_ORIGIN (default 192.168.6.46, /OmanTCS_stg)
Staging npm run build:staging (or dev:staging, start:staging) /mams/ on the staging IIS host, files from dist-staging/ http://192.168.6.46/OmanTCS_stg (same host)
Production npm run build https://mamsv2.nafith.om, files from dist/ https://mamsbe.nafith.om through the /api forward (see deploy/apache-mamsv2.conf)

Each one reads its own env file: .env (local overrides), .env.staging, .env.production.

Deploy to staging

  1. npm run build:staging
  2. Copy the contents of dist-staging/ to C:inetpubwwwrootmams on 192.168.6.46 (next to OmanTCS_stg); the app is then at http://192.168.6.46/mams/.
  3. IIS needs the URL Rewrite module for web.config (it is copied into the build).

Deploy to a server (IIS, same host as the backend)

The app must be served from the same host as the backend (session cookies, no CORS).

  1. npm run build
  2. Copy the contents of dist/ (not the folder itself) to C:\inetpub\wwwroot\mams\ on the server that hosts OmanTCS_stg (192.168.6.46). The app is then at http://<server>/mams/.
  3. The server needs the IIS URL Rewrite module for web.config (SPA fallback to /mams/index.html). Do not copy node_modules, src or package.json to the server.

Built for the /mams/ path. To serve under another path, build with VITE_BASE=/other/ npm run build and edit the rewrite target in public/web.config.