@almadar/cli 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/almadar +32 -1
- package/package.json +8 -6
- package/scripts/postinstall.js +41 -0
- package/shells/python-shell/.dockerignore +50 -0
- package/shells/python-shell/.env.example +55 -0
- package/shells/python-shell/Dockerfile +56 -0
- package/shells/python-shell/README.md +253 -0
- package/shells/python-shell/cloudbuild.yaml +76 -0
- package/shells/python-shell/docker-compose.yaml +57 -0
- package/shells/python-shell/pyproject.toml +28 -0
- package/shells/python-shell/scripts/deploy.sh +108 -0
- package/shells/python-shell/scripts/setup-secrets.sh +104 -0
- package/shells/python-shell/src/orbital_app/__init__.py +8 -0
- package/shells/python-shell/src/orbital_app/core/__init__.py +40 -0
- package/shells/python-shell/src/orbital_app/core/bindings.py +75 -0
- package/shells/python-shell/src/orbital_app/core/effect_executor.py +196 -0
- package/shells/python-shell/src/orbital_app/core/event_bus.py +119 -0
- package/shells/python-shell/src/orbital_app/core/event_router.py +38 -0
- package/shells/python-shell/src/orbital_app/core/firebase.py +112 -0
- package/shells/python-shell/src/orbital_app/core/repository.py +257 -0
- package/shells/python-shell/src/orbital_app/core/settings.py +74 -0
- package/shells/python-shell/src/orbital_app/core/websocket.py +202 -0
- package/shells/python-shell/src/orbital_app/main.py +108 -0
- package/shells/python-shell/src/orbital_app/middleware/__init__.py +18 -0
- package/shells/python-shell/src/orbital_app/middleware/auth.py +126 -0
- package/shells/python-shell/src/orbital_app/nn/__init__.py +28 -0
- package/shells/python-shell/src/orbital_app/nn/constraints.py +104 -0
- package/shells/python-shell/src/orbital_app/nn/forward.py +34 -0
- package/shells/python-shell/src/orbital_app/nn/training.py +101 -0
- package/shells/python-shell/src/orbital_app/tensor/__init__.py +46 -0
- package/shells/python-shell/src/orbital_app/tensor/contracts.py +112 -0
- package/shells/python-shell/src/orbital_app/tensor/ops.py +196 -0
- package/shells/python-shell/tests/conftest.py +63 -0
- package/shells/python-shell/tests/test_effect_executor.py +197 -0
- package/shells/python-shell/tests/test_event_bus.py +194 -0
- package/shells/python-shell/tests/test_generated_traits.py +268 -0
- package/shells/python-shell/tests/test_integration.py +347 -0
- package/shells/python-shell/tests/test_nn_builder.py +113 -0
- package/shells/python-shell/tests/test_nn_constraints.py +187 -0
- package/shells/python-shell/tests/test_nn_forward.py +98 -0
- package/shells/python-shell/tests/test_nn_training.py +130 -0
- package/shells/python-shell/tests/test_repository.py +151 -0
- package/shells/python-shell/tests/test_tensor_contracts.py +168 -0
- package/shells/python-shell/tests/test_tensor_ops.py +260 -0
- package/shells/typescript-shell/.env.example +30 -0
- package/shells/typescript-shell/.firebaserc.template +14 -0
- package/shells/typescript-shell/.prettierrc +7 -0
- package/shells/typescript-shell/Dockerfile +0 -0
- package/shells/typescript-shell/apphosting.yaml.template +0 -0
- package/shells/typescript-shell/firebase.json.template +0 -0
- package/shells/typescript-shell/firestore.indexes.json +4 -0
- package/shells/typescript-shell/firestore.rules.template +0 -0
- package/shells/typescript-shell/infra/aws/alb.tf +0 -0
- package/shells/typescript-shell/infra/aws/cloudfront.tf +0 -0
- package/shells/typescript-shell/infra/aws/ecs.tf +0 -0
- package/shells/typescript-shell/infra/aws/main.tf +0 -0
- package/shells/typescript-shell/infra/aws/rds.tf +0 -0
- package/shells/typescript-shell/infra/docker/Dockerfile.client +0 -0
- package/shells/typescript-shell/infra/docker/Dockerfile.server +0 -0
- package/shells/typescript-shell/infra/docker/docker-compose.prod.yml +45 -0
- package/shells/typescript-shell/infra/docker/docker-compose.yml +57 -0
- package/shells/typescript-shell/infra/docker/nginx.conf +0 -0
- package/shells/typescript-shell/infra/main.tf +0 -0
- package/shells/typescript-shell/infra/terraform/aws/alb.tf +0 -0
- package/shells/typescript-shell/infra/terraform/aws/cloudfront.tf +0 -0
- package/shells/typescript-shell/infra/terraform/aws/ecs.tf +0 -0
- package/shells/typescript-shell/infra/terraform/aws/main.tf +0 -0
- package/shells/typescript-shell/infra/terraform/aws/rds.tf +0 -0
- package/shells/typescript-shell/infra/terraform/main.tf +0 -0
- package/shells/typescript-shell/infra/terraform/variables.tf +0 -0
- package/shells/typescript-shell/infra/variables.tf +0 -0
- package/shells/typescript-shell/package-lock.json +15210 -0
- package/shells/typescript-shell/package.json +64 -0
- package/shells/typescript-shell/packages/client/.env.example +30 -0
- package/shells/typescript-shell/packages/client/index.html +13 -0
- package/shells/typescript-shell/packages/client/package.json +52 -0
- package/shells/typescript-shell/packages/client/postcss.config.js +6 -0
- package/shells/typescript-shell/packages/client/src/App.tsx +56 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/CreditExpirationAlert.stories.tsx +75 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/CreditExpirationAlert.tsx +157 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/CreditMeter.stories.tsx +155 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/CreditMeter.tsx +370 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/ExerciseVideoLink.stories.tsx +50 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/ExerciseVideoLink.tsx +143 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/ShareableLinkGenerator.stories.tsx +54 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/ShareableLinkGenerator.tsx +210 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/atoms/index.ts +4 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/index.ts +83 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/BodyMeasurementInput.stories.tsx +117 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/BodyMeasurementInput.tsx +343 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/DailyProgressInput.stories.tsx +82 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/DailyProgressInput.tsx +345 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/GroupSessionCard.stories.tsx +155 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/GroupSessionCard.tsx +319 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/LiftTracker.stories.tsx +110 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/LiftTracker.tsx +395 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/MealPlanCard.stories.tsx +132 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/MealPlanCard.tsx +394 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/NutritionSummary.stories.tsx +127 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/NutritionSummary.tsx +360 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/ProgressChart.stories.tsx +119 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/ProgressChart.tsx +377 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/SpecialExerciseCard.stories.tsx +115 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/SpecialExerciseCard.tsx +294 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/TraineeCard.stories.tsx +139 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/TraineeCard.tsx +306 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/WorkoutPlanCard.stories.tsx +140 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/WorkoutPlanCard.tsx +379 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/molecules/index.ts +10 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/AIAnalysisPanel.stories.tsx +171 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/AIAnalysisPanel.tsx +257 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/KinesiologyExamForm.stories.tsx +157 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/KinesiologyExamForm.tsx +383 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/SessionScheduler.stories.tsx +249 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/SessionScheduler.tsx +637 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/TraineeComparison.stories.tsx +221 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/TraineeComparison.tsx +438 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/WeeklyCalendar.stories.tsx +208 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/WeeklyCalendar.tsx +380 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/organisms/index.ts +5 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/CreditsTemplate.stories.tsx +243 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/CreditsTemplate.tsx +496 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/FitnessTemplate.stories.tsx +237 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/FitnessTemplate.tsx +457 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/MealPlanDetailTemplate.stories.tsx +184 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/MealPlanDetailTemplate.tsx +414 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/MealPlansTemplate.stories.tsx +198 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/MealPlansTemplate.tsx +296 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/ProgressTemplate.stories.tsx +242 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/ProgressTemplate.tsx +497 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/ScheduleTemplate.stories.tsx +267 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/ScheduleTemplate.tsx +424 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/SessionDetailTemplate.stories.tsx +214 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/SessionDetailTemplate.tsx +518 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/SessionsTemplate.stories.tsx +207 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/SessionsTemplate.tsx +508 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/TraineeDetailTemplate.stories.tsx +178 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/TraineeDetailTemplate.tsx +396 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/TraineesTemplate.stories.tsx +168 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/TraineesTemplate.tsx +429 -0
- package/shells/typescript-shell/packages/client/src/clients/blaz-kelemnc/templates/index.ts +44 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/atoms/LawReferenceBadge.stories.tsx +78 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/atoms/LawReferenceBadge.tsx +87 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/atoms/PhaseIndicator.stories.tsx +91 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/atoms/PhaseIndicator.tsx +142 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/atoms/index.ts +8 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/index.ts +79 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-001-uvod.json +361 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-001-uvod.ts +361 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-002-podjetje.json +115 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-002-podjetje.ts +115 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-003-udelezenci.json +78 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-003-udelezenci.ts +78 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-004-izbira-podrocja.json +85 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-004-izbira-podrocja.ts +94 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-005-trgovina.json +1056 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-005-trgovina.ts +1056 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-006-ugotovitve.json +128 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-006-ugotovitve.ts +128 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-007-odlocbe.json +136 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-007-odlocbe.ts +136 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-008-pripombe.json +148 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-008-pripombe.ts +148 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-009-zakljucek.json +207 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T-009-zakljucek.ts +207 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T2-1-oznacevanje-cen.json +1265 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/configs/tabs/T2-1-oznacevanje-cen.ts +1265 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/index.ts +137 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/CardSelector.stories.tsx +128 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/CardSelector.tsx +174 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ComplianceSummary.stories.tsx +115 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ComplianceSummary.tsx +263 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ConditionalField.tsx +254 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/DocumentPreview.tsx +249 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/EntitySearch.tsx +290 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/InspectionTimeline.stories.tsx +138 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/InspectionTimeline.tsx +253 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ObjectionRecorder.tsx +213 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ParticipantList.stories.tsx +86 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ParticipantList.tsx +227 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/PhotoAttachment.tsx +276 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ProgressHeader.stories.tsx +89 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/ProgressHeader.tsx +157 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/RepeatableFormSection.tsx +189 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/RuleCheckItem.stories.tsx +118 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/RuleCheckItem.tsx +237 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/molecules/index.ts +18 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/organisms/FloatingActionMenu.stories.tsx +75 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/organisms/FloatingActionMenu.tsx +197 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/organisms/SignatureCapture.stories.tsx +96 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/organisms/SignatureCapture.tsx +278 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/organisms/index.ts +8 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/CompaniesTemplate.stories.tsx +107 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/CompaniesTemplate.tsx +266 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionFormDemoTemplate.stories.tsx +607 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionFormDemoTemplate.tsx +1428 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionProcessTemplate.stories.tsx +713 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionProcessTemplate.tsx +1582 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionWizardTemplate.stories.tsx +174 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionWizardTemplate.tsx +264 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionsTemplate.stories.tsx +129 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectionsTemplate.tsx +287 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectorsTemplate.stories.tsx +94 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/InspectorsTemplate.tsx +255 -0
- package/shells/typescript-shell/packages/client/src/clients/inspection-system/templates/index.ts +47 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/atoms/MindMapConnections.stories.tsx +82 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/atoms/MindMapConnections.tsx +75 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/atoms/index.ts +2 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/index.ts +96 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/ConceptMetaTags.stories.tsx +64 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/ConceptMetaTags.tsx +77 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/GraphLegend.stories.tsx +100 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/GraphLegend.tsx +120 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/LayerNavigator.stories.tsx +109 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/LayerNavigator.tsx +157 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/LearningGoalDisplay.stories.tsx +62 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/LearningGoalDisplay.tsx +138 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/MindMapHeader.tsx +47 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/MindMapNode.stories.tsx +212 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/MindMapNode.tsx +294 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/NoteContent.stories.tsx +98 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/NoteContent.tsx +163 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/NoteListItem.stories.tsx +196 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/NoteListItem.tsx +239 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/QuizBlock.tsx +3 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/StreamingDisplay.stories.tsx +132 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/StreamingDisplay.tsx +232 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/index.ts +28 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/ActivationBlock.stories.tsx +71 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/ActivationBlock.tsx +127 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/BloomQuizBlock.stories.tsx +154 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/BloomQuizBlock.tsx +232 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/ConnectionBlock.stories.tsx +57 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/ConnectionBlock.tsx +60 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/QuizBlock.tsx +138 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/ReflectionBlock.stories.tsx +90 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/ReflectionBlock.tsx +151 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/learning/index.ts +14 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/markdown/CodeBlock.stories.tsx +188 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/markdown/CodeBlock.tsx +165 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/markdown/MarkdownContent.stories.tsx +160 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/markdown/MarkdownContent.tsx +131 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/molecules/markdown/index.ts +5 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/ConceptCard.stories.tsx +155 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/ConceptCard.tsx +301 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/FlashCard.stories.tsx +105 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/FlashCard.tsx +200 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/FlashCardStack.stories.tsx +97 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/FlashCardStack.tsx +163 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/FlashCardsDisplay.tsx +236 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/ForceDirectedGraph.stories.tsx +230 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/ForceDirectedGraph.tsx +488 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/MindMapCanvas.stories.tsx +256 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/MindMapCanvas.tsx +185 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/NoteList.stories.tsx +178 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/NoteList.tsx +209 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/SegmentRenderer.stories.tsx +238 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/SegmentRenderer.tsx +196 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/organisms/index.ts +18 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/patterns/component-mapping.json +122 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/patterns/event-contracts.json +145 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/patterns/index.ts +46 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/templates/ConceptDetailTemplate.stories.tsx +148 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/templates/ConceptDetailTemplate.tsx +266 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/templates/KnowledgeGraphTemplate.stories.tsx +215 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/templates/KnowledgeGraphTemplate.tsx +302 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/templates/LessonTemplate.stories.tsx +161 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/templates/LessonTemplate.tsx +264 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/templates/index.ts +4 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/types/index.ts +9 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/types/mindMapTypes.ts +13 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/utils/index.ts +6 -0
- package/shells/typescript-shell/packages/client/src/clients/kflow/utils/parseLessonSegments.ts +191 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/atoms/CareIndicator.tsx +113 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/atoms/GrowthMeter.tsx +216 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/atoms/SeasonIndicator.tsx +140 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/atoms/TrustMeter.tsx +221 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/atoms/index.ts +15 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/index.ts +159 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/molecules/HarvestCard.tsx +254 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/molecules/PlantCard.tsx +412 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/molecules/WeatherWidget.tsx +229 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/molecules/index.ts +12 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/organisms/GardenView.tsx +344 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/organisms/index.ts +6 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/AdminDashboardTemplate.tsx +423 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/AssessmentTemplate.tsx +409 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/ConnectionsTemplate.tsx +465 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/GraphIntelligenceTemplate.tsx +388 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/InvitesTemplate.tsx +359 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/ProjectDetailTemplate.tsx +483 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/ProjectsTemplate.tsx +474 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/RelationshipGardenTemplate.tsx +198 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/SeedNetworkTemplate.tsx +410 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/SuggestionsTemplate.tsx +352 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/TeamDetailTemplate.tsx +494 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/TeamMembersTemplate.tsx +427 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/TeamsTemplate.tsx +424 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/TrustIntelligenceTemplate.tsx +312 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/UserProfileTemplate.tsx +308 -0
- package/shells/typescript-shell/packages/client/src/clients/winning-11/templates/UsersTemplate.tsx +303 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Avatar.tsx +226 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Badge.tsx +79 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Box.tsx +262 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Button.tsx +150 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Card.tsx +151 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Center.tsx +67 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Checkbox.tsx +46 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/ConditionalWrapper.tsx +139 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Divider.tsx +102 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Icon.tsx +224 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Input.tsx +192 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Label.tsx +26 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/LawReferenceTooltip.tsx +190 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Overlay.tsx +37 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/ProgressBar.tsx +256 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Radio.tsx +164 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Select.tsx +62 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Spacer.tsx +68 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Spinner.tsx +32 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Stack.tsx +151 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Switch.tsx +91 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/TextHighlight.tsx +111 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Textarea.tsx +32 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/ThemeSelector.tsx +128 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/ThemeToggle.tsx +91 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/Typography.tsx +207 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/game/ControlButton.tsx +118 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/game/HealthBar.tsx +93 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/game/ScoreDisplay.tsx +86 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/game/Sprite.tsx +188 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/game/index.ts +12 -0
- package/shells/typescript-shell/packages/client/src/components/atoms/index.ts +88 -0
- package/shells/typescript-shell/packages/client/src/components/index.ts +4 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Accordion.tsx +223 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Alert.tsx +117 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Breadcrumb.tsx +159 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/ButtonGroup.tsx +226 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Card.tsx +135 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Container.tsx +78 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Drawer.tsx +254 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/EmptyState.tsx +132 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/ErrorState.tsx +48 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/FilterGroup.tsx +529 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Flex.tsx +131 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/FloatingActionButton.tsx +264 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/FormField.tsx +48 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/FormSectionHeader.tsx +139 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Grid.tsx +194 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/InputGroup.tsx +109 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/LoadingState.tsx +39 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Menu.tsx +266 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Modal.tsx +171 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Pagination.tsx +254 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Popover.tsx +201 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/RelationSelect.tsx +328 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/RepeatableFormSection.tsx +236 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/SearchInput.tsx +196 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/SidePanel.tsx +116 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/SimpleGrid.tsx +90 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Tabs.tsx +208 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Toast.tsx +154 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/Tooltip.tsx +172 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/ViolationAlert.tsx +253 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/WizardNavigation.tsx +166 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/WizardProgress.tsx +140 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/game/ActionButtons.tsx +148 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/game/DPad.tsx +98 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/game/StatBadge.tsx +104 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/game/index.ts +11 -0
- package/shells/typescript-shell/packages/client/src/components/molecules/index.ts +36 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/CardGrid.tsx +479 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/ComponentPatterns.tsx +1000 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/ConfirmDialog.tsx +165 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/CustomPattern.tsx +479 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/DataTable.tsx +816 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/DetailPanel.tsx +626 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/DrawerSlot.tsx +86 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/Form.tsx +968 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/FormSection.tsx +168 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/Header.tsx +263 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/LayoutPatterns.tsx +325 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/List.tsx +838 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/MasterDetail.tsx +85 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/ModalSlot.tsx +81 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/Navigation.tsx +157 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/OrbitalVisualization.tsx +480 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/PageHeader.tsx +244 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/Section.tsx +131 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/Sidebar.tsx +270 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/Split.tsx +121 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/StatCard.tsx +360 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/Table.tsx +394 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/ToastSlot.tsx +106 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/UISlotRenderer.tsx +647 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/WizardContainer.tsx +369 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/RuntimeDebugger.css +102 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/RuntimeDebugger.tsx +176 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/hooks/useDebugData.ts +100 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/index.ts +10 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/tabs/EntitiesTab.tsx +130 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/tabs/EventFlowTab.tsx +135 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/tabs/GuardsPanel.tsx +124 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/tabs/TicksTab.tsx +100 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/debug/tabs/TraitsTab.tsx +102 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/CollisionDetector.tsx +195 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/DialogueBox.tsx +279 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/GameCanvas.tsx +550 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/GameControls.tsx +173 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/GameHud.tsx +135 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/GameMenu.tsx +188 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/GameOverScreen.tsx +241 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/GamePauseOverlay.tsx +158 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/InputListener.tsx +161 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/InventoryPanel.tsx +230 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/LevelSelect.tsx +236 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/TilemapRenderer.tsx +233 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/game/index.ts +28 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/index.ts +83 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/layout/DashboardGrid.tsx +94 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/layout/MasterDetail.tsx +93 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/layout/SplitPane.tsx +136 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/layout/TabbedContainer.tsx +162 -0
- package/shells/typescript-shell/packages/client/src/components/organisms/layout/index.ts +10 -0
- package/shells/typescript-shell/packages/client/src/components/templates/AuthLayout.tsx +125 -0
- package/shells/typescript-shell/packages/client/src/components/templates/CounterTemplate.tsx +224 -0
- package/shells/typescript-shell/packages/client/src/components/templates/CrudTemplate.tsx +511 -0
- package/shells/typescript-shell/packages/client/src/components/templates/DashboardLayout.tsx +295 -0
- package/shells/typescript-shell/packages/client/src/components/templates/FormTemplate.tsx +328 -0
- package/shells/typescript-shell/packages/client/src/components/templates/GameTemplate.tsx +142 -0
- package/shells/typescript-shell/packages/client/src/components/templates/GenericAppTemplate.tsx +79 -0
- package/shells/typescript-shell/packages/client/src/components/templates/ListTemplate.tsx +361 -0
- package/shells/typescript-shell/packages/client/src/components/templates/SettingsTemplate.tsx +459 -0
- package/shells/typescript-shell/packages/client/src/components/templates/index.ts +54 -0
- package/shells/typescript-shell/packages/client/src/config/firebase.ts +58 -0
- package/shells/typescript-shell/packages/client/src/context/DesignThemeContext.tsx +40 -0
- package/shells/typescript-shell/packages/client/src/context/ThemeContext.tsx +321 -0
- package/shells/typescript-shell/packages/client/src/context/UISlotContext.tsx +143 -0
- package/shells/typescript-shell/packages/client/src/context/UserContext.tsx +259 -0
- package/shells/typescript-shell/packages/client/src/context/index.ts +44 -0
- package/shells/typescript-shell/packages/client/src/evaluator/SExpressionEvaluator.ts +715 -0
- package/shells/typescript-shell/packages/client/src/evaluator/context.ts +196 -0
- package/shells/typescript-shell/packages/client/src/evaluator/index.ts +52 -0
- package/shells/typescript-shell/packages/client/src/evaluator/operators/arithmetic.ts +120 -0
- package/shells/typescript-shell/packages/client/src/evaluator/operators/collections.ts +177 -0
- package/shells/typescript-shell/packages/client/src/evaluator/operators/comparison.ts +130 -0
- package/shells/typescript-shell/packages/client/src/evaluator/operators/control.ts +86 -0
- package/shells/typescript-shell/packages/client/src/evaluator/operators/effects.ts +285 -0
- package/shells/typescript-shell/packages/client/src/evaluator/operators/index.ts +69 -0
- package/shells/typescript-shell/packages/client/src/evaluator/operators/logic.ts +66 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/array.ts +657 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/async.ts +210 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/format.ts +224 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/index.ts +206 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/math.ts +219 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/object.ts +435 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/str.ts +372 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/time.ts +594 -0
- package/shells/typescript-shell/packages/client/src/evaluator/std/validate.ts +445 -0
- package/shells/typescript-shell/packages/client/src/evaluator/types/expression.ts +297 -0
- package/shells/typescript-shell/packages/client/src/features/auth/AuthContext.tsx +192 -0
- package/shells/typescript-shell/packages/client/src/features/auth/authService.ts +90 -0
- package/shells/typescript-shell/packages/client/src/features/auth/components/Login.tsx +282 -0
- package/shells/typescript-shell/packages/client/src/features/auth/components/ProtectedRoute.tsx +28 -0
- package/shells/typescript-shell/packages/client/src/features/auth/components/UserProfile.tsx +52 -0
- package/shells/typescript-shell/packages/client/src/features/auth/components/index.ts +3 -0
- package/shells/typescript-shell/packages/client/src/features/auth/index.ts +4 -0
- package/shells/typescript-shell/packages/client/src/features/auth/types.ts +33 -0
- package/shells/typescript-shell/packages/client/src/hooks/event-bus-types.ts +70 -0
- package/shells/typescript-shell/packages/client/src/hooks/index.ts +84 -0
- package/shells/typescript-shell/packages/client/src/hooks/useEntities.ts +118 -0
- package/shells/typescript-shell/packages/client/src/hooks/useEntityData.ts +288 -0
- package/shells/typescript-shell/packages/client/src/hooks/useEntityMutations.ts +258 -0
- package/shells/typescript-shell/packages/client/src/hooks/useEventBus.ts +166 -0
- package/shells/typescript-shell/packages/client/src/hooks/useOrbitalMutations.ts +234 -0
- package/shells/typescript-shell/packages/client/src/hooks/useQuerySingleton.ts +179 -0
- package/shells/typescript-shell/packages/client/src/hooks/useUIEvents.ts +228 -0
- package/shells/typescript-shell/packages/client/src/hooks/useUISlots.ts +320 -0
- package/shells/typescript-shell/packages/client/src/index.css +15 -0
- package/shells/typescript-shell/packages/client/src/lib/api-client.ts +134 -0
- package/shells/typescript-shell/packages/client/src/lib/cn.ts +10 -0
- package/shells/typescript-shell/packages/client/src/lib/debug.ts +114 -0
- package/shells/typescript-shell/packages/client/src/lib/debugRegistry.ts +108 -0
- package/shells/typescript-shell/packages/client/src/lib/debugUtils.ts +62 -0
- package/shells/typescript-shell/packages/client/src/lib/entityDebug.ts +79 -0
- package/shells/typescript-shell/packages/client/src/lib/guardRegistry.ts +79 -0
- package/shells/typescript-shell/packages/client/src/lib/tickRegistry.ts +86 -0
- package/shells/typescript-shell/packages/client/src/lib/traitRegistry.ts +84 -0
- package/shells/typescript-shell/packages/client/src/loaders/AssetLoader.ts +315 -0
- package/shells/typescript-shell/packages/client/src/loaders/index.ts +17 -0
- package/shells/typescript-shell/packages/client/src/main.tsx +24 -0
- package/shells/typescript-shell/packages/client/src/pages/index.ts +2 -0
- package/shells/typescript-shell/packages/client/src/providers/EventBusProvider.tsx +212 -0
- package/shells/typescript-shell/packages/client/src/providers/FetchedDataProvider.tsx +280 -0
- package/shells/typescript-shell/packages/client/src/providers/OrbitalProvider.tsx +136 -0
- package/shells/typescript-shell/packages/client/src/providers/SelectionProvider.tsx +232 -0
- package/shells/typescript-shell/packages/client/src/providers/index.ts +31 -0
- package/shells/typescript-shell/packages/client/src/renderer/client-effect-executor.ts +267 -0
- package/shells/typescript-shell/packages/client/src/renderer/data-resolver.ts +253 -0
- package/shells/typescript-shell/packages/client/src/renderer/index.ts +138 -0
- package/shells/typescript-shell/packages/client/src/renderer/offline-executor.ts +610 -0
- package/shells/typescript-shell/packages/client/src/renderer/pattern-resolver.ts +209 -0
- package/shells/typescript-shell/packages/client/src/renderer/slot-definitions.ts +154 -0
- package/shells/typescript-shell/packages/client/src/renderer/types.ts +214 -0
- package/shells/typescript-shell/packages/client/src/renderer/useClientEffects.ts +236 -0
- package/shells/typescript-shell/packages/client/src/stores/entityStore.ts +233 -0
- package/shells/typescript-shell/packages/client/src/stores/filtering.ts +180 -0
- package/shells/typescript-shell/packages/client/src/stores/index.ts +11 -0
- package/shells/typescript-shell/packages/client/src/test/setup.ts +126 -0
- package/shells/typescript-shell/packages/client/src/themes/almadar.css +196 -0
- package/shells/typescript-shell/packages/client/src/themes/index.css +11 -0
- package/shells/typescript-shell/packages/client/src/themes/minimalist.css +193 -0
- package/shells/typescript-shell/packages/client/src/themes/wireframe.css +188 -0
- package/shells/typescript-shell/packages/client/src/types/__tests__/event-contracts.test.ts +204 -0
- package/shells/typescript-shell/packages/client/src/types/event-contracts.ts +267 -0
- package/shells/typescript-shell/packages/client/tailwind.config.js +55 -0
- package/shells/typescript-shell/packages/client/tsconfig.json +33 -0
- package/shells/typescript-shell/packages/client/tsconfig.node.json +12 -0
- package/shells/typescript-shell/packages/client/vite.config.d.ts +3 -0
- package/shells/typescript-shell/packages/client/vite.config.d.ts.map +1 -0
- package/shells/typescript-shell/packages/client/vite.config.js +43 -0
- package/shells/typescript-shell/packages/client/vite.config.js.map +1 -0
- package/shells/typescript-shell/packages/client/vite.config.ts +48 -0
- package/shells/typescript-shell/packages/server/.env.development +8 -0
- package/shells/typescript-shell/packages/server/.env.example +22 -0
- package/shells/typescript-shell/packages/server/package.json +41 -0
- package/shells/typescript-shell/packages/server/src/__tests__/integration.test.ts +23 -0
- package/shells/typescript-shell/packages/server/src/app.ts +53 -0
- package/shells/typescript-shell/packages/server/src/features/.gitkeep +10 -0
- package/shells/typescript-shell/packages/server/src/index.ts +60 -0
- package/shells/typescript-shell/packages/server/src/integrators/INTEGRATORS.md +357 -0
- package/shells/typescript-shell/packages/server/src/integrators/__tests__/registry.test.ts +419 -0
- package/shells/typescript-shell/packages/server/src/integrators/__tests__/types.test.ts +382 -0
- package/shells/typescript-shell/packages/server/src/integrators/__tests__/youtube.closed-circuit.test.ts +454 -0
- package/shells/typescript-shell/packages/server/src/integrators/__tests__/youtube.test.ts +519 -0
- package/shells/typescript-shell/packages/server/src/integrators/index.ts +67 -0
- package/shells/typescript-shell/packages/server/src/integrators/llm.ts +585 -0
- package/shells/typescript-shell/packages/server/src/integrators/registry.ts +318 -0
- package/shells/typescript-shell/packages/server/src/integrators/types.ts +248 -0
- package/shells/typescript-shell/packages/server/src/integrators/youtube.ts +614 -0
- package/shells/typescript-shell/packages/server/src/lib/db.ts +130 -0
- package/shells/typescript-shell/packages/server/src/lib/env.ts +47 -0
- package/shells/typescript-shell/packages/server/src/lib/eventBus.ts +80 -0
- package/shells/typescript-shell/packages/server/src/lib/index.ts +10 -0
- package/shells/typescript-shell/packages/server/src/lib/logger.ts +48 -0
- package/shells/typescript-shell/packages/server/src/lib/websocket.ts +161 -0
- package/shells/typescript-shell/packages/server/src/middleware/authenticateFirebase.ts +29 -0
- package/shells/typescript-shell/packages/server/src/middleware/errorHandler.ts +135 -0
- package/shells/typescript-shell/packages/server/src/middleware/index.ts +15 -0
- package/shells/typescript-shell/packages/server/src/middleware/validation.ts +77 -0
- package/shells/typescript-shell/packages/server/src/routes/__tests__/orbitals.e2e.test.ts +405 -0
- package/shells/typescript-shell/packages/server/src/routes/features/.gitkeep +0 -0
- package/shells/typescript-shell/packages/server/src/routes/index.ts +11 -0
- package/shells/typescript-shell/packages/server/src/routes/orbitals.ts +138 -0
- package/shells/typescript-shell/packages/server/src/routes/register.ts +19 -0
- package/shells/typescript-shell/packages/server/src/routes.ts +58 -0
- package/shells/typescript-shell/packages/server/src/seedMockData.ts +27 -0
- package/shells/typescript-shell/packages/server/src/services/DataService.ts +402 -0
- package/shells/typescript-shell/packages/server/src/services/MockDataService.ts +347 -0
- package/shells/typescript-shell/packages/server/src/services/index.ts +8 -0
- package/shells/typescript-shell/packages/server/src/types/express.d.ts +13 -0
- package/shells/typescript-shell/packages/server/src/utils/index.ts +9 -0
- package/shells/typescript-shell/packages/server/src/utils/queryFilters.ts +231 -0
- package/shells/typescript-shell/packages/server/tsconfig.json +28 -0
- package/shells/typescript-shell/packages/shared/package.json +22 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/atom-demo.test.ts +61 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/container-demo.test.ts +43 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/content-item.test.ts +55 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/game-state.test.ts +67 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/layout-demo.test.ts +43 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/modal-item.test.ts +49 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/molecule-demo.test.ts +55 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/nav-item.test.ts +55 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/product.test.ts +78 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/project.test.ts +85 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/searchable-item.test.ts +61 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/state-demo.test.ts +43 -0
- package/shells/typescript-shell/packages/shared/src/__tests__/entities/wizard-data.test.ts +61 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/SExpressionEvaluator.ts +715 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/context.ts +196 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/index.ts +52 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/operators/arithmetic.ts +120 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/operators/collections.ts +177 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/operators/comparison.ts +130 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/operators/control.ts +86 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/operators/effects.ts +285 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/operators/index.ts +69 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/operators/logic.ts +66 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/array.ts +657 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/async.ts +210 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/format.ts +224 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/index.ts +206 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/math.ts +219 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/object.ts +435 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/str.ts +372 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/time.ts +594 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/std/validate.ts +445 -0
- package/shells/typescript-shell/packages/shared/src/evaluator/types/expression.ts +297 -0
- package/shells/typescript-shell/packages/shared/src/index.ts +12 -0
- package/shells/typescript-shell/packages/shared/src/schemas/entities.ts +13 -0
- package/shells/typescript-shell/packages/shared/src/types/entities.ts +321 -0
- package/shells/typescript-shell/packages/shared/src/types/events.ts +82 -0
- package/shells/typescript-shell/packages/shared/tsconfig.json +16 -0
- package/shells/typescript-shell/tests/setup.ts +22 -0
- package/shells/typescript-shell/tsconfig.base.json +21 -0
- package/shells/typescript-shell/tsconfig.json +13 -0
- package/shells/typescript-shell/vitest.config.ts +54 -0
|
@@ -0,0 +1,1582 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InspectionProcessTemplate
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive template representing the entire inspection process.
|
|
5
|
+
* Implements all 5 phases from the inspection-system requirements:
|
|
6
|
+
*
|
|
7
|
+
* 1. Introduction Phase: Case Info → Company Data → Participants → Field Selection
|
|
8
|
+
* 2. Content Phase: Rule Checking with ad-hoc actions (add participant, collect document, pause, SOS)
|
|
9
|
+
* 3. Preparation Phase: Findings → Decisions
|
|
10
|
+
* 4. Record Phase: Document Generation → Merchant Review → Objections
|
|
11
|
+
* 5. Closing Phase: End Time → Signatures → Complete
|
|
12
|
+
*
|
|
13
|
+
* This template composes all inspection-system atoms, molecules, and organisms
|
|
14
|
+
* to represent the full application workflow.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React, { useState } from "react";
|
|
18
|
+
import { cn } from "../../../lib/cn";
|
|
19
|
+
import { Box } from "../../../components/atoms/Box";
|
|
20
|
+
import { VStack, HStack } from "../../../components/atoms/Stack";
|
|
21
|
+
import { Typography } from "../../../components/atoms/Typography";
|
|
22
|
+
import { Button } from "../../../components/atoms/Button";
|
|
23
|
+
import { Card } from "../../../components/atoms/Card";
|
|
24
|
+
import { Badge } from "../../../components/atoms/Badge";
|
|
25
|
+
import { useEventBus } from "../../../hooks/useEventBus";
|
|
26
|
+
|
|
27
|
+
// Atoms
|
|
28
|
+
import { PhaseIndicator, InspectionPhase } from "../atoms/PhaseIndicator";
|
|
29
|
+
import { LawReferenceBadge } from "../atoms/LawReferenceBadge";
|
|
30
|
+
|
|
31
|
+
// Molecules
|
|
32
|
+
import { ProgressHeader, ProgressStep } from "../molecules/ProgressHeader";
|
|
33
|
+
import {
|
|
34
|
+
ComplianceSummary,
|
|
35
|
+
ComplianceStats,
|
|
36
|
+
} from "../molecules/ComplianceSummary";
|
|
37
|
+
import { RuleCheckItem, RuleCheckItemProps } from "../molecules/RuleCheckItem";
|
|
38
|
+
import { EntitySearch, SearchResult } from "../molecules/EntitySearch";
|
|
39
|
+
import { ParticipantList, Participant } from "../molecules/ParticipantList";
|
|
40
|
+
import { CardSelector, CardSelectorOption } from "../molecules/CardSelector";
|
|
41
|
+
import { ConditionalField } from "../molecules/ConditionalField";
|
|
42
|
+
import { RepeatableFormSection } from "../molecules/RepeatableFormSection";
|
|
43
|
+
import { PhotoAttachment, Photo } from "../molecules/PhotoAttachment";
|
|
44
|
+
import { ObjectionRecorder } from "../molecules/ObjectionRecorder";
|
|
45
|
+
import { DocumentPreview } from "../molecules/DocumentPreview";
|
|
46
|
+
import {
|
|
47
|
+
InspectionTimeline,
|
|
48
|
+
TimelineItem,
|
|
49
|
+
} from "../molecules/InspectionTimeline";
|
|
50
|
+
|
|
51
|
+
// Organisms
|
|
52
|
+
import {
|
|
53
|
+
FloatingActionMenu,
|
|
54
|
+
QuickAction,
|
|
55
|
+
} from "../organisms/FloatingActionMenu";
|
|
56
|
+
import { SignatureCapture } from "../organisms/SignatureCapture";
|
|
57
|
+
|
|
58
|
+
import {
|
|
59
|
+
ArrowLeft,
|
|
60
|
+
ArrowRight,
|
|
61
|
+
Save,
|
|
62
|
+
CheckCircle,
|
|
63
|
+
Building2,
|
|
64
|
+
Users,
|
|
65
|
+
ClipboardCheck,
|
|
66
|
+
FileText,
|
|
67
|
+
PenTool,
|
|
68
|
+
AlertTriangle,
|
|
69
|
+
FileCheck,
|
|
70
|
+
Scale,
|
|
71
|
+
Clock,
|
|
72
|
+
Briefcase,
|
|
73
|
+
Search,
|
|
74
|
+
Plus,
|
|
75
|
+
UserPlus,
|
|
76
|
+
FilePlus,
|
|
77
|
+
Camera,
|
|
78
|
+
Pause,
|
|
79
|
+
Play,
|
|
80
|
+
} from "lucide-react";
|
|
81
|
+
|
|
82
|
+
// =============================================================================
|
|
83
|
+
// Types
|
|
84
|
+
// =============================================================================
|
|
85
|
+
|
|
86
|
+
export type ProcessPhase =
|
|
87
|
+
| "introduction"
|
|
88
|
+
| "content"
|
|
89
|
+
| "preparation"
|
|
90
|
+
| "record"
|
|
91
|
+
| "closing";
|
|
92
|
+
|
|
93
|
+
export type IntroductionStep =
|
|
94
|
+
| "case-info"
|
|
95
|
+
| "company-data"
|
|
96
|
+
| "participants"
|
|
97
|
+
| "field-selection";
|
|
98
|
+
|
|
99
|
+
export type ContentStep = "rule-checking";
|
|
100
|
+
|
|
101
|
+
export type PreparationStep = "findings" | "decisions";
|
|
102
|
+
|
|
103
|
+
export type RecordStep =
|
|
104
|
+
| "document-generation"
|
|
105
|
+
| "merchant-review"
|
|
106
|
+
| "objections";
|
|
107
|
+
|
|
108
|
+
export type ClosingStep = "end-time" | "signatures" | "complete";
|
|
109
|
+
|
|
110
|
+
export type ProcessStep =
|
|
111
|
+
| IntroductionStep
|
|
112
|
+
| ContentStep
|
|
113
|
+
| PreparationStep
|
|
114
|
+
| RecordStep
|
|
115
|
+
| ClosingStep;
|
|
116
|
+
|
|
117
|
+
export interface Inspector {
|
|
118
|
+
id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
surname: string;
|
|
121
|
+
department: string;
|
|
122
|
+
badgeNumber: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface Company {
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
legalName: string;
|
|
129
|
+
registrationNumber: string;
|
|
130
|
+
taxNumber: string;
|
|
131
|
+
address: {
|
|
132
|
+
street: string;
|
|
133
|
+
city: string;
|
|
134
|
+
postalCode: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface AccompanyingPerson {
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
organization: string;
|
|
142
|
+
role: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface InspectionField {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
description: string;
|
|
149
|
+
ruleCount: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface InspectionRule {
|
|
153
|
+
id: string;
|
|
154
|
+
ruleText: string;
|
|
155
|
+
lawReference: {
|
|
156
|
+
gazetteNumber: string;
|
|
157
|
+
article: string;
|
|
158
|
+
};
|
|
159
|
+
severity: "critical" | "major" | "minor";
|
|
160
|
+
canBeSkipped: boolean;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface RuleCheck {
|
|
164
|
+
ruleId: string;
|
|
165
|
+
answer: "compliant" | "non-compliant" | "not-applicable" | null;
|
|
166
|
+
notes?: string;
|
|
167
|
+
photos: Photo[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface Finding {
|
|
171
|
+
id: string;
|
|
172
|
+
description: string;
|
|
173
|
+
severity: "critical" | "major" | "minor" | "observation";
|
|
174
|
+
relatedRuleIds: string[];
|
|
175
|
+
recommendation: string;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface Decision {
|
|
179
|
+
id: string;
|
|
180
|
+
orderText: string;
|
|
181
|
+
deadline: string;
|
|
182
|
+
relatedFindingIds: string[];
|
|
183
|
+
status: "pending" | "acknowledged" | "completed";
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface Objection {
|
|
187
|
+
id: string;
|
|
188
|
+
sectionRef: string;
|
|
189
|
+
objectionText: string;
|
|
190
|
+
response?: string;
|
|
191
|
+
status: "pending" | "resolved";
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface InspectionData {
|
|
195
|
+
id: string;
|
|
196
|
+
caseNumber: string;
|
|
197
|
+
inspector?: Inspector;
|
|
198
|
+
company?: Company;
|
|
199
|
+
participants: Participant[];
|
|
200
|
+
accompanyingPersons: AccompanyingPerson[];
|
|
201
|
+
selectedField?: InspectionField;
|
|
202
|
+
rules: InspectionRule[];
|
|
203
|
+
ruleChecks: Record<string, RuleCheck>;
|
|
204
|
+
findings: Finding[];
|
|
205
|
+
decisions: Decision[];
|
|
206
|
+
objections: Objection[];
|
|
207
|
+
collectedDocuments: Array<{
|
|
208
|
+
id: string;
|
|
209
|
+
name: string;
|
|
210
|
+
type: string;
|
|
211
|
+
fileUrl: string;
|
|
212
|
+
}>;
|
|
213
|
+
startDateTime?: string;
|
|
214
|
+
endDateTime?: string;
|
|
215
|
+
inspectorSignature?: string;
|
|
216
|
+
merchantSignature?: string;
|
|
217
|
+
currentPhase: ProcessPhase;
|
|
218
|
+
currentStep: ProcessStep;
|
|
219
|
+
timeline: TimelineItem[];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface InspectionProcessTemplateProps {
|
|
223
|
+
/** Full inspection data */
|
|
224
|
+
data: InspectionData;
|
|
225
|
+
/** Available inspectors for selection */
|
|
226
|
+
availableInspectors?: Inspector[];
|
|
227
|
+
/** Available inspection fields */
|
|
228
|
+
availableFields?: InspectionField[];
|
|
229
|
+
/** Company search results */
|
|
230
|
+
companySearchResults?: SearchResult[];
|
|
231
|
+
/** Is searching for company */
|
|
232
|
+
isSearchingCompany?: boolean;
|
|
233
|
+
/** Additional class names */
|
|
234
|
+
className?: string;
|
|
235
|
+
/** Phase change handler */
|
|
236
|
+
onPhaseChange?: (phase: ProcessPhase) => void;
|
|
237
|
+
/** Step change handler */
|
|
238
|
+
onStepChange?: (step: ProcessStep) => void;
|
|
239
|
+
/** Data update handler */
|
|
240
|
+
onDataUpdate?: (data: Partial<InspectionData>) => void;
|
|
241
|
+
/** Company search handler */
|
|
242
|
+
onCompanySearch?: (query: string) => void;
|
|
243
|
+
/** Save draft handler */
|
|
244
|
+
onSaveDraft?: () => void;
|
|
245
|
+
/** Complete handler */
|
|
246
|
+
onComplete?: () => void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// =============================================================================
|
|
250
|
+
// Phase Configuration
|
|
251
|
+
// =============================================================================
|
|
252
|
+
|
|
253
|
+
interface PhaseConfig {
|
|
254
|
+
id: ProcessPhase;
|
|
255
|
+
label: string;
|
|
256
|
+
icon: typeof Building2;
|
|
257
|
+
steps: Array<{
|
|
258
|
+
id: ProcessStep;
|
|
259
|
+
label: string;
|
|
260
|
+
documentSection?: string;
|
|
261
|
+
}>;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const phases: PhaseConfig[] = [
|
|
265
|
+
{
|
|
266
|
+
id: "introduction",
|
|
267
|
+
label: "Introduction",
|
|
268
|
+
icon: Briefcase,
|
|
269
|
+
steps: [
|
|
270
|
+
{
|
|
271
|
+
id: "case-info",
|
|
272
|
+
label: "Case Info",
|
|
273
|
+
documentSection: "1. SPLOŠNI PODATKI",
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
id: "company-data",
|
|
277
|
+
label: "Company Data",
|
|
278
|
+
documentSection: "2. PODATKI O ZAVEZANCU",
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: "participants",
|
|
282
|
+
label: "Participants",
|
|
283
|
+
documentSection: "3. PRISOTNE OSEBE",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: "field-selection",
|
|
287
|
+
label: "Field Selection",
|
|
288
|
+
documentSection: "4. PREDMET PREGLEDA",
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
id: "content",
|
|
294
|
+
label: "Inspection",
|
|
295
|
+
icon: ClipboardCheck,
|
|
296
|
+
steps: [
|
|
297
|
+
{
|
|
298
|
+
id: "rule-checking",
|
|
299
|
+
label: "Rule Checking",
|
|
300
|
+
documentSection: "5. UGOTOVITVE PRI PREGLEDU",
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
id: "preparation",
|
|
306
|
+
label: "Preparation",
|
|
307
|
+
icon: FileText,
|
|
308
|
+
steps: [
|
|
309
|
+
{ id: "findings", label: "Findings", documentSection: "6. UGOTOVITVE" },
|
|
310
|
+
{
|
|
311
|
+
id: "decisions",
|
|
312
|
+
label: "Decisions",
|
|
313
|
+
documentSection: "7. ODLOČBE IN UKREPI",
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
id: "record",
|
|
319
|
+
label: "Record",
|
|
320
|
+
icon: FileCheck,
|
|
321
|
+
steps: [
|
|
322
|
+
{ id: "document-generation", label: "Generate Document" },
|
|
323
|
+
{ id: "merchant-review", label: "Merchant Review" },
|
|
324
|
+
{
|
|
325
|
+
id: "objections",
|
|
326
|
+
label: "Objections",
|
|
327
|
+
documentSection: "9. PRIPOMBE ZAVEZANCA",
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
id: "closing",
|
|
333
|
+
label: "Closing",
|
|
334
|
+
icon: PenTool,
|
|
335
|
+
steps: [
|
|
336
|
+
{ id: "end-time", label: "End Time", documentSection: "10. ZAKLJUČEK" },
|
|
337
|
+
{ id: "signatures", label: "Signatures" },
|
|
338
|
+
{ id: "complete", label: "Complete" },
|
|
339
|
+
],
|
|
340
|
+
},
|
|
341
|
+
];
|
|
342
|
+
|
|
343
|
+
// =============================================================================
|
|
344
|
+
// Helper Functions
|
|
345
|
+
// =============================================================================
|
|
346
|
+
|
|
347
|
+
function getPhaseForStep(step: ProcessStep): ProcessPhase {
|
|
348
|
+
for (const phase of phases) {
|
|
349
|
+
if (phase.steps.some((s) => s.id === step)) {
|
|
350
|
+
return phase.id;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return "introduction";
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function getStepIndex(step: ProcessStep): number {
|
|
357
|
+
let index = 0;
|
|
358
|
+
for (const phase of phases) {
|
|
359
|
+
for (const s of phase.steps) {
|
|
360
|
+
if (s.id === step) return index;
|
|
361
|
+
index++;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return 0;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function getAllSteps(): ProcessStep[] {
|
|
368
|
+
return phases.flatMap((p) => p.steps.map((s) => s.id));
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function mapPhaseToIndicator(phase: ProcessPhase): InspectionPhase {
|
|
372
|
+
const mapping: Record<ProcessPhase, InspectionPhase> = {
|
|
373
|
+
introduction: "preparation",
|
|
374
|
+
content: "execution",
|
|
375
|
+
preparation: "documentation",
|
|
376
|
+
record: "review",
|
|
377
|
+
closing: "completed",
|
|
378
|
+
};
|
|
379
|
+
return mapping[phase];
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// =============================================================================
|
|
383
|
+
// Component
|
|
384
|
+
// =============================================================================
|
|
385
|
+
|
|
386
|
+
export const InspectionProcessTemplate: React.FC<
|
|
387
|
+
InspectionProcessTemplateProps
|
|
388
|
+
> = ({
|
|
389
|
+
data,
|
|
390
|
+
availableInspectors = [],
|
|
391
|
+
availableFields = [],
|
|
392
|
+
companySearchResults = [],
|
|
393
|
+
isSearchingCompany = false,
|
|
394
|
+
className,
|
|
395
|
+
onPhaseChange,
|
|
396
|
+
onStepChange,
|
|
397
|
+
onDataUpdate,
|
|
398
|
+
onCompanySearch,
|
|
399
|
+
onSaveDraft,
|
|
400
|
+
onComplete,
|
|
401
|
+
}) => {
|
|
402
|
+
const eventBus = useEventBus();
|
|
403
|
+
const [isPaused, setIsPaused] = useState(false);
|
|
404
|
+
|
|
405
|
+
const { currentPhase, currentStep } = data;
|
|
406
|
+
const allSteps = getAllSteps();
|
|
407
|
+
const currentStepIndex = getStepIndex(currentStep);
|
|
408
|
+
const isFirstStep = currentStepIndex === 0;
|
|
409
|
+
const isLastStep = currentStepIndex === allSteps.length - 1;
|
|
410
|
+
|
|
411
|
+
// Calculate compliance stats
|
|
412
|
+
const totalRules = data.rules.length;
|
|
413
|
+
const checkedRules = Object.keys(data.ruleChecks).length;
|
|
414
|
+
const compliant = Object.values(data.ruleChecks).filter(
|
|
415
|
+
(r) => r.answer === "compliant",
|
|
416
|
+
).length;
|
|
417
|
+
const nonCompliant = Object.values(data.ruleChecks).filter(
|
|
418
|
+
(r) => r.answer === "non-compliant",
|
|
419
|
+
).length;
|
|
420
|
+
const notChecked = totalRules - checkedRules;
|
|
421
|
+
|
|
422
|
+
const complianceStats: ComplianceStats = {
|
|
423
|
+
total: totalRules,
|
|
424
|
+
compliant,
|
|
425
|
+
nonCompliant,
|
|
426
|
+
notChecked,
|
|
427
|
+
critical: Object.values(data.ruleChecks).filter(
|
|
428
|
+
(r) =>
|
|
429
|
+
r.answer === "non-compliant" &&
|
|
430
|
+
data.rules.find((rule) => rule.id === r.ruleId)?.severity ===
|
|
431
|
+
"critical",
|
|
432
|
+
).length,
|
|
433
|
+
major: Object.values(data.ruleChecks).filter(
|
|
434
|
+
(r) =>
|
|
435
|
+
r.answer === "non-compliant" &&
|
|
436
|
+
data.rules.find((rule) => rule.id === r.ruleId)?.severity === "major",
|
|
437
|
+
).length,
|
|
438
|
+
minor: Object.values(data.ruleChecks).filter(
|
|
439
|
+
(r) =>
|
|
440
|
+
r.answer === "non-compliant" &&
|
|
441
|
+
data.rules.find((rule) => rule.id === r.ruleId)?.severity === "minor",
|
|
442
|
+
).length,
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
// Build progress steps for header
|
|
446
|
+
const progressSteps: ProgressStep[] = allSteps.map((step, index) => ({
|
|
447
|
+
id: step,
|
|
448
|
+
label:
|
|
449
|
+
phases.flatMap((p) => p.steps).find((s) => s.id === step)?.label || step,
|
|
450
|
+
completed: index < currentStepIndex,
|
|
451
|
+
current: step === currentStep,
|
|
452
|
+
}));
|
|
453
|
+
|
|
454
|
+
// Navigation handlers
|
|
455
|
+
const handlePrevious = () => {
|
|
456
|
+
if (isFirstStep) return;
|
|
457
|
+
const prevStep = allSteps[currentStepIndex - 1];
|
|
458
|
+
const prevPhase = getPhaseForStep(prevStep);
|
|
459
|
+
if (prevPhase !== currentPhase) {
|
|
460
|
+
onPhaseChange?.(prevPhase);
|
|
461
|
+
}
|
|
462
|
+
onStepChange?.(prevStep);
|
|
463
|
+
eventBus.emit("UI:STEP_BACK", { step: prevStep, phase: prevPhase });
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
const handleNext = () => {
|
|
467
|
+
if (isLastStep) {
|
|
468
|
+
onComplete?.();
|
|
469
|
+
eventBus.emit("UI:INSPECTION_COMPLETE", { inspectionId: data.id });
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
const nextStep = allSteps[currentStepIndex + 1];
|
|
473
|
+
const nextPhase = getPhaseForStep(nextStep);
|
|
474
|
+
if (nextPhase !== currentPhase) {
|
|
475
|
+
onPhaseChange?.(nextPhase);
|
|
476
|
+
}
|
|
477
|
+
onStepChange?.(nextStep);
|
|
478
|
+
eventBus.emit("UI:STEP_NEXT", { step: nextStep, phase: nextPhase });
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const handleSaveDraft = () => {
|
|
482
|
+
onSaveDraft?.();
|
|
483
|
+
eventBus.emit("UI:SAVE_DRAFT", { inspectionId: data.id, currentStep });
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
// Floating action menu actions
|
|
487
|
+
const floatingActions: QuickAction[] = [
|
|
488
|
+
{
|
|
489
|
+
id: "add-participant",
|
|
490
|
+
label: "Add Participant",
|
|
491
|
+
icon: UserPlus,
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
id: "collect-document",
|
|
495
|
+
label: "Collect Document",
|
|
496
|
+
icon: FilePlus,
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
id: "take-photo",
|
|
500
|
+
label: "Take Photo",
|
|
501
|
+
icon: Camera,
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
id: "pause",
|
|
505
|
+
label: isPaused ? "Resume" : "Pause",
|
|
506
|
+
icon: isPaused ? Play : Pause,
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
id: "sos",
|
|
510
|
+
label: "SOS Exception",
|
|
511
|
+
icon: AlertTriangle,
|
|
512
|
+
color: "text-red-600",
|
|
513
|
+
bgColor: "bg-red-100",
|
|
514
|
+
},
|
|
515
|
+
];
|
|
516
|
+
|
|
517
|
+
// ==========================================================================
|
|
518
|
+
// Step Content Renderers
|
|
519
|
+
// ==========================================================================
|
|
520
|
+
|
|
521
|
+
const renderCaseInfo = () => (
|
|
522
|
+
<VStack gap="lg" align="stretch">
|
|
523
|
+
<Typography variant="h3">Case Information</Typography>
|
|
524
|
+
<Card className="p-4">
|
|
525
|
+
<VStack gap="md" align="stretch">
|
|
526
|
+
<Box>
|
|
527
|
+
<Typography variant="small" className="text-neutral-500 mb-1">
|
|
528
|
+
Case Number
|
|
529
|
+
</Typography>
|
|
530
|
+
<Typography variant="h4">
|
|
531
|
+
{data.caseNumber || "Auto-generated"}
|
|
532
|
+
</Typography>
|
|
533
|
+
</Box>
|
|
534
|
+
|
|
535
|
+
<Box>
|
|
536
|
+
<Typography variant="small" className="text-neutral-500 mb-1">
|
|
537
|
+
Inspector
|
|
538
|
+
</Typography>
|
|
539
|
+
<EntitySearch
|
|
540
|
+
label="Select Inspector"
|
|
541
|
+
placeholder="Search inspectors..."
|
|
542
|
+
results={availableInspectors.map((i) => ({
|
|
543
|
+
id: i.id,
|
|
544
|
+
label: `${i.name} ${i.surname}`,
|
|
545
|
+
sublabel: `${i.department} - ${i.badgeNumber}`,
|
|
546
|
+
}))}
|
|
547
|
+
selectedId={data.inspector?.id}
|
|
548
|
+
onSearch={(q) =>
|
|
549
|
+
eventBus.emit("UI:SEARCH_INSPECTOR", { query: q })
|
|
550
|
+
}
|
|
551
|
+
onSelect={(result) => {
|
|
552
|
+
if (result) {
|
|
553
|
+
onDataUpdate?.({
|
|
554
|
+
inspector: availableInspectors.find(
|
|
555
|
+
(i) => i.id === result.id,
|
|
556
|
+
),
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
}}
|
|
560
|
+
allowCreate={false}
|
|
561
|
+
/>
|
|
562
|
+
</Box>
|
|
563
|
+
|
|
564
|
+
<Box>
|
|
565
|
+
<Typography variant="small" className="text-neutral-500 mb-1">
|
|
566
|
+
Start Date/Time
|
|
567
|
+
</Typography>
|
|
568
|
+
<input
|
|
569
|
+
type="datetime-local"
|
|
570
|
+
className="w-full p-2 border rounded"
|
|
571
|
+
value={data.startDateTime || ""}
|
|
572
|
+
onChange={(e) =>
|
|
573
|
+
onDataUpdate?.({ startDateTime: e.target.value })
|
|
574
|
+
}
|
|
575
|
+
/>
|
|
576
|
+
</Box>
|
|
577
|
+
|
|
578
|
+
<Box>
|
|
579
|
+
<Typography variant="small" className="text-neutral-500 mb-1">
|
|
580
|
+
Accompanying Persons
|
|
581
|
+
</Typography>
|
|
582
|
+
<RepeatableFormSection
|
|
583
|
+
sectionType="accompanying-persons"
|
|
584
|
+
title="Accompanying Persons"
|
|
585
|
+
items={data.accompanyingPersons.map((p) => ({
|
|
586
|
+
id: p.id,
|
|
587
|
+
data: p as unknown as Record<string, unknown>,
|
|
588
|
+
}))}
|
|
589
|
+
renderItem={(item) => {
|
|
590
|
+
const itemData = item.data as
|
|
591
|
+
| { name?: string; organization?: string; role?: string }
|
|
592
|
+
| undefined;
|
|
593
|
+
return (
|
|
594
|
+
<HStack gap="md" className="flex-1">
|
|
595
|
+
<Typography>{itemData?.name}</Typography>
|
|
596
|
+
<Badge variant="default">{itemData?.organization}</Badge>
|
|
597
|
+
<Typography variant="small" className="text-neutral-500">
|
|
598
|
+
{itemData?.role}
|
|
599
|
+
</Typography>
|
|
600
|
+
</HStack>
|
|
601
|
+
);
|
|
602
|
+
}}
|
|
603
|
+
renderForm={(onAdd) => (
|
|
604
|
+
<VStack gap="sm" align="stretch">
|
|
605
|
+
<input
|
|
606
|
+
type="text"
|
|
607
|
+
placeholder="Name"
|
|
608
|
+
className="p-2 border rounded"
|
|
609
|
+
id="acc-name"
|
|
610
|
+
/>
|
|
611
|
+
<input
|
|
612
|
+
type="text"
|
|
613
|
+
placeholder="Organization"
|
|
614
|
+
className="p-2 border rounded"
|
|
615
|
+
id="acc-org"
|
|
616
|
+
/>
|
|
617
|
+
<input
|
|
618
|
+
type="text"
|
|
619
|
+
placeholder="Role"
|
|
620
|
+
className="p-2 border rounded"
|
|
621
|
+
id="acc-role"
|
|
622
|
+
/>
|
|
623
|
+
<Button
|
|
624
|
+
variant="primary"
|
|
625
|
+
size="sm"
|
|
626
|
+
onClick={() => {
|
|
627
|
+
const name = (
|
|
628
|
+
document.getElementById("acc-name") as HTMLInputElement
|
|
629
|
+
)?.value;
|
|
630
|
+
const org = (
|
|
631
|
+
document.getElementById("acc-org") as HTMLInputElement
|
|
632
|
+
)?.value;
|
|
633
|
+
const role = (
|
|
634
|
+
document.getElementById("acc-role") as HTMLInputElement
|
|
635
|
+
)?.value;
|
|
636
|
+
if (name && org) {
|
|
637
|
+
onAdd({ name, organization: org, role });
|
|
638
|
+
}
|
|
639
|
+
}}
|
|
640
|
+
>
|
|
641
|
+
Add Person
|
|
642
|
+
</Button>
|
|
643
|
+
</VStack>
|
|
644
|
+
)}
|
|
645
|
+
onAdd={(person) => {
|
|
646
|
+
const p = person as Record<string, unknown> | undefined;
|
|
647
|
+
const newPerson: AccompanyingPerson = {
|
|
648
|
+
id: `acc-${Date.now()}`,
|
|
649
|
+
name: String(p?.name ?? ""),
|
|
650
|
+
organization: String(p?.organization ?? ""),
|
|
651
|
+
role: String(p?.role ?? ""),
|
|
652
|
+
};
|
|
653
|
+
onDataUpdate?.({
|
|
654
|
+
accompanyingPersons: [...data.accompanyingPersons, newPerson],
|
|
655
|
+
});
|
|
656
|
+
}}
|
|
657
|
+
onRemove={(id) => {
|
|
658
|
+
onDataUpdate?.({
|
|
659
|
+
accompanyingPersons: data.accompanyingPersons.filter(
|
|
660
|
+
(p) => p.id !== id,
|
|
661
|
+
),
|
|
662
|
+
});
|
|
663
|
+
}}
|
|
664
|
+
/>
|
|
665
|
+
</Box>
|
|
666
|
+
</VStack>
|
|
667
|
+
</Card>
|
|
668
|
+
</VStack>
|
|
669
|
+
);
|
|
670
|
+
|
|
671
|
+
const renderCompanyData = () => (
|
|
672
|
+
<VStack gap="lg" align="stretch">
|
|
673
|
+
<Typography variant="h3">Company Data</Typography>
|
|
674
|
+
<Card className="p-4">
|
|
675
|
+
<VStack gap="md" align="stretch">
|
|
676
|
+
<EntitySearch
|
|
677
|
+
label="Search Company"
|
|
678
|
+
placeholder="Search by name or registration number..."
|
|
679
|
+
results={companySearchResults}
|
|
680
|
+
isLoading={isSearchingCompany}
|
|
681
|
+
selectedId={data.company?.id}
|
|
682
|
+
onSearch={(q) => onCompanySearch?.(q)}
|
|
683
|
+
onSelect={(result) =>
|
|
684
|
+
result &&
|
|
685
|
+
eventBus.emit("UI:COMPANY_SELECTED", { companyId: result.id })
|
|
686
|
+
}
|
|
687
|
+
onCreateNew={() => eventBus.emit("UI:CREATE_NEW_COMPANY", {})}
|
|
688
|
+
allowCreate
|
|
689
|
+
createLabel="Create New Company"
|
|
690
|
+
/>
|
|
691
|
+
|
|
692
|
+
{data.company && (
|
|
693
|
+
<Card className="p-4 bg-blue-50 border-blue-200">
|
|
694
|
+
<VStack gap="sm" align="stretch">
|
|
695
|
+
<HStack justify="between">
|
|
696
|
+
<Typography variant="h4">{data.company.name}</Typography>
|
|
697
|
+
<Badge variant="primary">Selected</Badge>
|
|
698
|
+
</HStack>
|
|
699
|
+
<Typography variant="small" className="text-neutral-600">
|
|
700
|
+
Legal Name: {data.company.legalName}
|
|
701
|
+
</Typography>
|
|
702
|
+
<HStack gap="lg">
|
|
703
|
+
<Box>
|
|
704
|
+
<Typography variant="small" className="text-neutral-500">
|
|
705
|
+
Registration #
|
|
706
|
+
</Typography>
|
|
707
|
+
<Typography>{data.company.registrationNumber}</Typography>
|
|
708
|
+
</Box>
|
|
709
|
+
<Box>
|
|
710
|
+
<Typography variant="small" className="text-neutral-500">
|
|
711
|
+
Tax ID
|
|
712
|
+
</Typography>
|
|
713
|
+
<Typography>{data.company.taxNumber}</Typography>
|
|
714
|
+
</Box>
|
|
715
|
+
</HStack>
|
|
716
|
+
<Box>
|
|
717
|
+
<Typography variant="small" className="text-neutral-500">
|
|
718
|
+
Address
|
|
719
|
+
</Typography>
|
|
720
|
+
<Typography>
|
|
721
|
+
{data.company.address.street},{" "}
|
|
722
|
+
{data.company.address.postalCode}{" "}
|
|
723
|
+
{data.company.address.city}
|
|
724
|
+
</Typography>
|
|
725
|
+
</Box>
|
|
726
|
+
</VStack>
|
|
727
|
+
</Card>
|
|
728
|
+
)}
|
|
729
|
+
</VStack>
|
|
730
|
+
</Card>
|
|
731
|
+
</VStack>
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
const renderParticipants = () => (
|
|
735
|
+
<VStack gap="lg" align="stretch">
|
|
736
|
+
<Typography variant="h3">Participants</Typography>
|
|
737
|
+
<Typography variant="body" className="text-neutral-600">
|
|
738
|
+
At least one company representative must be present during the
|
|
739
|
+
inspection.
|
|
740
|
+
</Typography>
|
|
741
|
+
<Card className="p-4">
|
|
742
|
+
<ParticipantList
|
|
743
|
+
participants={data.participants}
|
|
744
|
+
onAdd={(participant) => {
|
|
745
|
+
const newParticipant: Participant = {
|
|
746
|
+
...participant,
|
|
747
|
+
id: `part-${Date.now()}`,
|
|
748
|
+
};
|
|
749
|
+
onDataUpdate?.({
|
|
750
|
+
participants: [...data.participants, newParticipant],
|
|
751
|
+
});
|
|
752
|
+
}}
|
|
753
|
+
onRemove={(id) => {
|
|
754
|
+
if (data.participants.length > 1) {
|
|
755
|
+
onDataUpdate?.({
|
|
756
|
+
participants: data.participants.filter((p) => p.id !== id),
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
}}
|
|
760
|
+
minParticipants={1}
|
|
761
|
+
/>
|
|
762
|
+
</Card>
|
|
763
|
+
{data.participants.length === 0 && (
|
|
764
|
+
<Card className="p-4 bg-yellow-50 border-yellow-200">
|
|
765
|
+
<HStack gap="sm">
|
|
766
|
+
<AlertTriangle className="h-5 w-5 text-yellow-600" />
|
|
767
|
+
<Typography className="text-yellow-700">
|
|
768
|
+
At least one participant is required to proceed (ZIN Art. 22)
|
|
769
|
+
</Typography>
|
|
770
|
+
</HStack>
|
|
771
|
+
</Card>
|
|
772
|
+
)}
|
|
773
|
+
</VStack>
|
|
774
|
+
);
|
|
775
|
+
|
|
776
|
+
const renderFieldSelection = () => (
|
|
777
|
+
<VStack gap="lg" align="stretch">
|
|
778
|
+
<Typography variant="h3">Inspection Field</Typography>
|
|
779
|
+
<Typography variant="body" className="text-neutral-600">
|
|
780
|
+
Select the type of inspection to determine which rules apply.
|
|
781
|
+
</Typography>
|
|
782
|
+
<CardSelector
|
|
783
|
+
options={availableFields.map((field) => ({
|
|
784
|
+
id: field.id,
|
|
785
|
+
title: field.name,
|
|
786
|
+
description: `${field.description} (${field.ruleCount} rules)`,
|
|
787
|
+
}))}
|
|
788
|
+
selectedId={data.selectedField?.id}
|
|
789
|
+
onChange={(id) => {
|
|
790
|
+
const field = availableFields.find((f) => f.id === id);
|
|
791
|
+
if (field) {
|
|
792
|
+
onDataUpdate?.({ selectedField: field });
|
|
793
|
+
eventBus.emit("UI:FIELD_SELECTED", { fieldId: id });
|
|
794
|
+
}
|
|
795
|
+
}}
|
|
796
|
+
/>
|
|
797
|
+
</VStack>
|
|
798
|
+
);
|
|
799
|
+
|
|
800
|
+
const renderRuleChecking = () => (
|
|
801
|
+
<VStack gap="lg" align="stretch">
|
|
802
|
+
<HStack justify="between" align="center">
|
|
803
|
+
<Typography variant="h3">Rule Checking</Typography>
|
|
804
|
+
<Badge variant="default">
|
|
805
|
+
{checkedRules} / {totalRules} checked
|
|
806
|
+
</Badge>
|
|
807
|
+
</HStack>
|
|
808
|
+
|
|
809
|
+
<ComplianceSummary stats={complianceStats} variant="full" />
|
|
810
|
+
|
|
811
|
+
<VStack gap="md" align="stretch">
|
|
812
|
+
{data.rules.map((rule) => {
|
|
813
|
+
const check = data.ruleChecks[rule.id];
|
|
814
|
+
return (
|
|
815
|
+
<RuleCheckItem
|
|
816
|
+
key={rule.id}
|
|
817
|
+
ruleId={rule.id}
|
|
818
|
+
ruleText={rule.ruleText}
|
|
819
|
+
gazetteNumber={rule.lawReference.gazetteNumber}
|
|
820
|
+
article={rule.lawReference.article}
|
|
821
|
+
severity={rule.severity}
|
|
822
|
+
answer={check?.answer || null}
|
|
823
|
+
notes={check?.notes}
|
|
824
|
+
photoCount={check?.photos?.length || 0}
|
|
825
|
+
onCheck={(answer, notes) => {
|
|
826
|
+
onDataUpdate?.({
|
|
827
|
+
ruleChecks: {
|
|
828
|
+
...data.ruleChecks,
|
|
829
|
+
[rule.id]: {
|
|
830
|
+
ruleId: rule.id,
|
|
831
|
+
answer,
|
|
832
|
+
notes,
|
|
833
|
+
photos: check?.photos || [],
|
|
834
|
+
},
|
|
835
|
+
},
|
|
836
|
+
});
|
|
837
|
+
}}
|
|
838
|
+
onAddPhoto={() =>
|
|
839
|
+
eventBus.emit("UI:ADD_RULE_PHOTO", { ruleId: rule.id })
|
|
840
|
+
}
|
|
841
|
+
/>
|
|
842
|
+
);
|
|
843
|
+
})}
|
|
844
|
+
</VStack>
|
|
845
|
+
</VStack>
|
|
846
|
+
);
|
|
847
|
+
|
|
848
|
+
const renderFindings = () => (
|
|
849
|
+
<VStack gap="lg" align="stretch">
|
|
850
|
+
<Typography variant="h3">Findings</Typography>
|
|
851
|
+
|
|
852
|
+
{/* Summary of non-compliant rules */}
|
|
853
|
+
<Card className="p-4 bg-red-50 border-red-200">
|
|
854
|
+
<VStack gap="sm" align="stretch">
|
|
855
|
+
<Typography variant="h4" className="text-red-700">
|
|
856
|
+
Non-Compliant Items ({nonCompliant})
|
|
857
|
+
</Typography>
|
|
858
|
+
{Object.entries(data.ruleChecks)
|
|
859
|
+
.filter(([, check]) => check.answer === "non-compliant")
|
|
860
|
+
.map(([ruleId, check]) => {
|
|
861
|
+
const rule = data.rules.find((r) => r.id === ruleId);
|
|
862
|
+
return (
|
|
863
|
+
<HStack key={ruleId} gap="sm" className="text-red-600">
|
|
864
|
+
<Badge
|
|
865
|
+
variant={
|
|
866
|
+
rule?.severity === "critical" ? "danger" : "warning"
|
|
867
|
+
}
|
|
868
|
+
>
|
|
869
|
+
{rule?.severity}
|
|
870
|
+
</Badge>
|
|
871
|
+
<Typography variant="small">{rule?.ruleText}</Typography>
|
|
872
|
+
</HStack>
|
|
873
|
+
);
|
|
874
|
+
})}
|
|
875
|
+
</VStack>
|
|
876
|
+
</Card>
|
|
877
|
+
|
|
878
|
+
{/* Add findings */}
|
|
879
|
+
<RepeatableFormSection
|
|
880
|
+
sectionType="findings"
|
|
881
|
+
title="Formal Findings"
|
|
882
|
+
items={data.findings.map((f) => ({
|
|
883
|
+
id: f.id,
|
|
884
|
+
data: f as unknown as Record<string, unknown>,
|
|
885
|
+
}))}
|
|
886
|
+
renderItem={(item) => {
|
|
887
|
+
const d = item.data as Record<string, unknown> | undefined;
|
|
888
|
+
return (
|
|
889
|
+
<VStack gap="sm" align="stretch" className="flex-1">
|
|
890
|
+
<HStack justify="between">
|
|
891
|
+
<Typography weight="medium">
|
|
892
|
+
{String(d?.description ?? "")}
|
|
893
|
+
</Typography>
|
|
894
|
+
<Badge
|
|
895
|
+
variant={
|
|
896
|
+
d?.severity === "critical"
|
|
897
|
+
? "danger"
|
|
898
|
+
: d?.severity === "major"
|
|
899
|
+
? "warning"
|
|
900
|
+
: "default"
|
|
901
|
+
}
|
|
902
|
+
>
|
|
903
|
+
{String(d?.severity ?? "")}
|
|
904
|
+
</Badge>
|
|
905
|
+
</HStack>
|
|
906
|
+
<Typography variant="small" className="text-neutral-500">
|
|
907
|
+
{String(d?.recommendation ?? "")}
|
|
908
|
+
</Typography>
|
|
909
|
+
</VStack>
|
|
910
|
+
);
|
|
911
|
+
}}
|
|
912
|
+
renderForm={(onAdd) => (
|
|
913
|
+
<VStack gap="sm" align="stretch">
|
|
914
|
+
<textarea
|
|
915
|
+
placeholder="Finding description..."
|
|
916
|
+
className="p-2 border rounded min-h-[80px]"
|
|
917
|
+
id="finding-desc"
|
|
918
|
+
/>
|
|
919
|
+
<select className="p-2 border rounded" id="finding-severity">
|
|
920
|
+
<option value="observation">Observation</option>
|
|
921
|
+
<option value="minor">Minor</option>
|
|
922
|
+
<option value="major">Major</option>
|
|
923
|
+
<option value="critical">Critical</option>
|
|
924
|
+
</select>
|
|
925
|
+
<textarea
|
|
926
|
+
placeholder="Recommendation..."
|
|
927
|
+
className="p-2 border rounded"
|
|
928
|
+
id="finding-rec"
|
|
929
|
+
/>
|
|
930
|
+
<Button
|
|
931
|
+
variant="primary"
|
|
932
|
+
size="sm"
|
|
933
|
+
onClick={() => {
|
|
934
|
+
const desc = (
|
|
935
|
+
document.getElementById("finding-desc") as HTMLTextAreaElement
|
|
936
|
+
)?.value;
|
|
937
|
+
const severity = (
|
|
938
|
+
document.getElementById(
|
|
939
|
+
"finding-severity",
|
|
940
|
+
) as HTMLSelectElement
|
|
941
|
+
)?.value;
|
|
942
|
+
const rec = (
|
|
943
|
+
document.getElementById("finding-rec") as HTMLTextAreaElement
|
|
944
|
+
)?.value;
|
|
945
|
+
if (desc) {
|
|
946
|
+
onAdd({ description: desc, severity, recommendation: rec });
|
|
947
|
+
}
|
|
948
|
+
}}
|
|
949
|
+
>
|
|
950
|
+
Add Finding
|
|
951
|
+
</Button>
|
|
952
|
+
</VStack>
|
|
953
|
+
)}
|
|
954
|
+
onAdd={(findingData) => {
|
|
955
|
+
const fd = findingData as Record<string, unknown> | undefined;
|
|
956
|
+
const newFinding: Finding = {
|
|
957
|
+
id: `finding-${Date.now()}`,
|
|
958
|
+
description: String(fd?.description ?? ""),
|
|
959
|
+
severity: (fd?.severity as Finding["severity"]) ?? "observation",
|
|
960
|
+
relatedRuleIds: [],
|
|
961
|
+
recommendation: String(fd?.recommendation ?? ""),
|
|
962
|
+
};
|
|
963
|
+
onDataUpdate?.({ findings: [...data.findings, newFinding] });
|
|
964
|
+
}}
|
|
965
|
+
onRemove={(id) => {
|
|
966
|
+
onDataUpdate?.({
|
|
967
|
+
findings: data.findings.filter((f) => f.id !== id),
|
|
968
|
+
});
|
|
969
|
+
}}
|
|
970
|
+
/>
|
|
971
|
+
</VStack>
|
|
972
|
+
);
|
|
973
|
+
|
|
974
|
+
const renderDecisions = () => (
|
|
975
|
+
<VStack gap="lg" align="stretch">
|
|
976
|
+
<Typography variant="h3">Decisions & Orders</Typography>
|
|
977
|
+
|
|
978
|
+
<RepeatableFormSection
|
|
979
|
+
sectionType="decisions"
|
|
980
|
+
title="Required Actions"
|
|
981
|
+
items={data.decisions.map((d) => ({
|
|
982
|
+
id: d.id,
|
|
983
|
+
data: d as unknown as Record<string, unknown>,
|
|
984
|
+
}))}
|
|
985
|
+
renderItem={(item) => {
|
|
986
|
+
const d = item.data as Record<string, unknown> | undefined;
|
|
987
|
+
return (
|
|
988
|
+
<VStack gap="sm" align="stretch" className="flex-1">
|
|
989
|
+
<Typography weight="medium">
|
|
990
|
+
{String(d?.orderText ?? "")}
|
|
991
|
+
</Typography>
|
|
992
|
+
<HStack gap="md">
|
|
993
|
+
<Badge variant="default">
|
|
994
|
+
<Clock className="h-3 w-3 mr-1" />
|
|
995
|
+
Due: {String(d?.deadline ?? "")}
|
|
996
|
+
</Badge>
|
|
997
|
+
<Badge
|
|
998
|
+
variant={
|
|
999
|
+
d?.status === "completed"
|
|
1000
|
+
? "success"
|
|
1001
|
+
: d?.status === "acknowledged"
|
|
1002
|
+
? "primary"
|
|
1003
|
+
: "warning"
|
|
1004
|
+
}
|
|
1005
|
+
>
|
|
1006
|
+
{String(d?.status ?? "")}
|
|
1007
|
+
</Badge>
|
|
1008
|
+
</HStack>
|
|
1009
|
+
</VStack>
|
|
1010
|
+
);
|
|
1011
|
+
}}
|
|
1012
|
+
renderForm={(onAdd) => (
|
|
1013
|
+
<VStack gap="sm" align="stretch">
|
|
1014
|
+
<textarea
|
|
1015
|
+
placeholder="Order/Action required..."
|
|
1016
|
+
className="p-2 border rounded min-h-[80px]"
|
|
1017
|
+
id="decision-text"
|
|
1018
|
+
/>
|
|
1019
|
+
<input
|
|
1020
|
+
type="date"
|
|
1021
|
+
className="p-2 border rounded"
|
|
1022
|
+
id="decision-deadline"
|
|
1023
|
+
/>
|
|
1024
|
+
<Button
|
|
1025
|
+
variant="primary"
|
|
1026
|
+
size="sm"
|
|
1027
|
+
onClick={() => {
|
|
1028
|
+
const text = (
|
|
1029
|
+
document.getElementById(
|
|
1030
|
+
"decision-text",
|
|
1031
|
+
) as HTMLTextAreaElement
|
|
1032
|
+
)?.value;
|
|
1033
|
+
const deadline = (
|
|
1034
|
+
document.getElementById(
|
|
1035
|
+
"decision-deadline",
|
|
1036
|
+
) as HTMLInputElement
|
|
1037
|
+
)?.value;
|
|
1038
|
+
if (text && deadline) {
|
|
1039
|
+
onAdd({ orderText: text, deadline });
|
|
1040
|
+
}
|
|
1041
|
+
}}
|
|
1042
|
+
>
|
|
1043
|
+
Add Decision
|
|
1044
|
+
</Button>
|
|
1045
|
+
</VStack>
|
|
1046
|
+
)}
|
|
1047
|
+
onAdd={(decisionData) => {
|
|
1048
|
+
const dd = decisionData as Record<string, unknown> | undefined;
|
|
1049
|
+
const newDecision: Decision = {
|
|
1050
|
+
id: `decision-${Date.now()}`,
|
|
1051
|
+
orderText: String(dd?.orderText ?? ""),
|
|
1052
|
+
deadline: String(dd?.deadline ?? ""),
|
|
1053
|
+
relatedFindingIds: [],
|
|
1054
|
+
status: "pending",
|
|
1055
|
+
};
|
|
1056
|
+
onDataUpdate?.({ decisions: [...data.decisions, newDecision] });
|
|
1057
|
+
}}
|
|
1058
|
+
onRemove={(id) => {
|
|
1059
|
+
onDataUpdate?.({
|
|
1060
|
+
decisions: data.decisions.filter((d) => d.id !== id),
|
|
1061
|
+
});
|
|
1062
|
+
}}
|
|
1063
|
+
/>
|
|
1064
|
+
</VStack>
|
|
1065
|
+
);
|
|
1066
|
+
|
|
1067
|
+
const renderDocumentGeneration = () => (
|
|
1068
|
+
<VStack gap="lg" align="stretch">
|
|
1069
|
+
<Typography variant="h3">Document Generation</Typography>
|
|
1070
|
+
<Typography variant="body" className="text-neutral-600">
|
|
1071
|
+
Review the compiled inspection document before presenting to the
|
|
1072
|
+
merchant.
|
|
1073
|
+
</Typography>
|
|
1074
|
+
|
|
1075
|
+
<DocumentPreview
|
|
1076
|
+
title="Inspection Record"
|
|
1077
|
+
subtitle={`Case #${data.caseNumber}`}
|
|
1078
|
+
previewUrl={`/api/inspections/${data.id}/preview`}
|
|
1079
|
+
downloadUrl={`/api/inspections/${data.id}/download`}
|
|
1080
|
+
onDownload={() =>
|
|
1081
|
+
eventBus.emit("UI:DOWNLOAD_DOCUMENT", { inspectionId: data.id })
|
|
1082
|
+
}
|
|
1083
|
+
onPrint={() =>
|
|
1084
|
+
eventBus.emit("UI:PRINT_DOCUMENT", { inspectionId: data.id })
|
|
1085
|
+
}
|
|
1086
|
+
/>
|
|
1087
|
+
|
|
1088
|
+
<Card className="p-4">
|
|
1089
|
+
<VStack gap="md" align="stretch">
|
|
1090
|
+
<Typography variant="h4">Document Sections</Typography>
|
|
1091
|
+
{phases.map((phase) => (
|
|
1092
|
+
<Box key={phase.id}>
|
|
1093
|
+
<Typography variant="small" className="text-neutral-500 mb-1">
|
|
1094
|
+
{phase.label}
|
|
1095
|
+
</Typography>
|
|
1096
|
+
{phase.steps
|
|
1097
|
+
.filter((s) => s.documentSection)
|
|
1098
|
+
.map((step) => (
|
|
1099
|
+
<HStack key={step.id} gap="sm" className="ml-4">
|
|
1100
|
+
<CheckCircle className="h-4 w-4 text-green-500" />
|
|
1101
|
+
<Typography variant="small">
|
|
1102
|
+
{step.documentSection}
|
|
1103
|
+
</Typography>
|
|
1104
|
+
</HStack>
|
|
1105
|
+
))}
|
|
1106
|
+
</Box>
|
|
1107
|
+
))}
|
|
1108
|
+
</VStack>
|
|
1109
|
+
</Card>
|
|
1110
|
+
</VStack>
|
|
1111
|
+
);
|
|
1112
|
+
|
|
1113
|
+
const renderMerchantReview = () => (
|
|
1114
|
+
<VStack gap="lg" align="stretch">
|
|
1115
|
+
<Typography variant="h3">Merchant Review</Typography>
|
|
1116
|
+
<Typography variant="body" className="text-neutral-600">
|
|
1117
|
+
Present the inspection document to the merchant for review.
|
|
1118
|
+
</Typography>
|
|
1119
|
+
|
|
1120
|
+
<Card className="p-4 bg-blue-50 border-blue-200">
|
|
1121
|
+
<VStack gap="sm" align="stretch">
|
|
1122
|
+
<HStack gap="sm">
|
|
1123
|
+
<Scale className="h-5 w-5 text-blue-600" />
|
|
1124
|
+
<Typography className="text-blue-700 font-medium">
|
|
1125
|
+
The merchant has the right to review all findings and raise
|
|
1126
|
+
objections.
|
|
1127
|
+
</Typography>
|
|
1128
|
+
</HStack>
|
|
1129
|
+
</VStack>
|
|
1130
|
+
</Card>
|
|
1131
|
+
|
|
1132
|
+
<DocumentPreview
|
|
1133
|
+
title="Inspection Record"
|
|
1134
|
+
subtitle="For Merchant Review"
|
|
1135
|
+
previewUrl={`/api/inspections/${data.id}/preview`}
|
|
1136
|
+
isReadOnly
|
|
1137
|
+
/>
|
|
1138
|
+
</VStack>
|
|
1139
|
+
);
|
|
1140
|
+
|
|
1141
|
+
const renderObjections = () => (
|
|
1142
|
+
<VStack gap="lg" align="stretch">
|
|
1143
|
+
<Typography variant="h3">Objections</Typography>
|
|
1144
|
+
|
|
1145
|
+
{data.objections.length === 0 ? (
|
|
1146
|
+
<Card className="p-4 bg-green-50 border-green-200">
|
|
1147
|
+
<HStack gap="sm">
|
|
1148
|
+
<CheckCircle className="h-5 w-5 text-green-600" />
|
|
1149
|
+
<Typography className="text-green-700">
|
|
1150
|
+
No objections have been raised by the merchant.
|
|
1151
|
+
</Typography>
|
|
1152
|
+
</HStack>
|
|
1153
|
+
</Card>
|
|
1154
|
+
) : (
|
|
1155
|
+
<VStack gap="md" align="stretch">
|
|
1156
|
+
{data.objections.map((objection) => (
|
|
1157
|
+
<Card key={objection.id} className="p-4">
|
|
1158
|
+
<VStack gap="sm" align="stretch">
|
|
1159
|
+
<HStack justify="between">
|
|
1160
|
+
<Badge variant="default">
|
|
1161
|
+
Section: {objection.sectionRef}
|
|
1162
|
+
</Badge>
|
|
1163
|
+
<Badge
|
|
1164
|
+
variant={
|
|
1165
|
+
objection.status === "resolved" ? "success" : "warning"
|
|
1166
|
+
}
|
|
1167
|
+
>
|
|
1168
|
+
{objection.status}
|
|
1169
|
+
</Badge>
|
|
1170
|
+
</HStack>
|
|
1171
|
+
<Typography>{objection.objectionText}</Typography>
|
|
1172
|
+
{objection.response && (
|
|
1173
|
+
<Box className="bg-neutral-50 p-2 rounded">
|
|
1174
|
+
<Typography variant="small" className="text-neutral-500">
|
|
1175
|
+
Inspector Response:
|
|
1176
|
+
</Typography>
|
|
1177
|
+
<Typography variant="small">
|
|
1178
|
+
{objection.response}
|
|
1179
|
+
</Typography>
|
|
1180
|
+
</Box>
|
|
1181
|
+
)}
|
|
1182
|
+
</VStack>
|
|
1183
|
+
</Card>
|
|
1184
|
+
))}
|
|
1185
|
+
</VStack>
|
|
1186
|
+
)}
|
|
1187
|
+
|
|
1188
|
+
<ObjectionRecorder
|
|
1189
|
+
onSubmit={(sectionRefOrObj, text) => {
|
|
1190
|
+
const sectionRef =
|
|
1191
|
+
typeof sectionRefOrObj === "string"
|
|
1192
|
+
? sectionRefOrObj
|
|
1193
|
+
: (sectionRefOrObj?.participantId ?? "");
|
|
1194
|
+
const objText =
|
|
1195
|
+
typeof sectionRefOrObj === "string"
|
|
1196
|
+
? (text ?? "")
|
|
1197
|
+
: (sectionRefOrObj?.text ?? "");
|
|
1198
|
+
const newObjection: Objection = {
|
|
1199
|
+
id: `obj-${Date.now()}`,
|
|
1200
|
+
sectionRef,
|
|
1201
|
+
objectionText: objText,
|
|
1202
|
+
status: "pending",
|
|
1203
|
+
};
|
|
1204
|
+
onDataUpdate?.({ objections: [...data.objections, newObjection] });
|
|
1205
|
+
}}
|
|
1206
|
+
/>
|
|
1207
|
+
</VStack>
|
|
1208
|
+
);
|
|
1209
|
+
|
|
1210
|
+
const renderEndTime = () => (
|
|
1211
|
+
<VStack gap="lg" align="stretch">
|
|
1212
|
+
<Typography variant="h3">Closing Information</Typography>
|
|
1213
|
+
|
|
1214
|
+
<Card className="p-4">
|
|
1215
|
+
<VStack gap="md" align="stretch">
|
|
1216
|
+
<Box>
|
|
1217
|
+
<Typography variant="small" className="text-neutral-500 mb-1">
|
|
1218
|
+
Inspection Start
|
|
1219
|
+
</Typography>
|
|
1220
|
+
<Typography>{data.startDateTime || "Not recorded"}</Typography>
|
|
1221
|
+
</Box>
|
|
1222
|
+
<Box>
|
|
1223
|
+
<Typography variant="small" className="text-neutral-500 mb-1">
|
|
1224
|
+
Inspection End
|
|
1225
|
+
</Typography>
|
|
1226
|
+
<input
|
|
1227
|
+
type="datetime-local"
|
|
1228
|
+
className="w-full p-2 border rounded"
|
|
1229
|
+
value={data.endDateTime || ""}
|
|
1230
|
+
onChange={(e) => onDataUpdate?.({ endDateTime: e.target.value })}
|
|
1231
|
+
/>
|
|
1232
|
+
</Box>
|
|
1233
|
+
</VStack>
|
|
1234
|
+
</Card>
|
|
1235
|
+
|
|
1236
|
+
<InspectionTimeline items={data.timeline} />
|
|
1237
|
+
</VStack>
|
|
1238
|
+
);
|
|
1239
|
+
|
|
1240
|
+
const renderSignatures = () => (
|
|
1241
|
+
<VStack gap="lg" align="stretch">
|
|
1242
|
+
<Typography variant="h3">Signatures</Typography>
|
|
1243
|
+
<Typography variant="body" className="text-neutral-600">
|
|
1244
|
+
Both the inspector and merchant representative must sign the inspection
|
|
1245
|
+
record.
|
|
1246
|
+
</Typography>
|
|
1247
|
+
|
|
1248
|
+
<Card className="p-4">
|
|
1249
|
+
<VStack gap="lg" align="stretch">
|
|
1250
|
+
<SignatureCapture
|
|
1251
|
+
title="Inspector Signature"
|
|
1252
|
+
subtitle={
|
|
1253
|
+
data.inspector
|
|
1254
|
+
? `${data.inspector.name} ${data.inspector.surname}`
|
|
1255
|
+
: "Inspector"
|
|
1256
|
+
}
|
|
1257
|
+
onCapture={(signatureData) => {
|
|
1258
|
+
onDataUpdate?.({ inspectorSignature: signatureData });
|
|
1259
|
+
eventBus.emit("UI:INSPECTOR_SIGNED", { inspectionId: data.id });
|
|
1260
|
+
}}
|
|
1261
|
+
/>
|
|
1262
|
+
|
|
1263
|
+
<SignatureCapture
|
|
1264
|
+
title="Merchant Signature"
|
|
1265
|
+
subtitle={
|
|
1266
|
+
data.participants[0]
|
|
1267
|
+
? `${data.participants[0].name} ${data.participants[0].surname}`
|
|
1268
|
+
: "Company Representative"
|
|
1269
|
+
}
|
|
1270
|
+
onCapture={(signatureData) => {
|
|
1271
|
+
onDataUpdate?.({ merchantSignature: signatureData });
|
|
1272
|
+
eventBus.emit("UI:MERCHANT_SIGNED", { inspectionId: data.id });
|
|
1273
|
+
}}
|
|
1274
|
+
/>
|
|
1275
|
+
</VStack>
|
|
1276
|
+
</Card>
|
|
1277
|
+
|
|
1278
|
+
{(!data.inspectorSignature || !data.merchantSignature) && (
|
|
1279
|
+
<Card className="p-4 bg-yellow-50 border-yellow-200">
|
|
1280
|
+
<HStack gap="sm">
|
|
1281
|
+
<AlertTriangle className="h-5 w-5 text-yellow-600" />
|
|
1282
|
+
<Typography className="text-yellow-700">
|
|
1283
|
+
Both signatures are required to complete the inspection (ZIN Art.
|
|
1284
|
+
28)
|
|
1285
|
+
</Typography>
|
|
1286
|
+
</HStack>
|
|
1287
|
+
</Card>
|
|
1288
|
+
)}
|
|
1289
|
+
</VStack>
|
|
1290
|
+
);
|
|
1291
|
+
|
|
1292
|
+
const renderComplete = () => (
|
|
1293
|
+
<VStack gap="lg" align="center" className="py-8">
|
|
1294
|
+
<Box className="p-4 rounded-full bg-green-100">
|
|
1295
|
+
<CheckCircle className="h-16 w-16 text-green-600" />
|
|
1296
|
+
</Box>
|
|
1297
|
+
<Typography variant="h2">Inspection Complete</Typography>
|
|
1298
|
+
<Typography
|
|
1299
|
+
variant="body"
|
|
1300
|
+
className="text-neutral-600 text-center max-w-md"
|
|
1301
|
+
>
|
|
1302
|
+
The inspection has been successfully completed. You can download the
|
|
1303
|
+
final document or archive it to the information system.
|
|
1304
|
+
</Typography>
|
|
1305
|
+
|
|
1306
|
+
<Card className="p-4 w-full max-w-md">
|
|
1307
|
+
<VStack gap="sm" align="stretch">
|
|
1308
|
+
<HStack justify="between">
|
|
1309
|
+
<Typography>Case Number</Typography>
|
|
1310
|
+
<Typography weight="medium">{data.caseNumber}</Typography>
|
|
1311
|
+
</HStack>
|
|
1312
|
+
<HStack justify="between">
|
|
1313
|
+
<Typography>Company</Typography>
|
|
1314
|
+
<Typography weight="medium">{data.company?.name}</Typography>
|
|
1315
|
+
</HStack>
|
|
1316
|
+
<HStack justify="between">
|
|
1317
|
+
<Typography>Rules Checked</Typography>
|
|
1318
|
+
<Typography weight="medium">{checkedRules}</Typography>
|
|
1319
|
+
</HStack>
|
|
1320
|
+
<HStack justify="between">
|
|
1321
|
+
<Typography>Findings</Typography>
|
|
1322
|
+
<Typography weight="medium">{data.findings.length}</Typography>
|
|
1323
|
+
</HStack>
|
|
1324
|
+
<HStack justify="between">
|
|
1325
|
+
<Typography>Decisions</Typography>
|
|
1326
|
+
<Typography weight="medium">{data.decisions.length}</Typography>
|
|
1327
|
+
</HStack>
|
|
1328
|
+
</VStack>
|
|
1329
|
+
</Card>
|
|
1330
|
+
|
|
1331
|
+
<HStack gap="md">
|
|
1332
|
+
<Button
|
|
1333
|
+
variant="default"
|
|
1334
|
+
onClick={() =>
|
|
1335
|
+
eventBus.emit("UI:DOWNLOAD_FINAL", { inspectionId: data.id })
|
|
1336
|
+
}
|
|
1337
|
+
>
|
|
1338
|
+
<FileText className="h-4 w-4 mr-2" />
|
|
1339
|
+
Download PDF
|
|
1340
|
+
</Button>
|
|
1341
|
+
<Button
|
|
1342
|
+
variant="primary"
|
|
1343
|
+
onClick={() =>
|
|
1344
|
+
eventBus.emit("UI:ARCHIVE_INSPECTION", { inspectionId: data.id })
|
|
1345
|
+
}
|
|
1346
|
+
>
|
|
1347
|
+
<CheckCircle className="h-4 w-4 mr-2" />
|
|
1348
|
+
Archive to System
|
|
1349
|
+
</Button>
|
|
1350
|
+
</HStack>
|
|
1351
|
+
</VStack>
|
|
1352
|
+
);
|
|
1353
|
+
|
|
1354
|
+
// Step content renderer
|
|
1355
|
+
const renderStepContent = () => {
|
|
1356
|
+
switch (currentStep) {
|
|
1357
|
+
case "case-info":
|
|
1358
|
+
return renderCaseInfo();
|
|
1359
|
+
case "company-data":
|
|
1360
|
+
return renderCompanyData();
|
|
1361
|
+
case "participants":
|
|
1362
|
+
return renderParticipants();
|
|
1363
|
+
case "field-selection":
|
|
1364
|
+
return renderFieldSelection();
|
|
1365
|
+
case "rule-checking":
|
|
1366
|
+
return renderRuleChecking();
|
|
1367
|
+
case "findings":
|
|
1368
|
+
return renderFindings();
|
|
1369
|
+
case "decisions":
|
|
1370
|
+
return renderDecisions();
|
|
1371
|
+
case "document-generation":
|
|
1372
|
+
return renderDocumentGeneration();
|
|
1373
|
+
case "merchant-review":
|
|
1374
|
+
return renderMerchantReview();
|
|
1375
|
+
case "objections":
|
|
1376
|
+
return renderObjections();
|
|
1377
|
+
case "end-time":
|
|
1378
|
+
return renderEndTime();
|
|
1379
|
+
case "signatures":
|
|
1380
|
+
return renderSignatures();
|
|
1381
|
+
case "complete":
|
|
1382
|
+
return renderComplete();
|
|
1383
|
+
default:
|
|
1384
|
+
return null;
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
// Can proceed check
|
|
1389
|
+
const canProceed = (): boolean => {
|
|
1390
|
+
switch (currentStep) {
|
|
1391
|
+
case "case-info":
|
|
1392
|
+
return !!data.caseNumber && !!data.inspector && !!data.startDateTime;
|
|
1393
|
+
case "company-data":
|
|
1394
|
+
return !!data.company;
|
|
1395
|
+
case "participants":
|
|
1396
|
+
return data.participants.length >= 1;
|
|
1397
|
+
case "field-selection":
|
|
1398
|
+
return !!data.selectedField;
|
|
1399
|
+
case "rule-checking":
|
|
1400
|
+
return checkedRules === totalRules;
|
|
1401
|
+
case "findings":
|
|
1402
|
+
return true; // Optional
|
|
1403
|
+
case "decisions":
|
|
1404
|
+
return true; // Optional
|
|
1405
|
+
case "document-generation":
|
|
1406
|
+
return true;
|
|
1407
|
+
case "merchant-review":
|
|
1408
|
+
return true;
|
|
1409
|
+
case "objections":
|
|
1410
|
+
return data.objections.every((o) => o.status === "resolved");
|
|
1411
|
+
case "end-time":
|
|
1412
|
+
return !!data.endDateTime;
|
|
1413
|
+
case "signatures":
|
|
1414
|
+
return !!data.inspectorSignature && !!data.merchantSignature;
|
|
1415
|
+
case "complete":
|
|
1416
|
+
return true;
|
|
1417
|
+
default:
|
|
1418
|
+
return true;
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1422
|
+
// ==========================================================================
|
|
1423
|
+
// Render
|
|
1424
|
+
// ==========================================================================
|
|
1425
|
+
|
|
1426
|
+
return (
|
|
1427
|
+
<VStack gap="none" className={cn("min-h-screen bg-neutral-50", className)}>
|
|
1428
|
+
{/* Header */}
|
|
1429
|
+
<Box className="bg-white border-b sticky top-0 z-40">
|
|
1430
|
+
<Box className="max-w-6xl mx-auto p-4">
|
|
1431
|
+
<HStack justify="between" align="center">
|
|
1432
|
+
<VStack gap="xs">
|
|
1433
|
+
<Typography variant="h3">
|
|
1434
|
+
Field Inspection - {data.caseNumber || "New"}
|
|
1435
|
+
</Typography>
|
|
1436
|
+
<Typography variant="small" className="text-neutral-500">
|
|
1437
|
+
{data.company?.name || "No company selected"}
|
|
1438
|
+
</Typography>
|
|
1439
|
+
</VStack>
|
|
1440
|
+
<PhaseIndicator phase={mapPhaseToIndicator(currentPhase)} />
|
|
1441
|
+
</HStack>
|
|
1442
|
+
</Box>
|
|
1443
|
+
</Box>
|
|
1444
|
+
|
|
1445
|
+
{/* Phase Navigation */}
|
|
1446
|
+
<Box className="bg-white border-b">
|
|
1447
|
+
<Box className="max-w-6xl mx-auto p-2">
|
|
1448
|
+
<HStack gap="none" className="overflow-x-auto">
|
|
1449
|
+
{phases.map((phase, phaseIndex) => {
|
|
1450
|
+
const phaseStepIndices = phase.steps.map((s) =>
|
|
1451
|
+
getStepIndex(s.id),
|
|
1452
|
+
);
|
|
1453
|
+
const isPhaseComplete = phaseStepIndices.every(
|
|
1454
|
+
(i) => i < currentStepIndex,
|
|
1455
|
+
);
|
|
1456
|
+
const isCurrentPhase = phase.id === currentPhase;
|
|
1457
|
+
const Icon = phase.icon;
|
|
1458
|
+
|
|
1459
|
+
return (
|
|
1460
|
+
<Box
|
|
1461
|
+
key={phase.id}
|
|
1462
|
+
className={cn(
|
|
1463
|
+
"flex-1 p-3 border-b-2 transition-all",
|
|
1464
|
+
isCurrentPhase && "border-blue-500 bg-blue-50",
|
|
1465
|
+
isPhaseComplete && !isCurrentPhase && "border-green-500",
|
|
1466
|
+
!isCurrentPhase && !isPhaseComplete && "border-transparent",
|
|
1467
|
+
)}
|
|
1468
|
+
>
|
|
1469
|
+
<HStack gap="sm" justify="center">
|
|
1470
|
+
{isPhaseComplete ? (
|
|
1471
|
+
<CheckCircle className="h-5 w-5 text-green-500" />
|
|
1472
|
+
) : (
|
|
1473
|
+
<Icon
|
|
1474
|
+
className={cn(
|
|
1475
|
+
"h-5 w-5",
|
|
1476
|
+
isCurrentPhase ? "text-blue-600" : "text-neutral-400",
|
|
1477
|
+
)}
|
|
1478
|
+
/>
|
|
1479
|
+
)}
|
|
1480
|
+
<Typography
|
|
1481
|
+
variant="small"
|
|
1482
|
+
weight={isCurrentPhase ? "semibold" : "normal"}
|
|
1483
|
+
className={cn(
|
|
1484
|
+
isCurrentPhase && "text-blue-700",
|
|
1485
|
+
isPhaseComplete && !isCurrentPhase && "text-green-700",
|
|
1486
|
+
)}
|
|
1487
|
+
>
|
|
1488
|
+
{phase.label}
|
|
1489
|
+
</Typography>
|
|
1490
|
+
</HStack>
|
|
1491
|
+
</Box>
|
|
1492
|
+
);
|
|
1493
|
+
})}
|
|
1494
|
+
</HStack>
|
|
1495
|
+
</Box>
|
|
1496
|
+
</Box>
|
|
1497
|
+
|
|
1498
|
+
{/* Step Progress */}
|
|
1499
|
+
<Box className="max-w-6xl mx-auto w-full px-4 py-4">
|
|
1500
|
+
<ProgressHeader
|
|
1501
|
+
title={phases.find((p) => p.id === currentPhase)?.label || ""}
|
|
1502
|
+
subtitle={`Step ${currentStepIndex + 1} of ${allSteps.length}`}
|
|
1503
|
+
phase={mapPhaseToIndicator(currentPhase)}
|
|
1504
|
+
steps={progressSteps.slice(
|
|
1505
|
+
getStepIndex(
|
|
1506
|
+
phases.find((p) => p.id === currentPhase)?.steps[0].id ||
|
|
1507
|
+
"case-info",
|
|
1508
|
+
),
|
|
1509
|
+
getStepIndex(
|
|
1510
|
+
phases.find((p) => p.id === currentPhase)?.steps[
|
|
1511
|
+
phases.find((p) => p.id === currentPhase)!.steps.length - 1
|
|
1512
|
+
].id || "case-info",
|
|
1513
|
+
) + 1,
|
|
1514
|
+
)}
|
|
1515
|
+
compact
|
|
1516
|
+
/>
|
|
1517
|
+
</Box>
|
|
1518
|
+
|
|
1519
|
+
{/* Main Content */}
|
|
1520
|
+
<Box className="max-w-6xl mx-auto w-full px-4 pb-24 flex-1">
|
|
1521
|
+
<Card className="p-6">{renderStepContent()}</Card>
|
|
1522
|
+
</Box>
|
|
1523
|
+
|
|
1524
|
+
{/* Footer Navigation */}
|
|
1525
|
+
<Box className="bg-white border-t fixed bottom-0 left-0 right-0 z-40">
|
|
1526
|
+
<Box className="max-w-6xl mx-auto p-4">
|
|
1527
|
+
<HStack justify="between" align="center">
|
|
1528
|
+
<Button
|
|
1529
|
+
variant="default"
|
|
1530
|
+
onClick={handlePrevious}
|
|
1531
|
+
disabled={isFirstStep}
|
|
1532
|
+
className="gap-2"
|
|
1533
|
+
>
|
|
1534
|
+
<ArrowLeft className="h-4 w-4" />
|
|
1535
|
+
Previous
|
|
1536
|
+
</Button>
|
|
1537
|
+
|
|
1538
|
+
<HStack gap="sm">
|
|
1539
|
+
<Button
|
|
1540
|
+
variant="ghost"
|
|
1541
|
+
onClick={handleSaveDraft}
|
|
1542
|
+
className="gap-2"
|
|
1543
|
+
>
|
|
1544
|
+
<Save className="h-4 w-4" />
|
|
1545
|
+
Save Draft
|
|
1546
|
+
</Button>
|
|
1547
|
+
</HStack>
|
|
1548
|
+
|
|
1549
|
+
<Button
|
|
1550
|
+
variant="primary"
|
|
1551
|
+
onClick={handleNext}
|
|
1552
|
+
disabled={!canProceed()}
|
|
1553
|
+
className="gap-2"
|
|
1554
|
+
>
|
|
1555
|
+
{isLastStep ? (
|
|
1556
|
+
<>
|
|
1557
|
+
<CheckCircle className="h-4 w-4" />
|
|
1558
|
+
Archive Inspection
|
|
1559
|
+
</>
|
|
1560
|
+
) : (
|
|
1561
|
+
<>
|
|
1562
|
+
Next
|
|
1563
|
+
<ArrowRight className="h-4 w-4" />
|
|
1564
|
+
</>
|
|
1565
|
+
)}
|
|
1566
|
+
</Button>
|
|
1567
|
+
</HStack>
|
|
1568
|
+
</Box>
|
|
1569
|
+
</Box>
|
|
1570
|
+
|
|
1571
|
+
{/* Floating Action Menu (only during content phase) */}
|
|
1572
|
+
{currentPhase === "content" && (
|
|
1573
|
+
<FloatingActionMenu
|
|
1574
|
+
actions={floatingActions}
|
|
1575
|
+
context={{ inspectionId: data.id, currentStep }}
|
|
1576
|
+
/>
|
|
1577
|
+
)}
|
|
1578
|
+
</VStack>
|
|
1579
|
+
);
|
|
1580
|
+
};
|
|
1581
|
+
|
|
1582
|
+
InspectionProcessTemplate.displayName = "InspectionProcessTemplate";
|