Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Contractor/NewHireReport/NewHireReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function NewHireReport(props: NewHireReportProps) {
)
}

function Root({ contractorId, className, dictionary }: NewHireReportProps) {
function Root({ contractorId, className, dictionary, selfOnboarding = false }: NewHireReportProps) {
useComponentDictionary('Contractor.NewHireReport', dictionary)
useI18n('Contractor.NewHireReport')
const { t } = useTranslation('Contractor.NewHireReport')
Expand Down Expand Up @@ -71,6 +71,8 @@ function Root({ contractorId, className, dictionary }: NewHireReportProps) {
request: {
contractorUuid: contractorId,
requestBody: {
type: contractorDetails.type,
selfOnboarding: selfOnboarding,
fileNewHireReport: payload.fileNewHireReport,
workState: 'state' in payload ? payload.state : null,
version: contractorDetails.version!,
Expand Down
1 change: 1 addition & 0 deletions src/components/Contractor/NewHireReport/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import type { BaseComponentInterface } from '@/components/Base'

export interface NewHireReportProps extends BaseComponentInterface<'Contractor.NewHireReport'> {
contractorId: string
selfOnboarding?: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,14 @@ export function PaymentMethodContextual() {
return <PaymentMethod onEvent={onEvent} contractorId={ensureRequired(contractorId)} />
}
export function NewHireReportContextual() {
const { onEvent, contractorId } = useFlow<OnboardingFlowContextInterface>()
return <NewHireReport onEvent={onEvent} contractorId={ensureRequired(contractorId)} />
const { onEvent, contractorId, selfOnboarding } = useFlow<OnboardingFlowContextInterface>()
return (
<NewHireReport
onEvent={onEvent}
contractorId={ensureRequired(contractorId)}
selfOnboarding={selfOnboarding}
/>
)
}
export function SubmitContextual() {
const { onEvent, contractorId, selfOnboarding } = useFlow<OnboardingFlowContextInterface>()
Expand Down
2 changes: 1 addition & 1 deletion src/components/Contractor/Submit/Submit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const Root = ({ contractorId, selfOnboarding }: ContractorSubmitProps) =>
return <SubmitDone onDone={handleSubmitDone} />
}
if (
onboardingStatus === ContractorOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE &&
onboardingStatus === ContractorOnboardingStatus.SELF_ONBOARDING_NOT_INVITED &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my understanding, why are we changing the enum check here? and is there ever a case where multiple enums would qualify as truthy for this check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was messed up previously due to the contractor update endpoint being called incorrectly in the file new hire report. This was a needed change after i corrected that

For the other statuses we wouldn't want to show the invite screen... unless they were changing the recipient email, but that's a case we would probably need some UX around anyway

This is probably still something that will need work on refining moving forward separately as contractor onboarding gets traction with partners, but this at least makes the happy path functional for now.

selfOnboarding
) {
return <InviteContractor onSubmit={handleInviteContractor} contractorId={contractorId} />
Expand Down