Skip to content

Commit

Permalink
feat(assignment-form): add end date field to assignment details (#13)
Browse files Browse the repository at this point in the history
* add end date field to assignment details
* update filter name for view paths in BootstrapTest
  • Loading branch information
thorbrink authored Dec 6, 2024
1 parent 51a0fec commit dadb615
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions source/js/module/AssignmentForm/field-groups/DetailsFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const DetailsFields = ({
qualifications,
totalSpots,
schedule = '',
endDate = '',
location = {
address: '',
city: '',
Expand Down Expand Up @@ -135,6 +136,17 @@ export const DetailsFields = ({
readOnly={isSubmitted}
/>
</Grid>
<Grid col={12} >
<Field
value={endDate || ''}
label={phrase('field_label_assignment_end_date', 'End date')}
name="assignment_end_date"
type="date"
onChange={parseValue(handleChange('endDate'))}
inputProps={isLoading || isSubmitted ? { disabled: true } : {}}
readOnly={isSubmitted}
/>
</Grid>
</FormSection>
)
}
Expand Down
1 change: 1 addition & 0 deletions source/js/volunteer-service/VolunteerServiceContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export interface AssignmentInput {
title: string
description: string
employer: Employer
endDate?: string
signUp:
| {
type?: SignUpTypes
Expand Down
1 change: 1 addition & 0 deletions source/js/volunteer-service/rest/create-rest-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export const createRestContext = (
assignment_eligibility: '[]',
description: input.description,
qualifications: input.qualifications ?? '',
end_date: input.endDate ?? '',
schedule:
input.schedule ?? [input.when, input.where].filter((v) => v && v.length > 0).join('\n\n'),
benefits: input.benefits ?? '',
Expand Down
2 changes: 1 addition & 1 deletion source/tests/php/BootstrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testRegisterFilters(): void
->shouldBeCalled();

$this->wp
->addFilter('Municipio/blade/view_paths', [$this->bootstrap, 'setBladeTemplatePaths'],
->addFilter('Municipio/viewPaths', [$this->bootstrap, 'setBladeTemplatePaths'],
5, 1)
->shouldBeCalled();

Expand Down

0 comments on commit dadb615

Please sign in to comment.