Skip to content

Commit

Permalink
fix: p2p fields are now null by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast committed Apr 30, 2024
1 parent fa48f1b commit c2a96ce
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,19 @@ const useBatchActionsInspected = (
.required(t('common:form.validation.date.format')),
p2pAnyString: string().when('inspection_mode', {
is: 'p2p',
then: string().required(translations.required),
then: string().nullable().required(translations.required),
}),
p2pFullName: string().when('inspection_mode', {
is: 'p2p',
then: string()
.nullable()
.matches(/^(.*)\s(\w+)/, translations.invalidName)
.required(translations.required),
}),
email: string().when('inspection_mode', {
is: 'p2p',
then: string()
.nullable()
.email(t('common:form.validation.email.invalid'))
.required(translations.required),
}),
Expand Down Expand Up @@ -165,15 +167,13 @@ const useBatchActionsInspected = (
form,
});

console.log(decision_date);

const formOptions = {
initialValues: {
inspection_mode: 'ahjo',
decision_maker_name,
decision_maker_title,
expert_inspector_name,
expert_inspector_title,
decision_maker_name: decision_maker_name || '',
decision_maker_title: decision_maker_title || '',
expert_inspector_name: expert_inspector_name || '',
expert_inspector_title: expert_inspector_title || '',
section_of_the_law:
section_of_the_law && section_of_the_law?.length > 0
? section_of_the_law
Expand All @@ -182,9 +182,9 @@ const useBatchActionsInspected = (
decision_date && decision_date?.length > 0
? format(parse(decision_date, 'yyyy-MM-dd', new Date()), 'd.M.yyyy')
: format(new Date(), 'd.M.yyyy'),
p2p_inspector_name,
p2p_inspector_email,
p2p_checker_name,
p2p_inspector_email: p2p_inspector_email || '',
p2p_inspector_name: p2p_inspector_name || '',
p2p_checker_name: p2p_checker_name || '',
},
validationSchema:
proposalForDecision === PROPOSALS_FOR_DECISION.ACCEPTED
Expand Down

0 comments on commit c2a96ce

Please sign in to comment.