build(ui): expand application shell and implement administrative dashboard pages
This commit significantly expands the application's routing, navigation, and administrative capabilities. It introduces several new functional modules and refines the core layout for a more professional, dashboard-oriented experience. - **Routing & Navigation**: - Added routes for `wallboard`, `call-center`, `call-center/calls`, and `chat-questions`. - Updated `SidebarComponent` to include all new navigation items. - Enhanced `LayoutComponent` with dynamic navigation based on user roles (admin vs. user). - **New Administrative Pages**: - `WallboardPage`: Implements a real-time KPI dashboard with call activity trends and outcome distributions. - `CallCenterPage`: Provides a symbolic interface for managing call center connectivity and synchronization. - `CallCenterCallsPage`: Implements a call history retrieval interface with filtering capabilities. - `ChatQuestionsPage`: Adds a module for reviewing user questions from web and mobile channels. - **Core Infrastructure & Refinement**: - Updated `AppConfig` to include an `APP_INITIALIZER` for validating user identity via `AuthService` on startup. - Refined `HomeComponent` layout to a "Claude-style" continuous chat column. - Implemented global themed scrollbars and integrated the 'Lahze' font family. - Added `proxy.conf.json` and updated `angular.json` to support local backend development. - **Documentation**: - Added comprehensive API handoff guides for frontend-backend connection and MVP API catalog.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { map, Observable, of } from 'rxjs';
|
||||
import { HttpService } from '../http-request/http.service';
|
||||
import {
|
||||
CallActivityPoint,
|
||||
CallOutcomeShare,
|
||||
HourlyCallPoint,
|
||||
WallboardKpis,
|
||||
WallboardView,
|
||||
} from './wallboard.types';
|
||||
import {
|
||||
MOCK_CALL_ACTIVITY,
|
||||
MOCK_CALL_OUTCOMES,
|
||||
MOCK_HOURLY_CALLS,
|
||||
MOCK_WALLBOARD_KPIS,
|
||||
} from './wallboard.mock';
|
||||
|
||||
/**
|
||||
* Call center wallboard data source. The dashboard is read-only, so every
|
||||
* endpoint is a plain GET that returns a ready-to-render view. While no
|
||||
* wallboard endpoints exist on the backend, deterministic mock data keeps the
|
||||
* dashboard fully explorable; flip `useMockData` to false (and align the
|
||||
* endpoint paths) to consume the real API without touching the page.
|
||||
*/
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class WallboardService {
|
||||
private readonly http = inject(HttpService);
|
||||
|
||||
/** Flip to false once the backend wallboard endpoints are deployed. */
|
||||
private readonly useMockData = true;
|
||||
|
||||
getKpis(): Observable<WallboardKpis> {
|
||||
return this.request<WallboardKpis>('wallboard/kpis', {}, MOCK_WALLBOARD_KPIS);
|
||||
}
|
||||
|
||||
/** سهم روشهای پاسخگویی: هوش مصنوعی در مقابل کارشناس. */
|
||||
getOutcomes(): Observable<CallOutcomeShare[]> {
|
||||
return this.request<CallOutcomeShare[]>('wallboard/call-outcomes', {}, MOCK_CALL_OUTCOMES);
|
||||
}
|
||||
|
||||
getActivity(days = 14): Observable<CallActivityPoint[]> {
|
||||
return this.request<CallActivityPoint[]>(
|
||||
'wallboard/call-activity',
|
||||
{ days },
|
||||
MOCK_CALL_ACTIVITY,
|
||||
);
|
||||
}
|
||||
|
||||
getHourlyDistribution(): Observable<HourlyCallPoint[]> {
|
||||
return this.request<HourlyCallPoint[]>(
|
||||
'wallboard/hourly-distribution',
|
||||
{},
|
||||
MOCK_HOURLY_CALLS,
|
||||
);
|
||||
}
|
||||
|
||||
getOverview(): Observable<WallboardView> {
|
||||
return this.request<WallboardView>('wallboard/overview', {}, {
|
||||
kpis: MOCK_WALLBOARD_KPIS,
|
||||
outcomes: MOCK_CALL_OUTCOMES,
|
||||
activity: MOCK_CALL_ACTIVITY,
|
||||
hourly: MOCK_HOURLY_CALLS,
|
||||
});
|
||||
}
|
||||
|
||||
private request<T>(endpoint: string, params: Record<string, unknown>, fallback: T): Observable<T> {
|
||||
if (this.useMockData) {
|
||||
return of(fallback);
|
||||
}
|
||||
|
||||
return this.http
|
||||
.get<T>(endpoint, { params, skipToast: true, skipHasErrorCheck: true })
|
||||
.pipe(map((response) => response.result));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user