Appearance
Service Company Wizard
Register a service company for contractor engagements.
Routes
/create-service-company-wizard/create-service-company-wizard?redirectUrl=:path/email/:candidateEmail/:id/create-service-company-wizard
Overview
A two-step wizard for creating a new contractor service company. The wizard uses Svelte context to share state between steps. On completion, the company is registered and optionally selected for the engagement.
Wizard steps
Step 1: Company
The company step collects:
- Company name (required; min
ServiceCompany.MIN_NAME_LENGTH, maxServiceCompany.MAX_NAME_LENGTH; auto-focused on mount; has tooltip) - Country of registration (required; country dropdown via
ComboboxCountries) - Registration number (required; min
ServiceCompany.MIN_REG_NUMBER_LENGTH, maxServiceCompany.MAX_REG_NUMBER_LENGTH; has tooltip) - Tax ID (optional; min
ServiceCompany.MIN_TAX_ID_LENGTH, maxServiceCompany.MAX_TAX_ID_LENGTH; has tooltip) - Under ownership checkbox (default: checked)
Validation runs reactively: the "Next" button is enabled only when name, country, and registration number pass validation and the tax ID (if provided) is within length bounds. Inline errors are shown on field blur via validateField.
Step 2: Address
The address step collects (via the shared Address wizard stage component):
- Address line (required)
- City (required)
- Postal code (required)
- Dial code (country code selector)
- Phone number
The country from Step 1 is passed as a dependency to the address stage.
Signatory auto-population
The signatory is not a visible wizard step but is auto-populated on completion:
- If the wizard was accessed via
/email/:candidateEmail/:id/create-service-company-wizard, the signatory is populated from the EOR instance (first name, last name, email, phone) - Otherwise, the signatory is populated from the candidate's profile
- Role defaults to "Director"
Completion flow
- A loading spinner is shown with a "creating" message
- A UUID is generated for the new company
- A
RegisterServiceCompanyCommandis built from the company, address, and signatory data and sent viaServiceCompany.register - Polling confirms the company was created via
ServiceCompany.poll - If the wizard was accessed with an engagement ID (
:idparameter):- A
SubmitServiceCompanyCommandis sent viaServiceCompany.selectForEorto link the company to the engagement - Polling confirms the selection via
ServiceCompany.pollSelectionForEor - The contractor type is updated via
changeContractorTypebased on the ownership flag
- A
- Navigation redirects to the URL specified in the
redirectUrlquery parameter
Wizard title
- On Step 1 or when no company name is set: displays the generic wizard title
- After Step 1 with a company name: displays a title interpolated with the company name
Close behavior
Clicking the close button navigates to the redirectUrl query parameter value.