UI: 3-tab layout (Admin overview / My dashboard / Training) + Settings page

Frontend:
- App shell with 3 tabs: Overview (admin), My Dashboard (all incl admin), Training + Settings icon
- New Settings.vue: edit profile (name/email) + change password (verify current)
- New MyBoard.vue: personal win/lose + weak areas + summary (all roles)
- New Training.vue: product/group list -> personas; admin manage + add product
- Dashboard.vue -> admin overview with date-range filter + per-trainee stats
- Added i18n keys (EN/TH) and tab/settings styling (ui-ux-pro-max design system)

Backend:
- /api/auth/change-password (verify current pw) + PUT /api/auth/profile
- Allow admin to train: board/weak-areas/chat/personas/sessions open to user+admin+super_admin
- /api/analytics now accepts ?from=&to= date filter + returns per_user summary

Verified: frontend builds; change-password (wrong/ok), profile, board all pass via test client; security tests pass
This commit is contained in:
Macky
2026-08-07 19:11:11 +07:00
parent 681561c22a
commit fc041b8f37
13 changed files with 707 additions and 97 deletions

View File

@@ -45,7 +45,7 @@ def _get_ready_group(s, gid: str) -> dict:
@chat_bp.post("/<gid>/personas/<pid>/chat/start")
@require_auth
@require_roles("user")
@require_roles("user", "admin", "super_admin")
def start_session(gid: str, pid: str):
s = _stores()
group = _get_ready_group(s, gid)
@@ -85,7 +85,7 @@ def start_session(gid: str, pid: str):
@chat_bp.post("/<gid>/personas/<pid>/chat/send")
@require_auth
@require_roles("user")
@require_roles("user", "admin", "super_admin")
def send_message(gid: str, pid: str):
s = _stores()
actor = current_user()
@@ -125,7 +125,7 @@ def send_message(gid: str, pid: str):
@chat_bp.post("/<gid>/personas/<pid>/chat/finish")
@require_auth
@require_roles("user")
@require_roles("user", "admin", "super_admin")
def finish_session(gid: str, pid: str):
"""End the chat and produce the debrief via the judge-LLM (reveals latent fields)."""
s = _stores()
@@ -168,7 +168,7 @@ def finish_session(gid: str, pid: str):
@chat_bp.get("/sessions")
@require_auth
@require_roles("user")
@require_roles("user", "admin", "super_admin")
def my_sessions():
s = _stores()
uid = current_user()["id"]
@@ -178,7 +178,7 @@ def my_sessions():
@chat_bp.get("/sessions/<sid>")
@require_auth
@require_roles("user")
@require_roles("user", "admin", "super_admin")
def get_session(sid: str):
s = _stores()
session = s["sessions"].get_or_none(sid)