Skip to content

Commit

Permalink
Set cojo on parent
Browse files Browse the repository at this point in the history
  • Loading branch information
CarolineDenis committed Oct 16, 2024
1 parent b4a910d commit f411069
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export const businessRuleDefs: MappedBusinessRuleDefs = {
},
},
},

Determination: {
fieldChecks: {
taxon: async (
Expand Down
10 changes: 10 additions & 0 deletions specifyweb/frontend/js_src/lib/components/FormCells/COJODialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -80,6 +82,14 @@ export function COJODialog({
newCOJO.set('parentCog', parentResourceUrl as never);

collection?.add(newCOJO);

/*
* ParentResource.set('cojo', [newCOJO] as RA<
* SpecifyResource<CollectionObjectGroupJoin>
* >);
*/
const parentResourceCojo = parentResource.getDependentResource('cojo');
if (typeof parentResourceCojo === 'object') parentResourceCojo.add(newCOJO);
};

const handleStates = (): void => {
Expand Down

0 comments on commit f411069

Please sign in to comment.