- Updated security configuration to include new API route for file uploads. - Added new endpoints in AdminApiController for user statistics, toggling user status, updating user roles, and managing user details. - Implemented doctor statistics and management endpoints, including toggling doctor status and creating new doctors. - Enhanced user listing with filtering options for roles and status. - Introduced DoctorFormPage component for adding new doctors with specialties selection. - Integrated react-leaflet for mapping functionalities and added necessary dependencies. - Updated package.json and package-lock.json to include new dependencies.
111 lines
4.1 KiB
TypeScript
111 lines
4.1 KiB
TypeScript
import React from 'react';
|
|
import { Routes, Route, Navigate } from 'react-router-dom';
|
|
import { useAuthStore } from './stores/authStore';
|
|
import AdminLayout from './components/layout/AdminLayout';
|
|
import LoginPage from './pages/LoginPage';
|
|
import DashboardPage from './pages/DashboardPage';
|
|
import UsersPage from './pages/UsersPage';
|
|
import UserDetailPage from './pages/UserDetailPage';
|
|
import DoctorsPage from './pages/DoctorsPage';
|
|
import DoctorDetailPage from './pages/DoctorDetailPage';
|
|
import DoctorFormPage from './pages/DoctorFormPage';
|
|
import ClinicsPage from './pages/ClinicsPage';
|
|
import ClinicDetailPage from './pages/ClinicDetailPage';
|
|
import AppointmentsPage from './pages/AppointmentsPage';
|
|
import AppointmentDetailPage from './pages/AppointmentDetailPage';
|
|
import PaymentsPage from './pages/PaymentsPage';
|
|
import PaymentDetailPage from './pages/PaymentDetailPage';
|
|
import SettlementsPage from './pages/SettlementsPage';
|
|
import RepresentationsPage from './pages/RepresentationsPage';
|
|
import RepresentationDetailPage from './pages/RepresentationDetailPage';
|
|
import CommentsPage from './pages/CommentsPage';
|
|
import RatingsPage from './pages/RatingsPage';
|
|
import SmsPage from './pages/SmsPage';
|
|
import CategoriesPage from './pages/CategoriesPage';
|
|
import BlogsPage from './pages/BlogsPage';
|
|
import BlogFormPage from './pages/BlogFormPage';
|
|
import SecretariesPage from './pages/SecretariesPage';
|
|
|
|
function PrivateRoute({ children }: { children: React.ReactNode }) {
|
|
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
|
|
return isAuthenticated ? <>{children}</> : <Navigate to="/admin/login" replace />;
|
|
}
|
|
|
|
function PublicRoute({ children }: { children: React.ReactNode }) {
|
|
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
|
|
return isAuthenticated ? <Navigate to="/admin/dashboard" replace /> : <>{children}</>;
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<Routes>
|
|
<Route
|
|
path="/admin/login"
|
|
element={
|
|
<PublicRoute>
|
|
<LoginPage />
|
|
</PublicRoute>
|
|
}
|
|
/>
|
|
<Route
|
|
path="/admin/*"
|
|
element={
|
|
<PrivateRoute>
|
|
<AdminLayout />
|
|
</PrivateRoute>
|
|
}
|
|
>
|
|
<Route index element={<Navigate to="/admin/dashboard" replace />} />
|
|
<Route path="dashboard" element={<DashboardPage />} />
|
|
|
|
{/* Users */}
|
|
<Route path="users" element={<UsersPage />} />
|
|
<Route path="users/:uuid" element={<UserDetailPage />} />
|
|
|
|
{/* Doctors */}
|
|
<Route path="doctors" element={<DoctorsPage />} />
|
|
<Route path="doctors/new" element={<DoctorFormPage />} />
|
|
<Route path="doctors/:uuid" element={<DoctorDetailPage />} />
|
|
|
|
{/* Clinics */}
|
|
<Route path="clinics" element={<ClinicsPage />} />
|
|
<Route path="clinics/:uuid" element={<ClinicDetailPage />} />
|
|
|
|
{/* Appointments */}
|
|
<Route path="appointments" element={<AppointmentsPage />} />
|
|
<Route path="appointments/:uuid" element={<AppointmentDetailPage />} />
|
|
|
|
{/* Payments */}
|
|
<Route path="payments" element={<PaymentsPage />} />
|
|
<Route path="payments/:uuid" element={<PaymentDetailPage />} />
|
|
|
|
{/* Settlements */}
|
|
<Route path="settlements" element={<SettlementsPage />} />
|
|
|
|
{/* Representations */}
|
|
<Route path="representations" element={<RepresentationsPage />} />
|
|
<Route path="representations/:uuid" element={<RepresentationDetailPage />} />
|
|
|
|
{/* Comments & Ratings */}
|
|
<Route path="comments" element={<CommentsPage />} />
|
|
<Route path="ratings" element={<RatingsPage />} />
|
|
|
|
{/* SMS */}
|
|
<Route path="sms" element={<SmsPage />} />
|
|
|
|
{/* Categories */}
|
|
<Route path="categories" element={<CategoriesPage />} />
|
|
|
|
{/* Blogs */}
|
|
<Route path="blogs" element={<BlogsPage />} />
|
|
<Route path="blogs/new" element={<BlogFormPage />} />
|
|
<Route path="blogs/:uuid/edit" element={<BlogFormPage />} />
|
|
|
|
{/* Secretaries */}
|
|
<Route path="secretaries" element={<SecretariesPage />} />
|
|
</Route>
|
|
<Route path="*" element={<Navigate to="/admin/dashboard" replace />} />
|
|
</Routes>
|
|
);
|
|
}
|