diff --git a/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx b/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx index 3f469edd3828..3054bbc88e70 100644 --- a/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx +++ b/apps/web/components/ServiceWeb/Forms/StandardForm/StandardForm.tsx @@ -26,7 +26,10 @@ import { Stack, Text, } from '@island.is/island-ui/core' -import { InputController } from '@island.is/shared/form-fields' +import { + CheckboxController, + InputController, +} from '@island.is/shared/form-fields' import { sortAlpha } from '@island.is/shared/utils' import { ContentLanguage, @@ -42,6 +45,7 @@ import { GET_SUPPORT_SEARCH_RESULTS_QUERY } from '@island.is/web/screens/queries import { FiskistofaCategories, SjukratryggingarCategories, + VinnueftirlitidCategories, } from '@island.is/web/screens/ServiceWeb/Forms/utils' import { getServiceWebSearchTagQuery } from '@island.is/web/screens/ServiceWeb/utils' @@ -93,6 +97,14 @@ const labels: Record = { malsnumer_ef_til_stadar: 'Málsnúmer (ef til staðar)', faedingardagur_eda_kennitala_malsadila: 'Fæðingardagur/Kennitala málsaðila', skipaskrarnumer: 'Skipaskrárnúmer', + vinnuvelanumer_kaupanda: 'Vinnuvélanúmer kaupanda', + vinnuvelanumer_seljanda: 'Vinnuvélanúmer seljanda', + vinnuvelanumer_vegna_skodunar: 'Vinnuvélanúmer vegna skoðunar', + stadsetning_taekis: 'Staðsetning tækis', + stadsetning_verkstadar: 'Staðsetning verkstaðar', + nafn_fyrirtaekis: 'Nafn fyrirtækis', + starfsstod: 'Starfsstöð', + oska_eftir_vernd_uppljostrara: 'Óska eftir vernd uppljóstrara', } // these should be skipped in the message itself @@ -154,6 +166,35 @@ const BasicInput = ({ ) } +interface BasicCheckboxProps { + name: keyof typeof labels + label: string +} + +const BasicCheckbox = ({ name, label }: BasicCheckboxProps) => { + const { + formState: { errors }, + register, + } = useFormContext() + + return ( + + ) +} + const MIN_SEARCH_QUERY_LENGTH = 1 export const StandardForm = ({ @@ -482,6 +523,129 @@ export const StandardForm = ({ ) break + case VinnueftirlitidCategories.NAMSKEID: + case VinnueftirlitidCategories.VINNUSLYS: + case VinnueftirlitidCategories.VINNUVELARETTINDI: + case VinnueftirlitidCategories.VINNUVERND: + case VinnueftirlitidCategories.MARKADSEFTIRLIT: + case VinnueftirlitidCategories.EKKO_OG_SAMSKIPTI: + case VinnueftirlitidCategories.LOG_OG_REGLUGERDIR: + case VinnueftirlitidCategories.LEYFI_OG_UMSAGNIR: + case VinnueftirlitidCategories.ONNUR_THJONUSTA: + fields = ( + + + + ) + break + case VinnueftirlitidCategories.SKRANING_OG_SKODUN_VINNUVELA: + fields = ( + <> + + + + + + + + + + + + + + + + + ) + break + case VinnueftirlitidCategories.MANNVIRKJAGERD: + fields = ( + <> + + + + + + + + ) + break + case VinnueftirlitidCategories.VINNUADSTADA: + fields = ( + <> + + + + + + + + ) + break default: break } @@ -571,7 +735,11 @@ export const StandardForm = ({ const label = labels[k] const value = values[k] - if (label && value) { + if ( + label && + ((Array.isArray(value) && value.length > 0) || + (!Array.isArray(value) && Boolean(value))) + ) { message += `${label}:\n${value}\n\n` } diff --git a/apps/web/components/ServiceWeb/Forms/StandardForm/types.ts b/apps/web/components/ServiceWeb/Forms/StandardForm/types.ts index 26ca5c2e89a1..0934e1dc2baf 100644 --- a/apps/web/components/ServiceWeb/Forms/StandardForm/types.ts +++ b/apps/web/components/ServiceWeb/Forms/StandardForm/types.ts @@ -1,12 +1,14 @@ import type { FiskistofaCategories, SjukratryggingarCategories, + VinnueftirlitidCategories, } from '@island.is/web/screens/ServiceWeb/Forms/utils' export type CategoryId = | SyslumennCategories | SjukratryggingarCategories | FiskistofaCategories + | VinnueftirlitidCategories export enum SyslumennCategories { FJOLSKYLDUMAL = '4vQ4htPOAZvzcXBcjx06SH', diff --git a/apps/web/screens/ServiceWeb/Forms/utils.ts b/apps/web/screens/ServiceWeb/Forms/utils.ts index e84d8a93ed75..4a0b84c7c836 100644 --- a/apps/web/screens/ServiceWeb/Forms/utils.ts +++ b/apps/web/screens/ServiceWeb/Forms/utils.ts @@ -97,6 +97,21 @@ export enum FiskistofaCategories { VEIDIHEIMILDIR = '1agbWJCHTDVfVR4yQZPaEK', } +export enum VinnueftirlitidCategories { + NAMSKEID = '41SeTRazu0qKIixRhWpDLA', + SKRANING_OG_SKODUN_VINNUVELA = '1ulMblBQwDkfSNgh2NyKpw', + VINNUSLYS = '3VY4skpcXo7XyniStyxrVc', + VINNUVELARETTINDI = '1AkjZQc1CO6hMPXYaLSqTw', + VINNUVERND = '4Wmxb25h9R7L0kuYsz19jG', + MARKADSEFTIRLIT = '61OI7gY23wC80mRRA4yrbA', + MANNVIRKJAGERD = '7fLoJqpyojUHgdDofIpqlU', + EKKO_OG_SAMSKIPTI = '3SAlg8Xt7AKBQFrGUCTkG1', + VINNUADSTADA = '7FPsjPxRHA2aIOUXY3Xr3V', + LOG_OG_REGLUGERDIR = '7vb5yId3HMigcXEDMYN9uN', + LEYFI_OG_UMSAGNIR = '7nLIjBeO5EovoPYwINWoyv', + ONNUR_THJONUSTA = 'fdkCIdREoNlYmgkr37DTl', +} + export const filterSupportCategories = ( supportCategories: SupportCategory[] | undefined, slug: string,