Skip to content

Commit

Permalink
save not working for destuction edit issue resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaKhanAbdalli committed Jan 5, 2024
1 parent 8138d4e commit c4ec889
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useCustomId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function useCustomid(): UseCustomId {
const preFix = ID_FIX?.[resource]
const highestId = existingRcordes?.[0]?.id || 0;
const id =
typeof preFix !== 'undefined' ? `${preFix}-${highestId + 1}` : highestId + 1
typeof preFix !== 'undefined' ? `${preFix}-${(highestId as number) + 1}` : (highestId as number) + 1

const data = { id, ...values }

Expand Down
13 changes: 1 addition & 12 deletions src/resources/destruction/DestructionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
useUpdate
} from 'react-admin'
import * as constants from '../../constants'
import DatePicker from '../../components/DatePicker'
import { yupResolver } from '@hookform/resolvers/yup'
import * as yup from 'yup'
import { ConditionalReferenceInput } from '../batches/BatchForm'
Expand All @@ -38,7 +37,7 @@ const DestructionFormToolbar = (

return (
<Toolbar>
<SaveButton label={isEdit ? 'Save' : 'Create'} alwaysEnable />
<SaveButton label={isEdit ? 'Save' : 'Create'} />
</Toolbar>
)
}
Expand Down Expand Up @@ -155,16 +154,6 @@ export default function DestructionForm(props: Props): React.ReactElement {
toolbar={<DestructionFormToolbar isEdit={isEdit} />}
resolver={yupResolver(schema)}
onSubmit={handleSubmit as any}>
<DatePicker
label='Year'
source='year'
variant='outlined'
format='YYYY'
dataPickerProps={{
views: ['year'],
disabled: true
}}
/>
{isEdit && (
<TextInput
fullWidth
Expand Down

0 comments on commit c4ec889

Please sign in to comment.