mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
small fix to occurrencedetails
This commit is contained in:
@@ -12,20 +12,12 @@ import {
|
|||||||
LocalityDetailsType,
|
LocalityDetailsType,
|
||||||
OccurrenceDetailsType,
|
OccurrenceDetailsType,
|
||||||
} from '@/shared/types'
|
} from '@/shared/types'
|
||||||
import { validateOccurrence } from '@/shared/validators/occurrence'
|
import { validateOccurrence, validateOccurrenceFields } from '@/shared/validators/occurrence'
|
||||||
import { getErrorMessage, useNotify } from '@/hooks/notification'
|
import { getErrorMessage, useNotify } from '@/hooks/notification'
|
||||||
import { ValidationObject } from '@/shared/validators/validator'
|
|
||||||
import { useGetOccurrenceDetailsQuery } from '@/redux/api'
|
import { useGetOccurrenceDetailsQuery } from '@/redux/api'
|
||||||
import { useEditLocalityMutation, useGetLocalityDetailsQuery } from '@/redux/localityReducer'
|
import { useEditLocalityMutation, useGetLocalityDetailsQuery } from '@/redux/localityReducer'
|
||||||
|
|
||||||
const validateOccurrenceDetail = (
|
export const emptyOccurrence: OccurrenceDetailsType = {
|
||||||
editData: EditDataType<OccurrenceDetailsType>,
|
|
||||||
fieldName: keyof EditDataType<OccurrenceDetailsType>
|
|
||||||
): ValidationObject => {
|
|
||||||
return validateOccurrence(editData as EditableOccurrenceData, fieldName as keyof EditableOccurrenceData)
|
|
||||||
}
|
|
||||||
|
|
||||||
const emptyOccurrence: OccurrenceDetailsType = {
|
|
||||||
lid: 0,
|
lid: 0,
|
||||||
species_id: 0,
|
species_id: 0,
|
||||||
loc_status: null,
|
loc_status: null,
|
||||||
@@ -214,7 +206,7 @@ export const OccurrenceDetails = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tabs: TabType[] = [
|
const tabs: TabType[] = [
|
||||||
{ title: 'Occurrence', content: <OccurrenceCoreTab existingOccurrences={localityData!.now_ls} /> },
|
{ title: 'Occurrence', content: <OccurrenceCoreTab clickableLocName existingOccurrences={localityData?.now_ls ?? []} /> },
|
||||||
{ title: 'Wear', content: <OccurrenceWearTab /> },
|
{ title: 'Wear', content: <OccurrenceWearTab /> },
|
||||||
{ title: 'Isotopes', content: <OccurrenceIsotopeTab /> },
|
{ title: 'Isotopes', content: <OccurrenceIsotopeTab /> },
|
||||||
{
|
{
|
||||||
@@ -228,7 +220,8 @@ export const OccurrenceDetails = () => {
|
|||||||
tabs={tabs}
|
tabs={tabs}
|
||||||
data={occurrenceData ?? initialOccurrence}
|
data={occurrenceData ?? initialOccurrence}
|
||||||
isNew={isNew}
|
isNew={isNew}
|
||||||
validator={validateOccurrenceDetail}
|
validator={validateOccurrence}
|
||||||
|
validateFields={validateOccurrenceFields}
|
||||||
onWrite={onWrite}
|
onWrite={onWrite}
|
||||||
hasStagingMode
|
hasStagingMode
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user