diff --git a/web/app/SuoritetutTutkinnot.tsx b/web/app/SuoritetutTutkinnot.tsx index c1f7e93c3d..7fff9e7725 100644 --- a/web/app/SuoritetutTutkinnot.tsx +++ b/web/app/SuoritetutTutkinnot.tsx @@ -38,100 +38,103 @@ const SuoritetutTutkinnot = () => { {mapError(response, () => ( {'Tietojen hakeminen epäonnistui'} ))} - {mapSuccess(response, (responseData: SuoritetutTutkinnotOppijaJakolinkillä) => ( - <> - - -
-

- {'Suoritetut tutkinnot'} -

- - {'Tiedot koneluettavassa muodossa'} - -
-
-

- {responseData.henkilö.etunimet}{' '} - {responseData.henkilö.sukunimi} -

+ {mapSuccess( + response, + (responseData: SuoritetutTutkinnotOppijaJakolinkillä) => ( + <> + + +
+

+ {'Suoritetut tutkinnot'} +

+ + {'Tiedot koneluettavassa muodossa'} + +
+
+

+ {responseData.henkilö.etunimet}{' '} + {responseData.henkilö.sukunimi} +

+
-
-
+
-
-

- - { - 'Tässä listataan suoritetut tutkinnot otsikkotasolla. Tarkemmat tiedot löytyvät koneluettavassa muodossa yllä olevasta linkistä' - } - -

- - {responseData.opiskeluoikeudet.map((oo, index) => ( -
-

- {oo.oppilaitos ? ( - {oo.oppilaitos.nimi} - ) : oo.koulutustoimija ? ( - {oo.koulutustoimija.nimi} - ) : ( - <> - {/* @ts-expect-error Text */} - - - )} -

{' '} - - - {oo.tyyppi.nimi} - {': '} - {oo.suoritukset.map((s, i) => ( +
+

+ + { + 'Tässä listataan suoritetut tutkinnot otsikkotasolla. Tarkemmat tiedot löytyvät koneluettavassa muodossa yllä olevasta linkistä' + } + +

+ + {responseData.opiskeluoikeudet.map((oo, index) => ( +
+

+ {oo.oppilaitos ? ( + {oo.oppilaitos.nimi} + ) : oo.koulutustoimija ? ( + {oo.koulutustoimija.nimi} + ) : ( <> - {i > 0 && ', '} - {s.koulutusmoduuli.tunniste.nimi} + {/* @ts-expect-error Text */} + - ))} - - - {isSuoritetutTutkinnotKoskeenTallennettavaOpiskeluoikeus( - oo - ) - ? `Opiskeluoikeuden oid: ${oo.oid}` - : ''} - - - {isSuoritetutTutkinnotOpiskeluoikeus(oo) - ? `Vahvistettu: ${oo.suoritukset.map( - (foo) => foo.vahvistus?.päivä - )}` - : ''} - - -

- ))} -
- {responseData.opiskeluoikeudet.length <= 0 && ( - {'Suoritettuja tutkintoja ei löytynyt'} - )} + )} + {' '} + + + {oo.tyyppi.nimi} + {': '} + {oo.suoritukset.map((s, i) => ( + <> + {i > 0 && ', '} + {s.koulutusmoduuli.tunniste.nimi} + + ))} + + + {isSuoritetutTutkinnotKoskeenTallennettavaOpiskeluoikeus( + oo + ) + ? `Opiskeluoikeuden oid: ${oo.oid}` + : ''} + + + {isSuoritetutTutkinnotOpiskeluoikeus(oo) + ? `Vahvistettu: ${oo.suoritukset.map( + (foo) => foo.vahvistus?.päivä + )}` + : ''} + + +
+ ))} + + {responseData.opiskeluoikeudet.length <= 0 && ( + {'Suoritettuja tutkintoja ei löytynyt'} + )} +
-
- - - ))} + + + ) + )} ) } diff --git a/web/app/appstate/globalErrors.tsx b/web/app/appstate/globalErrors.tsx index c43e8e5db5..ca0cd667d7 100644 --- a/web/app/appstate/globalErrors.tsx +++ b/web/app/appstate/globalErrors.tsx @@ -31,9 +31,7 @@ const GlobalErrorContext = React.createContext({ clearAll: () => {} }) -export const GlobalErrorProvider: React.FC = ( - props -) => { +export const GlobalErrorProvider: React.FC = (props) => { const [errors, setErrors] = useState([]) const push = useCallback( (errs: GlobalError[]) => { diff --git a/web/app/appstate/preferences.tsx b/web/app/appstate/preferences.tsx index 9e57ccf21e..967f52e11b 100644 --- a/web/app/appstate/preferences.tsx +++ b/web/app/appstate/preferences.tsx @@ -312,9 +312,7 @@ const initialContextValue: PreferencesContext = { const PreferencesContext = React.createContext(initialContextValue) -export const PreferencesProvider: React.FC = ( - props -) => { +export const PreferencesProvider: React.FC = (props) => { const [preferences, setPreferences] = useState< Record >({}) diff --git a/web/app/components-v2/access/KansalainenOnly.tsx b/web/app/components-v2/access/KansalainenOnly.tsx index 028aa46320..f9a4cb8dc8 100644 --- a/web/app/components-v2/access/KansalainenOnly.tsx +++ b/web/app/components-v2/access/KansalainenOnly.tsx @@ -2,9 +2,7 @@ import React from 'react' import { useKansalainenUser, useVirkailijaUser } from '../../appstate/user' import { PropsWithOnlyChildren } from '../../util/react' -export const KansalainenOnly: React.FC = ( - props -) => { +export const KansalainenOnly: React.FC = (props) => { const user = useKansalainenUser() return user ? <>{props.children} : null } diff --git a/web/app/components-v2/access/VirkailijaOnly.tsx b/web/app/components-v2/access/VirkailijaOnly.tsx index aad02dbacd..f264f0e50d 100644 --- a/web/app/components-v2/access/VirkailijaOnly.tsx +++ b/web/app/components-v2/access/VirkailijaOnly.tsx @@ -2,9 +2,7 @@ import React from 'react' import { useVirkailijaUser } from '../../appstate/user' import { PropsWithOnlyChildren } from '../../util/react' -export const VirkailijaOnly: React.FC = ( - props -) => { +export const VirkailijaOnly: React.FC = (props) => { const user = useVirkailijaUser() return user === null ? null : <>{props.children} } diff --git a/web/app/components-v2/opiskeluoikeus/KuntaField.tsx b/web/app/components-v2/opiskeluoikeus/KuntaField.tsx index b1ff60f983..72d7052aed 100644 --- a/web/app/components-v2/opiskeluoikeus/KuntaField.tsx +++ b/web/app/components-v2/opiskeluoikeus/KuntaField.tsx @@ -15,7 +15,9 @@ import { FieldEditorProps, FieldViewerProps } from '../forms/FormField' export type Kuntakoodiviite = Koodistokoodiviite<'kunta'> -export type KuntaViewProps = CommonProps> +export type KuntaViewProps = CommonProps< + FieldViewerProps +> export const KuntaView: React.FC = (props) => ( @@ -23,7 +25,9 @@ export const KuntaView: React.FC = (props) => ( ) -export type KuntaEditProps = CommonProps> +export type KuntaEditProps = CommonProps< + FieldEditorProps +> export const KuntaEdit: React.FC = (props) => { const kunnat = useKoodisto('kunta') diff --git a/web/app/components-v2/opiskeluoikeus/LaajuusField.tsx b/web/app/components-v2/opiskeluoikeus/LaajuusField.tsx index 05977fe9a3..ce0cec29e8 100644 --- a/web/app/components-v2/opiskeluoikeus/LaajuusField.tsx +++ b/web/app/components-v2/opiskeluoikeus/LaajuusField.tsx @@ -21,7 +21,9 @@ import { EmptyObject } from '../../util/objects' * --------------------------------------------------------------------- */ -export type LaajuusViewProps = CommonProps> +export type LaajuusViewProps = CommonProps< + FieldViewerProps +> export const LaajuusView = (props: LaajuusViewProps) => { return ( diff --git a/web/app/components-v2/opiskeluoikeus/OpintokokonaisuusField.tsx b/web/app/components-v2/opiskeluoikeus/OpintokokonaisuusField.tsx index d75c04d441..2589d05f14 100644 --- a/web/app/components-v2/opiskeluoikeus/OpintokokonaisuusField.tsx +++ b/web/app/components-v2/opiskeluoikeus/OpintokokonaisuusField.tsx @@ -12,7 +12,10 @@ import { OptionList, Select } from '../controls/Select' import { FieldEditorProps, FieldViewerProps } from '../forms/FormField' type OpintokokonaisuusViewProps = CommonProps< - FieldViewerProps, EmptyObject> + FieldViewerProps< + Koodistokoodiviite<'opintokokonaisuudet', string>, + EmptyObject + > > export const OpintokokonaisuusView: React.FC = ( @@ -35,7 +38,10 @@ export const OpintokokonaisuusView: React.FC = ( } type OpintokokonaisuusEditProps = CommonProps< - FieldEditorProps, EmptyObject> + FieldEditorProps< + Koodistokoodiviite<'opintokokonaisuudet', string>, + EmptyObject + > > export const OpintokokonaisuusEdit: React.FC = ( diff --git a/web/app/components-v2/opiskeluoikeus/PerusteField.tsx b/web/app/components-v2/opiskeluoikeus/PerusteField.tsx index f5af3becfa..7380f390fa 100644 --- a/web/app/components-v2/opiskeluoikeus/PerusteField.tsx +++ b/web/app/components-v2/opiskeluoikeus/PerusteField.tsx @@ -17,7 +17,9 @@ import { OptionList, Select } from '../controls/Select' import { FieldEditorProps, FieldViewerProps } from '../forms/FormField' import { Trans } from '../texts/Trans' -type PerusteViewProps = CommonProps> +type PerusteViewProps = CommonProps< + FieldViewerProps +> export const PerusteView: React.FC = (props) => { const { TreeNode, ...tree } = useTree() diff --git a/web/app/editor/EditorModel.ts b/web/app/editor/EditorModel.ts index e2b898628f..fba1d6e66a 100644 --- a/web/app/editor/EditorModel.ts +++ b/web/app/editor/EditorModel.ts @@ -149,8 +149,8 @@ const ensureModelId = ( force?: boolean ): Identified | undefined => { if (model && (force || !isIdentified(model))) { - ; (model as any).modelId = calculateModelId(model) - ; (model as any).data = null // reset modelData caching + ;(model as any).modelId = calculateModelId(model) + ;(model as any).data = null // reset modelData caching } return model as Identified } @@ -504,9 +504,9 @@ export const createOptionalEmpty = ( ): OptionalModel => isSomeOptionalModel(optModel) ? { - optional: optModel.optional, - optionalPrototype: optModel.optionalPrototype - } + optional: optModel.optional, + optionalPrototype: optModel.optionalPrototype + } : {} export const resetOptionalModel = < @@ -705,12 +705,13 @@ const modelErrors = ( } export const applyChangesAndValidate = < - M extends EditorModel & Contextualized + M extends EditorModel & + Contextualized >( modelBeforeChange: M, changes: ChangeBusAction[] ) => { - type AppliedChanges = { model: M, scopes: string[] } + type AppliedChanges = { model: M; scopes: string[] } const basePath = toPath(modelBeforeChange.path) const withAppliedChanges = changes.reduce( @@ -732,7 +733,10 @@ export const applyChangesAndValidate = < { model: modelBeforeChange, scopes: [] } satisfies AppliedChanges ) - return applyValidationScopes(validateModel(withAppliedChanges.model), withAppliedChanges.scopes) + return applyValidationScopes( + validateModel(withAppliedChanges.model), + withAppliedChanges.scopes + ) } const getValidationScope = (path: string[]): string => { @@ -746,13 +750,21 @@ const getValidationScope = (path: string[]): string => { const applyValidationScopes = < M extends EditorModel & Contextualized ->(model: M, scopes: string[]) => { - const validationScope = R.uniq([...(model.context.validationScope || []), ...scopes]) +>( + model: M, + scopes: string[] +) => { + const validationScope = R.uniq([ + ...(model.context.validationScope || []), + ...scopes + ]) const errors = model.context.validationResult if (errors) { - const inValidationScope = (path: string) => !!validationScope.find(s => path.startsWith(s)) - const validationResult = filterObjByKey(inValidationScope)(errors) + const inValidationScope = (path: string) => + !!validationScope.find((s) => path.startsWith(s)) + const validationResult = + filterObjByKey(inValidationScope)(errors) return addContext(model, { validationResult, validationScope }) } @@ -770,13 +782,13 @@ export const validateModel = < const pushError = (model: EditorModel & Contextualized, results: ModelErrorRecord) => - (error: ModelError) => { - const path = justPath(model.path) - const fullPath = path.concat(error.path || []).join('.') - results[fullPath] - ? results[fullPath].push(error) - : (results[fullPath] = [error]) - } + (error: ModelError) => { + const path = justPath(model.path) + const fullPath = path.concat(error.path || []).join('.') + results[fullPath] + ? results[fullPath].push(error) + : (results[fullPath] = [error]) + } const validateInner = ( model: EditableModel & Contextualized, @@ -874,18 +886,18 @@ const modelItemsRaw = (model?: EditorModel): EditorModel[] => const contextualizeProperty = , T extends object>(mainModel: M) => - ( - property?: ObjectModelProperty - ): ContextualizedObjectModelProperty | undefined => { - if (!property) return property - const model = contextualizeChild(mainModel, property.model, property.key)! - return R.mergeRight(property, { - model, - owner: mainModel, - editable: - property.editable === undefined ? mainModel.editable : property.editable - }) as any as ContextualizedObjectModelProperty - } + ( + property?: ObjectModelProperty + ): ContextualizedObjectModelProperty | undefined => { + if (!property) return property + const model = contextualizeChild(mainModel, property.model, property.key)! + return R.mergeRight(property, { + model, + owner: mainModel, + editable: + property.editable === undefined ? mainModel.editable : property.editable + }) as any as ContextualizedObjectModelProperty + } let arrayKeyCounter = 0 export const ensureArrayKey = (v: ListModel) => { diff --git a/web/app/omadata/OmaDataOAuth2AnnaHyvaksynta.jsx b/web/app/omadata/OmaDataOAuth2AnnaHyvaksynta.jsx index 73c5825ad1..094dd389f0 100644 --- a/web/app/omadata/OmaDataOAuth2AnnaHyvaksynta.jsx +++ b/web/app/omadata/OmaDataOAuth2AnnaHyvaksynta.jsx @@ -1,42 +1,54 @@ import React from 'baret' import Text from '../i18n/Text' import { useKoodisto } from '../appstate/koodisto' -import {t, tExists } from '../i18n/i18n' -import TextTemplate from "../i18n/TextTemplate"; +import { t, tExists } from '../i18n/i18n' +import TextTemplate from '../i18n/TextTemplate' import(/* webpackChunkName: "styles" */ '../style/main.less') -export default ({clientId, clientName, onAcceptClick, onDeclineClick, scope, durationInMin}) => { +export default ({ + clientId, + clientName, + onAcceptClick, + onDeclineClick, + scope, + durationInMin +}) => { return (
- + - + - +
- +
) } -const AcceptanceTitle = ({clientName}) => { - return (<> -
- -
-
- - {t(clientName)} - -
- ) +const AcceptanceTitle = ({ clientName }) => { + return ( + <> +
+ +
+
+ {t(clientName)} +
+ + ) } -const ScopeList = ({scope}) => { +const ScopeList = ({ scope }) => { const scopesKoodisto = useKoodisto('omadataoauth2scope') const localizedScope = (koodi) => { @@ -51,63 +63,67 @@ const ScopeList = ({scope}) => { const scopes = scope.split(' ') - return (
- + return ( +
+ {':'}
    {scopes.map((s) => (
  • {localizedScope(s)}
  • ))} -
  • - {t("omadataoauth2_suostumuksesi_paattymisajankohta")} -
  • +
  • {t('omadataoauth2_suostumuksesi_paattymisajankohta')}
) } -const AcceptanceParagraphs = ({durationInMin, clientId}) => { - return (
- -

- -

-

- - - -

+const AcceptanceParagraphs = ({ durationInMin, clientId }) => { + return ( +
+ +

+ +

+

+ + + +

- - + + -

- -

-

- - - -

-
) +

+ +

+

+ + + +

+
+ ) } const Paattymisajankohta = ({ durationInMin }) => { return (

- +

) } -const PalveluntarjoajakohtainenTeksti = ({clientId}) => { - return Array.from({length: 9}, (x, i) => { +const PalveluntarjoajakohtainenTeksti = ({ clientId }) => { + return Array.from({ length: 9 }, (x, i) => { const paragraphId = `omadataoauth2_tekstikappale_${clientId}_${i + 1}` if (tExists(paragraphId)) { return (

- +

) } else { @@ -116,38 +132,36 @@ const PalveluntarjoajakohtainenTeksti = ({clientId}) => { }) } -const LinkkiPalveluntarjoajaan = ({clientId}) => { +const LinkkiPalveluntarjoajaan = ({ clientId }) => { const linkkiId = `omadataoauth2_linkki_${clientId}` const linkkitekstiId = `omadataoauth2_linkkiteksti_${clientId}` - return (tExists(linkkiId) && tExists(linkkitekstiId)) ? ( + return tExists(linkkiId) && tExists(linkkitekstiId) ? ( <>

- +

- +

) : null } -const AcceptanceButtons = ({onAcceptClick, onDeclineClick}) => { - return (
- - -
) +const AcceptanceButtons = ({ onAcceptClick, onDeclineClick }) => { + return ( +
+ + +
+ ) } diff --git a/web/app/omadata/OmaDataOAuth2HyvaksyntaLanding.jsx b/web/app/omadata/OmaDataOAuth2HyvaksyntaLanding.jsx index 9fdb17a6f8..9a6a5975c7 100644 --- a/web/app/omadata/OmaDataOAuth2HyvaksyntaLanding.jsx +++ b/web/app/omadata/OmaDataOAuth2HyvaksyntaLanding.jsx @@ -41,17 +41,17 @@ class OmaDataOAuth2HyvaksyntaLanding extends React.Component { } parseScope() { - const urlParams= new URLSearchParams(currentLocation().queryString) + const urlParams = new URLSearchParams(currentLocation().queryString) return urlParams.get('scope') } parseError() { - const urlParams= new URLSearchParams(currentLocation().queryString) + const urlParams = new URLSearchParams(currentLocation().queryString) return urlParams.get('error') } parseErrorId() { - const urlParams= new URLSearchParams(currentLocation().queryString) + const urlParams = new URLSearchParams(currentLocation().queryString) return urlParams.get('error_id') } @@ -100,15 +100,14 @@ class OmaDataOAuth2HyvaksyntaLanding extends React.Component { ) : null - const errorPage = - this.state.error ? ( - - ) : null + const errorPage = this.state.error ? ( + + ) : null return ( diff --git a/web/app/omadata/OmaDataOAuth2UusiHyvaksynta.jsx b/web/app/omadata/OmaDataOAuth2UusiHyvaksynta.jsx index e9b73f7c59..262545dbcd 100644 --- a/web/app/omadata/OmaDataOAuth2UusiHyvaksynta.jsx +++ b/web/app/omadata/OmaDataOAuth2UusiHyvaksynta.jsx @@ -4,7 +4,7 @@ import Http from '../util/http' import Text from '../i18n/Text' import { formatFinnishDate, parseISODate } from '../date/date' import { getBirthdayFromEditorRes } from '../util/util' -import OmaDataOAuth2AnnaHyvaksynta from "./OmaDataOAuth2AnnaHyvaksynta"; +import OmaDataOAuth2AnnaHyvaksynta from './OmaDataOAuth2AnnaHyvaksynta' const editorP = Http.cachedGet('/koski/api/omattiedot/editor', { errorMapper: () => undefined diff --git a/web/app/raportit/AikajaksoRaporttiAikarajauksella.jsx b/web/app/raportit/AikajaksoRaporttiAikarajauksella.jsx index be2ec4d37d..03a63ec0a1 100644 --- a/web/app/raportit/AikajaksoRaporttiAikarajauksella.jsx +++ b/web/app/raportit/AikajaksoRaporttiAikarajauksella.jsx @@ -86,7 +86,7 @@ export const AikajaksoRaporttiAikarajauksella = ({ o && a && l && - l.valueOf() >= a.valueOf() && + l.valueOf() >= a.valueOf() && (!showKotikuntaPvmInput || kkp) && { oppilaitosOid: o.oid, alku: formatISODate(a), @@ -131,7 +131,13 @@ export const AikajaksoRaporttiAikarajauksella = ({ ]} /> - {showKotikuntaPvmInput && } + {showKotikuntaPvmInput && ( + + )} {showKotikuntaPvmInput && ( - + )} o && p && - v && + v && kkp && { oppilaitosOid: o.oid, paiva: formatISODate(p), @@ -71,7 +71,13 @@ export const VuosiluokkaRaporttiPaivalta = ({ {shortDescription} - {showKotikuntaPvmInput && } + {showKotikuntaPvmInput && ( + + )}