From f41106955d6bbd321b147074daa31a85c764186f Mon Sep 17 00:00:00 2001 From: Caroline D <108160931+CarolineDenis@users.noreply.github.com> Date: Wed, 16 Oct 2024 13:39:48 -0700 Subject: [PATCH] Set cojo on parent --- .../lib/components/DataModel/businessRuleDefs.ts | 1 - .../js_src/lib/components/FormCells/COJODialog.tsx | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts b/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts index 328c12df255..48b74ae9bdc 100644 --- a/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts +++ b/specifyweb/frontend/js_src/lib/components/DataModel/businessRuleDefs.ts @@ -193,7 +193,6 @@ export const businessRuleDefs: MappedBusinessRuleDefs = { }, }, }, - Determination: { fieldChecks: { taxon: async ( diff --git a/specifyweb/frontend/js_src/lib/components/FormCells/COJODialog.tsx b/specifyweb/frontend/js_src/lib/components/FormCells/COJODialog.tsx index bafb579c068..aa85785b9ae 100644 --- a/specifyweb/frontend/js_src/lib/components/FormCells/COJODialog.tsx +++ b/specifyweb/frontend/js_src/lib/components/FormCells/COJODialog.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { useBooleanState } from '../../hooks/useBooleanState'; import { commonText } from '../../localization/common'; import { formsText } from '../../localization/forms'; +import type { RA } from '../../utils/types'; import { localized } from '../../utils/types'; import { DataEntry } from '../Atoms/DataEntry'; import type { AnySchema } from '../DataModel/helperTypes'; @@ -12,6 +13,7 @@ import { tables } from '../DataModel/tables'; import type { CollectionObject, CollectionObjectGroup, + CollectionObjectGroupJoin, } from '../DataModel/types'; import { ResourceView } from '../Forms/ResourceView'; import { Dialog } from '../Molecules/Dialog'; @@ -80,6 +82,14 @@ export function COJODialog({ newCOJO.set('parentCog', parentResourceUrl as never); collection?.add(newCOJO); + + /* + * ParentResource.set('cojo', [newCOJO] as RA< + * SpecifyResource + * >); + */ + const parentResourceCojo = parentResource.getDependentResource('cojo'); + if (typeof parentResourceCojo === 'object') parentResourceCojo.add(newCOJO); }; const handleStates = (): void => {