diff --git a/app/components/general/AddStakeholderModal/StakeholderList/StakeholderRow/index.tsx b/app/components/general/AddStakeholderModal/StakeholderList/StakeholderRow/index.tsx
index 1f77066b7a..659c0b9152 100644
--- a/app/components/general/AddStakeholderModal/StakeholderList/StakeholderRow/index.tsx
+++ b/app/components/general/AddStakeholderModal/StakeholderList/StakeholderRow/index.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback } from 'react';
+import React from 'react';
import { IoClose } from 'react-icons/io5';
import {
QuickActionButton,
@@ -7,7 +7,7 @@ import {
export interface Props {
className?: string;
- onRemove: (index: string) => void;
+ onRemove: (value: string) => void;
value: string;
displayValue?: string;
}
@@ -20,18 +20,14 @@ function StakeholderRow(props: Props) {
displayValue,
} = props;
- const handleClick = useCallback(() => {
- onRemove(value);
- }, [value, onRemove]);
-
return (
diff --git a/app/components/general/AddStakeholderModal/StakeholderList/index.tsx b/app/components/general/AddStakeholderModal/StakeholderList/index.tsx
index 603eb05382..272499ea42 100644
--- a/app/components/general/AddStakeholderModal/StakeholderList/index.tsx
+++ b/app/components/general/AddStakeholderModal/StakeholderList/index.tsx
@@ -78,7 +78,7 @@ function StakeholderList(props: Props) {
const onRowRemove = useCallback((id: string) => {
if (value) {
- onChange(value.filter((v) => v.organization !== id), name);
+ onChange(value.filter((v) => v.clientId !== id), name);
}
}, [value, name, onChange]);
diff --git a/app/views/EditAry/AssessmentRegistryForm/AdditionalDocument/FileUpload/index.tsx b/app/views/EditAry/AssessmentRegistryForm/AdditionalDocument/FileUpload/index.tsx
index 1e89cb4351..1413f36090 100644
--- a/app/views/EditAry/AssessmentRegistryForm/AdditionalDocument/FileUpload/index.tsx
+++ b/app/views/EditAry/AssessmentRegistryForm/AdditionalDocument/FileUpload/index.tsx
@@ -55,6 +55,11 @@ function FileUpload(props: Props) {
}), [handleFileRemove, uploadedList],
);
+ const handleExternalLinkChange = useCallback((newLink: string | undefined) => {
+ setExternalLink(newLink);
+ setURLError(undefined);
+ }, []);
+
const handleExternalLinkAdd = useCallback(() => {
const isUrl = isValidUrl(externalLink ?? '');
if (!isUrl) {
@@ -68,11 +73,11 @@ function FileUpload(props: Props) {
documentType: name,
externalLink,
});
- setExternalLink(undefined);
+ handleExternalLinkChange(undefined);
}, [
name,
externalLink,
- setExternalLink,
+ handleExternalLinkChange,
onSuccess,
]);
@@ -100,7 +105,7 @@ function FileUpload(props: Props) {
placeholder="External Link"
name="externalLink"
value={externalLink}
- onChange={setExternalLink}
+ onChange={handleExternalLinkChange}
error={urlError}
/>
diff --git a/app/views/EditAry/AssessmentRegistryForm/MetadataForm/styles.css b/app/views/EditAry/AssessmentRegistryForm/MetadataForm/styles.css
index 7bcfa5d54a..a34d64e8a3 100644
--- a/app/views/EditAry/AssessmentRegistryForm/MetadataForm/styles.css
+++ b/app/views/EditAry/AssessmentRegistryForm/MetadataForm/styles.css
@@ -4,7 +4,7 @@
grid-column: auto;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
gap: var(--dui-spacing-large);
- padding: var(--dui-spacing-large);
+ padding: var(--dui-spacing-medium);
overflow: auto;
.form-element {
@@ -17,12 +17,12 @@
.inputs {
display: flex;
flex-direction: column;
- gap: var(--dui-spacing-extra-small);
+ gap: var(--dui-spacing-small);
}
}
.stakeholder-form {
- grid-column: 1 /5;
+ grid-column: 1 / 5;
grid-row: 2;
}
}
diff --git a/app/views/EditAry/AssessmentRegistryForm/MethodologyForm/MethodologyAttributesInput/index.tsx b/app/views/EditAry/AssessmentRegistryForm/MethodologyForm/MethodologyAttributesInput/index.tsx
index 08dd090cdf..55fd601209 100644
--- a/app/views/EditAry/AssessmentRegistryForm/MethodologyForm/MethodologyAttributesInput/index.tsx
+++ b/app/views/EditAry/AssessmentRegistryForm/MethodologyForm/MethodologyAttributesInput/index.tsx
@@ -73,24 +73,28 @@ function MethodologyAttributesInput(props: Props) {
defaultMethodologyAttributeValue,
);
+ const disableOtherFields = value.dataCollectionTechnique === 'SECONDARY_DATA_REVIEW';
+
return (
-
}
- keySelector={enumKeySelector}
- labelSelector={enumLabelSelector}
- onChange={onAttributeChange}
- value={value.dataCollectionTechnique}
- error={error?.dataCollectionTechnique}
- disabled={disabled}
- readOnly={readOnly}
- />
+
+ }
+ keySelector={enumKeySelector}
+ labelSelector={enumLabelSelector}
+ onChange={onAttributeChange}
+ value={value.dataCollectionTechnique}
+ error={error?.dataCollectionTechnique}
+ disabled={disabled}
+ readOnly={readOnly}
+ />
+
- }
- keySelector={enumKeySelector}
- labelSelector={enumLabelSelector}
- onChange={onAttributeChange}
- value={value.proximity}
- error={error?.proximity}
- disabled={disabled}
- readOnly={readOnly}
- />
- }
- keySelector={enumKeySelector}
- labelSelector={enumLabelSelector}
- onChange={onAttributeChange}
- value={value.unitOfAnalysis}
- error={error?.unitOfAnalysis}
- disabled={disabled}
- readOnly={readOnly}
- />
- }
- keySelector={enumKeySelector}
- labelSelector={enumLabelSelector}
- onChange={onAttributeChange}
- value={value.unitOfReporting}
- error={error?.unitOfReporting}
- disabled={disabled}
- readOnly={readOnly}
- />
+
+ }
+ keySelector={enumKeySelector}
+ labelSelector={enumLabelSelector}
+ onChange={onAttributeChange}
+ value={!disableOtherFields ? value.proximity : undefined}
+ error={error?.proximity}
+ disabled={disabled || disableOtherFields}
+ readOnly={readOnly}
+ />
+
+
+ }
+ keySelector={enumKeySelector}
+ labelSelector={enumLabelSelector}
+ onChange={onAttributeChange}
+ value={!disableOtherFields ? value.unitOfAnalysis : undefined}
+ error={error?.unitOfAnalysis}
+ disabled={disabled || disableOtherFields}
+ readOnly={readOnly}
+ />
+
+
+ }
+ keySelector={enumKeySelector}
+ labelSelector={enumLabelSelector}
+ onChange={onAttributeChange}
+ value={!disableOtherFields ? value.unitOfReporting : undefined}
+ error={error?.unitOfReporting}
+ disabled={disabled || disableOtherFields}
+ readOnly={readOnly}
+ />
+
attribute.clientId,
member: (): MethodologyAttributesFormSchemaMember => ({
- fields: (): MethodologyAttributesSchemaFields => ({
- id: [defaultUndefinedType],
- clientId: [requiredCondition],
- dataCollectionTechnique: [requiredCondition],
- samplingApproach: [requiredCondition],
- samplingSize: [requiredCondition],
- proximity: [requiredCondition],
- unitOfAnalysis: [requiredCondition],
- unitOfReporting: [requiredCondition],
- }),
+ fields: (methodology): MethodologyAttributesSchemaFields => {
+ if (methodology?.dataCollectionTechnique === 'SECONDARY_DATA_REVIEW') {
+ return ({
+ id: [defaultUndefinedType],
+ clientId: [requiredCondition],
+ dataCollectionTechnique: [requiredCondition],
+ samplingApproach: [forceNullType],
+ samplingSize: [forceNullType],
+ proximity: [forceNullType],
+ unitOfAnalysis: [forceNullType],
+ unitOfReporting: [forceNullType],
+ });
+ }
+ return ({
+ id: [defaultUndefinedType],
+ clientId: [requiredCondition],
+ dataCollectionTechnique: [requiredCondition],
+ samplingApproach: [],
+ samplingSize: [],
+ proximity: [],
+ unitOfAnalysis: [],
+ unitOfReporting: [],
+ });
+ },
}),
},
executiveSummary: [],
@@ -155,13 +170,24 @@ export const schema: FormSchema = {
scoreRatings: {
keySelector: (score) => score.clientId,
member: (): ScoreRatingsFormSchemaMember => ({
- fields: (): ScoreRatingsSchemaFields => ({
- id: [defaultUndefinedType],
- clientId: [requiredCondition],
- rating: [],
- reason: [],
- scoreType: [],
- }),
+ fields: (scoreValue): ScoreRatingsSchemaFields => {
+ if (isDefined(scoreValue?.rating) || isDefined(scoreValue?.reason)) {
+ return ({
+ id: [defaultUndefinedType],
+ clientId: [requiredCondition],
+ rating: [requiredCondition],
+ reason: [requiredCondition],
+ scoreType: [],
+ });
+ }
+ return ({
+ id: [defaultUndefinedType],
+ clientId: [requiredCondition],
+ rating: [],
+ reason: [],
+ scoreType: [],
+ });
+ },
}),
},
scoreAnalyticalDensity: {