Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefwint committed Jun 18, 2024
1 parent 1b6c33e commit 9b25396
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const ObjectPersonModal = ({ model }: ObjectPersonModalProps) => {
)}
validateOnChange
enableReinitialize>
{({ isValid, isSubmitting }) => (
{({ isValid, isSubmitting, dirty }) => (
<Form>
<div className="space-y-4">
{staticData.map(item => {
Expand Down Expand Up @@ -147,7 +147,7 @@ const ObjectPersonModal = ({ model }: ObjectPersonModalProps) => {
<Button
variant="cta"
type="submit"
isDisabled={!isValid || isSubmitting}
isDisabled={!isValid || isSubmitting || !dirty}
isLoading={isSubmitting}>
Opslaan
</Button>
Expand Down
4 changes: 2 additions & 2 deletions src/utils/dynamicObject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export const getStaticDataPropertyRequired = (
key: keyof ModelPatchStaticType
) => {
switch (key) {
case 'Client_1_UUID':
case 'Owner_2_UUID':
case 'Portfolio_Holder_1_UUID':
case 'Portfolio_Holder_2_UUID':
return false
case 'Owner_1_UUID':
case 'Client_1_UUID':
case 'Portfolio_Holder_1_UUID':
return true
default:
throw new Error(
Expand Down
4 changes: 2 additions & 2 deletions src/validation/objectGeneralInformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { object } from 'zod'
import { schemaDefaults } from '@/validation/zodSchema'

export const SCHEMA_GENERAL_INFORMATION = object({
Client_1_UUID: schemaDefaults.optionalString,
Client_1_UUID: schemaDefaults.requiredString(),
Owner_1_UUID: schemaDefaults.requiredString(),
Owner_2_UUID: schemaDefaults.optionalString,
Portfolio_Holder_1_UUID: schemaDefaults.optionalString,
Portfolio_Holder_1_UUID: schemaDefaults.requiredString(),
Portfolio_Holder_2_UUID: schemaDefaults.optionalString,
}).superRefine(
(
Expand Down

0 comments on commit 9b25396

Please sign in to comment.