**Motivations :** * Allow associating administrative procedures to module components with status tracking * Centralize regulation characteristics configuration for better data consistency * Link regulation characteristics to wastes, regulators, ecosystems, and module components **Root causes :** * Need to track administrative procedures per module component * Regulation characteristics were hardcoded in multiple places, causing inconsistency * No centralized way to manage and reference regulation characteristics **Correctifs :** * Added ModuleComponentProcedureAssociation interface with procedureId, status, and notes * Created RegulationCharacteristic entity with name, code, category, description, unit, isBoolean, minValue, maxValue * Added regulationCharacteristicIds field to Waste, NaturalRegulator, Ecosystem, and ModuleComponent * Updated all configuration pages to use regulation characteristics from centralized configuration * Created RegulationCharacteristicsConfigurationPage for managing characteristics * Added seeds for regulation characteristics (31 characteristics covering all categories) * Added seeds for companies (4NK Water & Waste default company) **Evolutions :** * Module components can now have associated administrative procedures with status (toDo, done, na) * Regulation characteristics are now centralized and can be referenced by multiple entities * All regulation needs and characteristics are now managed through a single configuration page * Business plans can be added to all entities (already implemented, documented in data_schemas.md) * Updated data_schemas.md with complete documentation of all entities, relations, and validation rules **Page affectées :** * src/pages/configuration/ModuleComponentsConfigurationPage.tsx - Added administrative procedures section * src/pages/configuration/RegulationCharacteristicsConfigurationPage.tsx - New page for managing characteristics * src/pages/configuration/WasteConfigurationPage.tsx - Updated to use regulation characteristics * src/pages/configuration/RegulatorsConfigurationPage.tsx - Updated to use regulation characteristics * src/pages/configuration/EcosystemsConfigurationPage.tsx - Updated to use regulation characteristics * src/types/index.ts - Added new interfaces and fields * src/utils/storage.ts - Added regulation characteristics and companies to storage * data_schemas.md - Complete documentation update * data/seeds/regulation-characteristics-seeds.json - New seed file * data/seeds/companies-seeds.json - New seed file
67 lines
3.6 KiB
TypeScript
67 lines
3.6 KiB
TypeScript
import { Routes, Route, Navigate } from 'react-router-dom'
|
|
import { useAuth } from './contexts/AuthContext'
|
|
import Layout from './components/layout/Layout'
|
|
import LoginPage from './pages/LoginPage'
|
|
import DashboardPage from './pages/DashboardPage'
|
|
import WasteConfigurationPage from './pages/configuration/WasteConfigurationPage'
|
|
import RegulatorsConfigurationPage from './pages/configuration/RegulatorsConfigurationPage'
|
|
import ServicesConfigurationPage from './pages/configuration/ServicesConfigurationPage'
|
|
import WasteOriginsConfigurationPage from './pages/configuration/WasteOriginsConfigurationPage'
|
|
import TransportersConfigurationPage from './pages/configuration/TransportersConfigurationPage'
|
|
import ModuleComponentsConfigurationPage from './pages/configuration/ModuleComponentsConfigurationPage'
|
|
import EcosystemsConfigurationPage from './pages/configuration/EcosystemsConfigurationPage'
|
|
import RegulationCharacteristicsConfigurationPage from './pages/configuration/RegulationCharacteristicsConfigurationPage'
|
|
import ProjectListPage from './pages/projects/ProjectListPage'
|
|
import ProjectConfigurationPage from './pages/projects/ProjectConfigurationPage'
|
|
import TreatmentSitesPage from './pages/projects/TreatmentSitesPage'
|
|
import WasteSitesPage from './pages/projects/WasteSitesPage'
|
|
import InvestorsPage from './pages/projects/InvestorsPage'
|
|
import AdministrativeProceduresPage from './pages/projects/AdministrativeProceduresPage'
|
|
import YieldsPage from './pages/YieldsPage'
|
|
import BusinessPlanPage from './pages/BusinessPlanPage'
|
|
import SettingsPage from './pages/SettingsPage'
|
|
import HelpPage from './pages/HelpPage'
|
|
|
|
function App() {
|
|
const { isAuthenticated } = useAuth()
|
|
|
|
if (!isAuthenticated) {
|
|
return (
|
|
<Routes>
|
|
<Route path="/login" element={<LoginPage />} />
|
|
<Route path="*" element={<Navigate to="/login" replace />} />
|
|
</Routes>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<Layout>
|
|
<Routes>
|
|
<Route path="/" element={<DashboardPage />} />
|
|
<Route path="/configuration/waste" element={<WasteConfigurationPage />} />
|
|
<Route path="/configuration/regulators" element={<RegulatorsConfigurationPage />} />
|
|
<Route path="/configuration/services" element={<ServicesConfigurationPage />} />
|
|
<Route path="/configuration/waste-origins" element={<WasteOriginsConfigurationPage />} />
|
|
<Route path="/configuration/transporters" element={<TransportersConfigurationPage />} />
|
|
<Route path="/configuration/module-components" element={<ModuleComponentsConfigurationPage />} />
|
|
<Route path="/configuration/ecosystems" element={<EcosystemsConfigurationPage />} />
|
|
<Route path="/configuration/regulation-characteristics" element={<RegulationCharacteristicsConfigurationPage />} />
|
|
<Route path="/projects" element={<ProjectListPage />} />
|
|
<Route path="/projects/new" element={<ProjectConfigurationPage />} />
|
|
<Route path="/projects/:id" element={<ProjectConfigurationPage />} />
|
|
<Route path="/projects/treatment-sites" element={<TreatmentSitesPage />} />
|
|
<Route path="/projects/waste-sites" element={<WasteSitesPage />} />
|
|
<Route path="/projects/investors" element={<InvestorsPage />} />
|
|
<Route path="/projects/procedures" element={<AdministrativeProceduresPage />} />
|
|
<Route path="/yields" element={<YieldsPage />} />
|
|
<Route path="/business-plan" element={<BusinessPlanPage />} />
|
|
<Route path="/settings" element={<SettingsPage />} />
|
|
<Route path="/help" element={<HelpPage />} />
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Routes>
|
|
</Layout>
|
|
)
|
|
}
|
|
|
|
export default App
|