Skip to content

Commit

Permalink
Create importDetails model
Browse files Browse the repository at this point in the history
  • Loading branch information
EmanueleValentini1 committed Feb 6, 2025
1 parent b3d3ba1 commit 073d0c4
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 42 deletions.
7 changes: 0 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ import { Overlay } from './components/Overlay';
import { useStore } from './store/GlobalStore';
import ImportFlow from './routes/ImportFlowPage';

console.log('PageRoutesConf:', PageRoutesConf);
console.log('IMPORT:', PageRoutesConf.IMPORT);
console.log('IMPORT children:', PageRoutesConf.IMPORT?.children);
console.log('IMPORT_FLOWS path:', PageRoutesConf.IMPORT?.children?.FLOWS?.path);



const router = createBrowserRouter([
{
element: <ApiClient client={utils.apiClient} />,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ImportFlowPage/ImportFlowPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useTranslation } from 'react-i18next';
import { AltRoute, ArrowBack } from '@mui/icons-material';
import { useState } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
import { importFlowConfig } from '../../routes/routes';
import TitleComponent from '../TitleComponent/TitleComponent';
import { importFlowConfig } from '../../models/ImportDetails';

const ImportFlow = () => {

Expand Down
35 changes: 35 additions & 0 deletions src/models/ImportDetails.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { PageRoutes } from '../routes/routes';

interface ImportFlowDetail {
title: string,
fileExtensionsAllowed: string[],
backRoute: string,
successRoute: string,
requiredFieldDescription?: string,
flowTypes?: string[]
}

type ImportFlowDetails = Record<string, ImportFlowDetail>

export const importFlowConfig: ImportFlowDetails = {
'telematic-receipt': {
title: 'commons.routes.TELEMATIC_RECEIPT_IMPORT_FLOW',
fileExtensionsAllowed: ['zip'],
backRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_OVERVIEW,
successRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_FLOW_THANK_YOU_PAGE
},
'reporting': {
title: 'commons.routes.REPORTING_IMPORT_FLOW',
fileExtensionsAllowed: ['zip'],
backRoute: PageRoutes.REPORTING_IMPORT_OVERVIEW,
successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE
},
'treasury': {
title: 'commons.routes.TREASURY_IMPORT_FLOW',
fileExtensionsAllowed: ['zip'],
backRoute: PageRoutes.TREASURY,
successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE,
requiredFieldDescription: 'commons.requiredFieldDescription',
flowTypes: ['Giornale di Cassa XLS', 'Giornale di Cassa CSV', 'Giornale di Cassa OPI', 'Estrato conto poste']
}
};
34 changes: 0 additions & 34 deletions src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,37 +64,3 @@ export const generateFlatRoutes = (routes: PageRoutes = PageRoutesConf): Record<
};

export const PageRoutes = generateFlatRoutes();

interface ImportFlowDetail {
title: string,
fileExtensionsAllowed: string[],
backRoute: string,
successRoute: string,
requiredFieldDescription?: string,
flowTypes?: string[]
}

type ImportFlowDetails = Record<string, ImportFlowDetail>

export const importFlowConfig: ImportFlowDetails = {
'telematic-receipt': {
title: 'commons.routes.TELEMATIC_RECEIPT_IMPORT_FLOW',
fileExtensionsAllowed: ['zip'],
backRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_OVERVIEW,
successRoute: PageRoutes.TELEMATIC_RECEIPT_IMPORT_FLOW_THANK_YOU_PAGE
},
'reporting': {
title: 'commons.routes.REPORTING_IMPORT_FLOW',
fileExtensionsAllowed: ['zip'],
backRoute: PageRoutes.REPORTING_IMPORT_OVERVIEW,
successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE
},
'treasury': {
title: 'commons.routes.TREASURY_IMPORT_FLOW',
fileExtensionsAllowed: ['zip'],
backRoute: PageRoutes.TREASURY,
successRoute: PageRoutes.REPORTING_IMPORT_FLOW_THANK_YOU_PAGE,
requiredFieldDescription: 'commons.requiredFieldDescription',
flowTypes: ['Giornale di Cassa XLS', 'Giornale di Cassa CSV', 'Giornale di Cassa OPI', 'Estrato conto poste']
}
};

0 comments on commit 073d0c4

Please sign in to comment.