diff --git a/src/assets/surveyData/edtNomenclatures/index.ts b/src/assets/surveyData/edtNomenclatures/index.ts new file mode 100644 index 00000000..6cac9f59 --- /dev/null +++ b/src/assets/surveyData/edtNomenclatures/index.ts @@ -0,0 +1,11 @@ +export { default as edtActivityAutoComplete } from "./edtActivityAutoComplete.json"; +export { default as edtActivityCategory } from "./edtActivityCategory.json"; +export { default as edtActivityGoal } from "./edtActivityGoal.json"; +export { default as edtActivitySecondaryActivity } from "./edtActivitySecondaryActivity.json"; +export { default as edtKindOfDay } from "./edtKindOfDay.json"; +export { default as edtKindOfWeek } from "./edtKindOfWeek.json"; +export { default as edtMeanOfTransport } from "./edtMeanOfTransport.json"; +export { default as edtPlace } from "./edtPlace.json"; +export { default as edtRoute } from "./edtRoute.json"; +export { default as edtRouteSecondaryActivity } from "./edtRouteSecondaryActivity.json"; +export { default as edtWorkingPlace } from "./edtWorkingPlace.json"; diff --git a/src/assets/surveyData/index.ts b/src/assets/surveyData/index.ts index d33492af..a12bf61e 100644 --- a/src/assets/surveyData/index.ts +++ b/src/assets/surveyData/index.ts @@ -1,14 +1,2 @@ export { default as edtActivitySurvey } from "./edtActivitySurvey.json"; export { default as edtWorkTimeSurvey } from "./edtWorkTimeSurvey.json"; - -export { default as edtActivityAutoComplete } from "./edtNomenclatures/edtActivityAutoComplete.json"; -export { default as edtActivityCategory } from "./edtNomenclatures/edtActivityCategory.json"; -export { default as edtActivityGoal } from "./edtNomenclatures/edtActivityGoal.json"; -export { default as edtActivitySecondaryActivity } from "./edtNomenclatures/edtActivitySecondaryActivity.json"; -export { default as edtKindOfDay } from "./edtNomenclatures/edtKindOfDay.json"; -export { default as edtKindOfWeek } from "./edtNomenclatures/edtKindOfWeek.json"; -export { default as edtMeanOfTransport } from "./edtNomenclatures/edtMeanOfTransport.json"; -export { default as edtPlace } from "./edtNomenclatures/edtPlace.json"; -export { default as edtRoute } from "./edtNomenclatures/edtRoute.json"; -export { default as edtRouteSecondaryActivity } from "./edtNomenclatures/edtRouteSecondaryActivity.json"; -export { default as edtWorkingPlace } from "./edtNomenclatures/edtWorkingPlace.json"; diff --git a/src/components/commons/LoopSurveyPage/LoopSurveyPageStep/LoopSurveyPageStep.tsx b/src/components/commons/LoopSurveyPage/LoopSurveyPageStep/LoopSurveyPageStep.tsx index 034a0abf..3ccc4c80 100644 --- a/src/components/commons/LoopSurveyPage/LoopSurveyPageStep/LoopSurveyPageStep.tsx +++ b/src/components/commons/LoopSurveyPage/LoopSurveyPageStep/LoopSurveyPageStep.tsx @@ -53,6 +53,7 @@ const LoopSurveyPageStep = (props: LoopSurveyPageStepProps) => { const currentIteration = paramIteration ? +paramIteration : 0; const isRoute = getValue(idSurvey, FieldNameEnum.ISROUTE, currentIteration) as boolean; const stepData = getStepData(currentPage, isRoute); + console.log("stepData", stepData); const modifiable = !surveyReadOnly(context.rightsSurvey); const IconError = errorIcon as React.FunctionComponent>; @@ -112,7 +113,7 @@ const LoopSurveyPageStep = (props: LoopSurveyPageStepProps) => { modifiable: modifiable, idSurvey: idSurvey, }; - + console.log("Context", context); const loopSurveyPageProps = { onNext: useCallback((e: React.MouseEvent) => onNext(e, setNextClickEvent), [nextClickEvent]), onPrevious: useCallback( diff --git a/src/orchestrator/Orchestrator.tsx b/src/orchestrator/Orchestrator.tsx index 8739f6ac..c8b41d7e 100644 --- a/src/orchestrator/Orchestrator.tsx +++ b/src/orchestrator/Orchestrator.tsx @@ -345,6 +345,18 @@ export const OrchestratorForStories = (props: OrchestratorProps) => { {components.map(function (component: any) { const { id, componentType, response, options, value, ...other } = component; const Component = lunatic[componentType]; + console.log("response", response); + console.log( + "variables", + getVariables( + data, + getDataLocal(), + iteration, + getBindingDependencies(components), + value, + source, + ), + ); return (
{ backClickEvent: backClickEvent, nextClickEvent: nextClickEvent, backClickCallback: () => { - saveAndLoopNavigateLocally( + saveAndLoopNavigate( idSurvey, context.source, getPreviousLoopPage(currentPage), @@ -129,9 +130,10 @@ const MainActivityPage = () => { }, nextClickCallback: (routeToGoal: boolean) => { const codeActivity = getValueOfActivity(callbackHolder.getData(), currentIteration) ?? ""; + console.log("codeActivity", codeActivity); const skip = filtrePage(EdtRoutesNameEnum.MAIN_ACTIVITY_GOAL, codeActivity); if (routeToGoal && !skip) { - saveAndLoopNavigateLocally( + saveAndLoopNavigate( idSurvey, context.source, EdtRoutesNameEnum.MAIN_ACTIVITY_GOAL, @@ -140,7 +142,7 @@ const MainActivityPage = () => { ); } else { const skip = filtrePage(EdtRoutesNameEnum.SECONDARY_ACTIVITY, codeActivity); - saveAndLoopNavigateLocally( + saveAndLoopNavigate( idSurvey, context.source, skip ? EdtRoutesNameEnum.ACTIVITY_LOCATION : getNextLoopPage(currentPage), diff --git a/src/pages/activity/activity-or-route-planner/secondary-activity-selection/SecondaryActivitySelection.tsx b/src/pages/activity/activity-or-route-planner/secondary-activity-selection/SecondaryActivitySelection.tsx index 2be69ac3..c1ba7235 100644 --- a/src/pages/activity/activity-or-route-planner/secondary-activity-selection/SecondaryActivitySelection.tsx +++ b/src/pages/activity/activity-or-route-planner/secondary-activity-selection/SecondaryActivitySelection.tsx @@ -36,8 +36,11 @@ const SecondaryActivitySelectionPage = () => { const paramIteration = useParams().iteration; const currentIteration = paramIteration ? +paramIteration : 0; const isRoute = getValue(idSurvey, FieldNameEnum.ISROUTE, currentIteration) as boolean; + console.log("isRoute", isRoute); const referentiel = isRoute ? getRouteSecondaryActivityRef() : getActivitySecondaryActivityRef(); + console.log("referentiel", referentiel); const newActivities = getNewSecondaryActivities(idSurvey, referentiel); + console.log("newActivities", newActivities); const modifiable = !surveyReadOnly(context.rightsSurvey); const iconAddAlt = t("accessibility.asset.mui-icon.add"); diff --git a/src/pages/activity/activity-or-route-planner/with-screen/WithScreen.tsx b/src/pages/activity/activity-or-route-planner/with-screen/WithScreen.tsx index 7a06cb2b..93f26107 100644 --- a/src/pages/activity/activity-or-route-planner/with-screen/WithScreen.tsx +++ b/src/pages/activity/activity-or-route-planner/with-screen/WithScreen.tsx @@ -77,6 +77,10 @@ const WithScreenPage = () => { getOrchestratorPage(EdtRoutesNameEnum.ACTIVITY_OR_ROUTE_PLANNER), context.source, ), + undefined, + undefined, + undefined, + true, ); }, onSelectValue: () => { @@ -92,12 +96,17 @@ const WithScreenPage = () => { getOrchestratorPage(EdtRoutesNameEnum.ACTIVITY_OR_ROUTE_PLANNER), context.source, ), + undefined, + undefined, + undefined, + true, ); }); }, labels: getLabels("with-screen-selecter"), errorIcon: , }; + console.log("Final data with screen : ", context.data); return ( onNext(e, setNextClickEvent), [nextClickEvent])} diff --git a/src/service/api-service/getLocalSurveyData.ts b/src/service/api-service/getLocalSurveyData.ts index 14a79800..b35e5dd4 100644 --- a/src/service/api-service/getLocalSurveyData.ts +++ b/src/service/api-service/getLocalSurveyData.ts @@ -12,9 +12,10 @@ import { edtPlace, edtRoute, edtRouteSecondaryActivity, -} from "assets/surveyData"; +} from "assets/surveyData/edtNomenclatures"; const fetchReferentiel = (auth: AuthContextProps, idReferentiel: ReferentielsEnum) => { + console.log("fetchReferentiel", { data: idReferentiel }); return Promise.resolve({ data: idReferentiel }); }; diff --git a/src/service/navigation-service.ts b/src/service/navigation-service.ts index 75b986fc..2f5400f8 100644 --- a/src/service/navigation-service.ts +++ b/src/service/navigation-service.ts @@ -30,6 +30,7 @@ import { } from "service/survey-service"; import { getLastPageStep } from "./stepper.service"; import { surveyReadOnly } from "./survey-activity-service"; +import { get } from "lodash"; let _context: OrchestratorContext; let _navigate: NavigateFunction; @@ -208,6 +209,7 @@ const saveAndNav = ( currentIteration?: number, forceUpdate?: boolean, ): void => { + forceUpdate ?? console.log("saveAndNav", getData(idSurvey)); saveData(idSurvey, getData(idSurvey), forceUpdate).then(() => { navToRouteOrRouteNotSelection(idSurvey, route, value, routeNotSelection, currentIteration); }); diff --git a/src/service/survey-service.ts b/src/service/survey-service.ts index 979ff8f1..f0c6029d 100644 --- a/src/service/survey-service.ts +++ b/src/service/survey-service.ts @@ -169,6 +169,7 @@ const initializeRefs = () => { return lunaticDatabase.get(REFERENTIELS_ID).then(refData => { if (!refData && navigator.onLine) { return fetchReferentiels().then(refs => { + console.log("refs", refs); return saveReferentiels(refs); }); } else { @@ -1092,6 +1093,7 @@ const getSurveyStateData = (data: LunaticData, idSurvey: string): StateData => { const saveReferentiels = (data: ReferentielData): Promise => { return lunaticDatabase.save(REFERENTIELS_ID, data).then(() => { referentielsData = data; + console.log("saveReferentiels", referentielsData); return data; }); }; @@ -1156,6 +1158,7 @@ const getNewSecondaryActivities = (idSurvey: string, referentiel: CheckboxOneCus let listSecondaryActivities = referentiel; listSecondaryActivitiesIds?.forEach((id: string, index: number) => { + console.log("id", id); const existActivity = referentiel.find(ref => ref.value == id) != null; if (validate(id) && !existActivity) { const newActivity = {