68 lines
2.0 KiB
Markdown
68 lines
2.0 KiB
Markdown
# dashboard-cpsp-executive
|
|
|
|
Main-office executive dashboard. Same frontend look as site `dashboard-cpsp`, HQ mirror API in `backend/`.
|
|
|
|
## Architecture
|
|
|
|
```text
|
|
City A/B/C (API+DB) --API key sync--> HQ mirror API+DB --session--> Executive FE (:3002)
|
|
```
|
|
|
|
- **Roles**
|
|
- `director` / `director_admin`: view all sites (`director_admin` is **not** Django superuser)
|
|
- `buh` / `bu_admin`: view only GMs they manage (`managed_by`) and those GMs' sites
|
|
- `gm` / `gm_admin`: register city sites + sync; **only `gm`** approves cycle close
|
|
- `account_admin`: IT Central — User Management only; no ops dashboards
|
|
- `superuser`: break-glass (`bootstrap_admin` / seed `admin`) — director-level ops + Manajemen Akun; hidden from user lists
|
|
- `inactive`: locked out
|
|
- No `is_staff`
|
|
- **City registry:** `/api/v1/city-sites/` (GM / GM Admin)
|
|
- **Approve close:** `POST /api/v1/cycles/{id}/approve-close/` (GM only)
|
|
|
|
## Ports
|
|
|
|
| App | UI | API |
|
|
|-----|----|-----|
|
|
| Site `dashboard-cpsp` | `:3001` | `:8000` |
|
|
| HQ `dashboard-cpsp-executive` | `:3002` | `:8001` |
|
|
|
|
## Production (Docker)
|
|
|
|
Same Compose layout as the site app. On the HQ host: UI **:80**, API debug **:18001**, Postgres **:15433**.
|
|
|
|
```bash
|
|
cp docker/.env.example .env
|
|
# set SECRET_KEY, DB_PASSWORD, BOOTSTRAP_ADMIN_PASSWORD
|
|
docker compose up -d --build
|
|
```
|
|
|
|
See [DOCKER.md](DOCKER.md) for architecture, env vars, cron, and ops commands.
|
|
|
|
## Setup
|
|
|
|
**Backend**
|
|
|
|
```bash
|
|
cd backend
|
|
python -m venv .venv
|
|
.venv\Scripts\activate
|
|
pip install -r requirements.txt
|
|
cp .env.example .env
|
|
python manage.py migrate
|
|
python manage.py seed_demo
|
|
npm run dev
|
|
```
|
|
|
|
**Frontend**
|
|
|
|
```bash
|
|
cd ..
|
|
cp .env.example .env
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
Open [http://localhost:3002](http://localhost:3002).
|
|
|
|
Seed accounts: `admin`/`admin123` (`superuser` break-glass: ops + Manajemen Akun), `director`/`director123`, `director_admin`/`directoradmin123`, `buh`/`buh123`, `bu_admin`/`buadmin123`, `gm`/`gm123`, `gm_admin`/`gmadmin123`, `account_admin`/`accountadmin123` (IT user management only).
|