diff --git a/src/packages/modules-classifications/correspondences/association/general-fields.tsx b/src/packages/modules-classifications/correspondences/association/general-fields.tsx index 2c320d499..857465949 100644 --- a/src/packages/modules-classifications/correspondences/association/general-fields.tsx +++ b/src/packages/modules-classifications/correspondences/association/general-fields.tsx @@ -1,11 +1,47 @@ import { Link } from 'react-router-dom'; import D from '../../../deprecated-locales'; +const mapping = { + sourceItemLabelLg1: D.sourceItemTitle, + targetItemLabelLg1: D.targetItemTitle, +}; + +type SourceItemLabelTypes = { + label: string; + classId: string; + itemId: string; + itemLabelLg1: string; + itemLabelLg2: string; + secondLang: boolean; + classAltLabelLg1: string; + classAltLabelLg2: string; +}; +const SourceItemLabel = ({ + label, + classId, + itemId, + itemLabelLg1, + itemLabelLg2, + secondLang, + classAltLabelLg1, + classAltLabelLg2, +}: Readonly) => { + return ( +
  • + {label} :{' '} + + {`${itemId} - `} + {!secondLang ? itemLabelLg1 : itemLabelLg2} + + + {!secondLang + ? classAltLabelLg1 && ` (${classAltLabelLg1})` + : classAltLabelLg2 && ` (${classAltLabelLg2})`} + +
  • + ); +}; export const generalFields = (association: any, secondLang: boolean) => { - const mapping = { - sourceItemLabelLg1: D.sourceItemTitle, - targetItemLabelLg1: D.targetItemTitle, - }; const { sourceClassId, targetClassId, @@ -23,40 +59,36 @@ export const generalFields = (association: any, secondLang: boolean) => { const content = Object.keys(mapping).map((fieldName) => { if (fieldName === 'sourceItemLabelLg1' && association[fieldName]) { return ( -
  • - {mapping[fieldName]} :{' '} - - {`${sourceItemId} - `} - {!secondLang ? sourceItemLabelLg1 : sourceItemLabelLg2} - - - {!secondLang - ? sourceClassAltLabelLg1 && ` (${sourceClassAltLabelLg1})` - : sourceClassAltLabelLg2 && ` (${sourceClassAltLabelLg2})`} - -
  • + ); } if (fieldName === 'targetItemLabelLg1' && association[fieldName]) { return ( -
  • - {mapping[fieldName]} :{' '} - - {`${targetItemId} - `} - {!secondLang ? targetItemLabelLg1 : targetItemLabelLg2} - - - {!secondLang - ? targetClassAltLabelLg1 && ` (${targetClassAltLabelLg1})` - : targetClassAltLabelLg2 && ` (${targetClassAltLabelLg2})`} - -
  • + ); - } else return null; + } + + return null; }); return
      {content}
    ; diff --git a/src/packages/redux/actions/classifications/level/general.ts b/src/packages/redux/actions/classifications/level/general.ts index ca3644e0d..ae288307d 100644 --- a/src/packages/redux/actions/classifications/level/general.ts +++ b/src/packages/redux/actions/classifications/level/general.ts @@ -1,8 +1,9 @@ +import { Dispatch } from 'redux'; import * as A from '../../../../redux/actions/constants'; import { ClassificationsApi } from '../../../../sdk/classification'; const fetchClassificationLevelGeneral = - (classificationId: string, levelId: string) => (dispatch: any) => { + (classificationId: string, levelId: string) => (dispatch: Dispatch) => { dispatch({ type: A.LOAD_CLASSIFICATION_LEVEL_GENERAL, payload: { diff --git a/src/packages/redux/actions/operations/utils/index.ts b/src/packages/redux/actions/operations/utils/index.ts index efdfcdd12..169f1a4bb 100644 --- a/src/packages/redux/actions/operations/utils/index.ts +++ b/src/packages/redux/actions/operations/utils/index.ts @@ -1,8 +1,9 @@ +import { Dispatch } from 'redux'; import { sortArrayByLabel } from '../../../../utils/array-utils'; const call = (remoteCall: any, LOADING: any, SUCCESS: any, FAILURE: any) => - (dispatch: any) => { + (dispatch: Dispatch) => { dispatch({ type: LOADING, payload: {}, @@ -37,7 +38,7 @@ export const getPublishFactory = ( FAILURE: any, ) => { return (object: any, callback = () => {}) => - (dispatch: any) => { + (dispatch: Dispatch) => { dispatch({ type: LOADING, payload: {}, @@ -65,7 +66,7 @@ export const getPublishFactory = ( export const getItemFactory = (remoteCall: any, LOADING: any, SUCCESS: any, FAILURE: any) => (id: string) => - (dispatch: any, getState: any) => { + (dispatch: Dispatch, getState: any) => { if (getState().operationsOperationCurrentStatus === LOADING) { return; } diff --git a/src/packages/redux/geographies.action.ts b/src/packages/redux/geographies.action.ts index 1c34fa6d6..a19b2b469 100644 --- a/src/packages/redux/geographies.action.ts +++ b/src/packages/redux/geographies.action.ts @@ -2,6 +2,7 @@ import { GeographieApi } from '../sdk/geographie'; import { ERROR, LOADED, LOADING } from '../sdk/constants'; import { ReduxModel } from './model'; import { createAllDictionary } from '../utils/dictionnary'; +import { Dispatch } from 'redux'; // Constants const LOAD_GEOGRAPHIES = 'LOAD_GEOGRAPHIES'; @@ -69,7 +70,7 @@ export const reducer = ( }; // loader -export const loadGeographies = () => (dispatch: any) => { +export const loadGeographies = () => (dispatch: Dispatch) => { dispatch(loadGeographiesPending()); return GeographieApi.getAll().then( (results) => { diff --git a/src/packages/redux/operations/metadatastructure/list.ts b/src/packages/redux/operations/metadatastructure/list.ts index ef2c8b302..8b69fa856 100644 --- a/src/packages/redux/operations/metadatastructure/list.ts +++ b/src/packages/redux/operations/metadatastructure/list.ts @@ -1,3 +1,4 @@ +import { Dispatch } from 'redux'; import { getTree } from '../../../modules-operations/utils/msd'; import { OperationsApi } from '../../../sdk/operations-api'; import { loadCodesList } from '../../actions/operations/utils/setup'; @@ -9,7 +10,7 @@ export const LOAD_OPERATIONS_METADATASTRUCTURE_LIST_SUCCESS = export const LOAD_OPERATIONS_METADATASTRUCTURE_LIST_FAILURE = 'LOAD_OPERATIONS_METADATASTRUCTURE_LIST_FAILURE'; -const fetchMsd = () => (dispatch: any, getState: any) => { +const fetchMsd = () => (dispatch: Dispatch, getState: any) => { dispatch({ type: LOAD_OPERATIONS_METADATASTRUCTURE_LIST, payload: {},