Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion apps/web/src/routes/_app/group/manage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type ManageGroupFormProps = {
initialValues: {
accessibleFormInstrumentIds: Set<string>;
accessibleInteractiveInstrumentIds: Set<string>;
accessibleSeriesInstrumentIds: Set<string>;
defaultIdentificationMethod?: SubjectIdentificationMethod;
idValidationRegex?: null | string;
minimumAge?: null | number;
Expand Down Expand Up @@ -68,6 +69,12 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
label: t('group.manage.interactive'),
options: availableInstrumentOptions.interactive,
variant: 'listbox'
},
accessibleSeriesInstrumentIds: {
kind: 'set',
label: t('group.manage.series'),
options: availableInstrumentOptions.series,
variant: 'listbox'
}
},
title: t('group.manage.accessibleInstruments')
Expand Down Expand Up @@ -190,6 +197,7 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
.object({
accessibleFormInstrumentIds: z.set(z.string()),
accessibleInteractiveInstrumentIds: z.set(z.string()),
accessibleSeriesInstrumentIds: z.set(z.string()),
defaultIdentificationMethod: $SubjectIdentificationMethod.optional(),
idValidationRegex: $RegexString.optional(),
idValidationRegexErrorMessageEn: z.string().optional(),
Expand All @@ -214,7 +222,11 @@ const ManageGroupForm = ({ data, onSubmit, readOnly }: ManageGroupFormProps) =>
})}
onSubmit={(data) => {
void onSubmit({
accessibleInstrumentIds: [...data.accessibleFormInstrumentIds, ...data.accessibleInteractiveInstrumentIds],
accessibleInstrumentIds: [
...data.accessibleFormInstrumentIds,
...data.accessibleInteractiveInstrumentIds,
...data.accessibleSeriesInstrumentIds
],
settings: {
defaultIdentificationMethod: data.defaultIdentificationMethod,
idValidationRegex: data.idValidationRegex,
Expand Down Expand Up @@ -258,6 +270,7 @@ const RouteComponent = () => {
const initialValues = {
accessibleFormInstrumentIds: new Set<string>(),
accessibleInteractiveInstrumentIds: new Set<string>(),
accessibleSeriesInstrumentIds: new Set<string>(),
defaultIdentificationMethod,
idValidationRegex: settings?.idValidationRegex,
idValidationRegexErrorMessageEn: settings?.idValidationRegexErrorMessage?.en,
Expand All @@ -277,6 +290,11 @@ const RouteComponent = () => {
if (accessibleInstrumentIds?.includes(instrument.id)) {
initialValues.accessibleInteractiveInstrumentIds.add(instrument.id);
}
} else if (instrument.kind === 'SERIES') {
availableInstrumentOptions.series[instrument.id] = instrument.details.title;
if (accessibleInstrumentIds?.includes(instrument.id)) {
initialValues.accessibleSeriesInstrumentIds.add(instrument.id);
}
}
}
return { availableInstrumentOptions, initialValues };
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/translations/group.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"en": "Interactive Tasks",
"fr": "Tâches interactives"
},
"series": {
"en": "Series",
"fr": "Séries"
},
"pageTitle": {
"en": "Manage Group",
"fr": "Gestion du groupe"
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opendatacapture",
"type": "module",
"version": "1.13.4",
"version": "1.13.5",
"private": true,
"packageManager": "pnpm@10.7.0",
"license": "Apache-2.0",
Expand Down Expand Up @@ -85,13 +85,18 @@
"@prisma/engines",
"@swc/core",
"@tailwindcss/oxide",
"cypress",
"esbuild",
"mongodb-memory-server",
"msgpackr-extract",
"msw",
"oxc-resolver",
"prisma",
"sharp"
"sharp",
"sqlite3"
],
"ignoredBuiltDependencies": [
"@scarf/scarf"
]
},
"__isODCRepo": true
Expand Down
Loading