Désactive les associations pour les PLR, et répare la selection pour les pharmaciens
parent
555bd5492d
commit
e47e8945d8
|
@ -191,6 +191,8 @@ entreprise . catégorie juridique . SELAS:
|
|||
|
||||
entreprise . catégorie juridique . association:
|
||||
valeur: catégorie juridique = 'association'
|
||||
par défaut:
|
||||
non applicable si: activité . nature . libérale . réglementée
|
||||
|
||||
entreprise . catégorie juridique . autre:
|
||||
valeur: catégorie juridique = 'autre'
|
||||
|
|
|
@ -51,7 +51,9 @@ export const RadioSkeleton = (props: RadioProps) => {
|
|||
ref={ref}
|
||||
id={id}
|
||||
/>
|
||||
<VisibleRadio as={visibleRadioAs}>{children}</VisibleRadio>
|
||||
<VisibleRadio as={visibleRadioAs} $inert={props.isDisabled}>
|
||||
{children}
|
||||
</VisibleRadio>
|
||||
</Label>
|
||||
)
|
||||
}
|
||||
|
@ -113,7 +115,7 @@ export const RadioButton = styled.span`
|
|||
}
|
||||
`
|
||||
|
||||
export const VisibleRadio = styled.span`
|
||||
export const VisibleRadio = styled.span<{ $inert?: boolean }>`
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
text-align: initial;
|
||||
|
@ -121,17 +123,31 @@ export const VisibleRadio = styled.span`
|
|||
margin: 0 calc(-1 * ${({ theme }) => theme.spacings.sm});
|
||||
border-radius: ${({ theme }) => theme.box.borderRadius};
|
||||
z-index: 1;
|
||||
:hover > ${RadioButton}::before {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
${({ theme, $inert }) =>
|
||||
!$inert
|
||||
? css`
|
||||
:hover > ${RadioButton}::before {
|
||||
opacity: 1;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
:hover ${OutsideCircle} {
|
||||
border-color: ${({ theme }) =>
|
||||
theme.darkMode
|
||||
? theme.colors.bases.primary[500]
|
||||
: theme.colors.bases.primary[700]};
|
||||
}
|
||||
:hover ${OutsideCircle} {
|
||||
border-color: ${
|
||||
theme.darkMode
|
||||
? theme.colors.bases.primary[500]
|
||||
: theme.colors.bases.primary[700]
|
||||
};
|
||||
} :
|
||||
`
|
||||
: css`
|
||||
&:hover {
|
||||
background-color: ${theme.colors.extended.grey[200]} !important;
|
||||
}
|
||||
&:hover,
|
||||
&:hover * {
|
||||
cursor: default !important;
|
||||
}
|
||||
`}
|
||||
`
|
||||
|
||||
const Label = styled.label<{ htmlFor?: string }>``
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import { useEffect } from 'react'
|
||||
import { useEffect, useMemo } from 'react'
|
||||
import { Trans, useTranslation } from 'react-i18next'
|
||||
import { useDispatch } from 'react-redux'
|
||||
|
||||
import { useEngine } from '@/components/utils/EngineContext'
|
||||
import { usePersistingState } from '@/components/utils/persistState'
|
||||
import { RadioCard, RadioCardGroup } from '@/design-system'
|
||||
import { Message, RadioCard, RadioCardGroup } from '@/design-system'
|
||||
import { HelpButtonWithPopover } from '@/design-system/buttons'
|
||||
import { Strong } from '@/design-system/typography'
|
||||
import { Body } from '@/design-system/typography/paragraphs'
|
||||
import { Body, SmallBody } from '@/design-system/typography/paragraphs'
|
||||
import { batchUpdateSituation } from '@/store/actions/actions'
|
||||
|
||||
import Layout from './_components/Layout'
|
||||
|
@ -14,7 +15,7 @@ import Navigation from './_components/Navigation'
|
|||
|
||||
export default function Association() {
|
||||
const { t } = useTranslation()
|
||||
const [currentSelection, setCurrentSelection, reset] =
|
||||
const [currentSelection, setCurrentSelection, reset, associationPossible] =
|
||||
useAssociationSelection()
|
||||
|
||||
return (
|
||||
|
@ -63,15 +64,29 @@ export default function Association() {
|
|||
</RadioCard>
|
||||
<RadioCard
|
||||
value={'non-lucratif'}
|
||||
isDisabled={!associationPossible}
|
||||
label={
|
||||
<Trans i18nKey="choix-statut.association.question.non-lucratif.label">
|
||||
Dans un but <Strong>non lucratif</Strong>
|
||||
</Trans>
|
||||
}
|
||||
description={t(
|
||||
'choix-statut.association.question.non-lucratif.description',
|
||||
'Par exemple, en créant une association'
|
||||
)}
|
||||
description={
|
||||
associationPossible ? (
|
||||
t(
|
||||
'choix-statut.association.question.non-lucratif.description',
|
||||
'Par exemple, en créant une association'
|
||||
)
|
||||
) : (
|
||||
<Message type="info" mini icon>
|
||||
<SmallBody>
|
||||
<Trans i18nKey="choix-statut.association.question.non-lucratif.description.disabled">
|
||||
Cette option n'est pas disponible car votre activité ne
|
||||
peut pas être exercée sous forme d’association
|
||||
</Trans>
|
||||
</SmallBody>
|
||||
</Message>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</RadioCardGroup>
|
||||
<Navigation
|
||||
|
@ -90,7 +105,8 @@ type RadioOption = 'gagner-argent' | 'non-lucratif' | undefined
|
|||
function useAssociationSelection(): [
|
||||
RadioOption,
|
||||
(value: RadioOption) => void,
|
||||
() => void
|
||||
() => void,
|
||||
boolean
|
||||
] {
|
||||
const [{ state: currentSelection }, setCurrentSelection] =
|
||||
usePersistingState<{ state: RadioOption }>('choix-statut:association', {
|
||||
|
@ -98,10 +114,17 @@ function useAssociationSelection(): [
|
|||
})
|
||||
|
||||
const dispatch = useDispatch()
|
||||
|
||||
const engine = useEngine()
|
||||
const associationPossible = useMemo(
|
||||
() =>
|
||||
engine.evaluate({
|
||||
'est applicable': 'entreprise . catégorie juridique . association',
|
||||
}).nodeValue === true,
|
||||
[]
|
||||
)
|
||||
const handleChange = (value: RadioOption) => {
|
||||
setCurrentSelection({ state: value })
|
||||
|
||||
if (!associationPossible) return
|
||||
switch (value) {
|
||||
case 'gagner-argent':
|
||||
dispatch(
|
||||
|
@ -131,11 +154,11 @@ function useAssociationSelection(): [
|
|||
}
|
||||
|
||||
useEffect(() => {
|
||||
handleChange(currentSelection)
|
||||
handleChange(associationPossible ? currentSelection : 'gagner-argent')
|
||||
}, [])
|
||||
const reset = () => {
|
||||
handleChange(undefined)
|
||||
}
|
||||
|
||||
return [currentSelection, handleChange, reset]
|
||||
return [currentSelection, handleChange, reset, associationPossible]
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ export default function DétailsActivité() {
|
|||
) {
|
||||
setCodeGuichet(defaultCodeGuichet)
|
||||
}
|
||||
}, [guichetEntries, defaultCodeGuichet])
|
||||
}, [])
|
||||
|
||||
// Wait for the update to be done before rendering the component
|
||||
const isIdle = useEngineIsIdle()
|
||||
|
@ -83,7 +83,7 @@ export default function DétailsActivité() {
|
|||
<GuichetSelection
|
||||
entries={guichetEntries}
|
||||
onGuichetSelected={(code) => {
|
||||
updateSituationWithGuichet(codeGuichet)
|
||||
updateSituationWithGuichet(code)
|
||||
setCodeGuichet(code)
|
||||
}}
|
||||
codeGuichet={codeGuichet}
|
||||
|
@ -91,7 +91,6 @@ export default function DétailsActivité() {
|
|||
)}
|
||||
<Navigation
|
||||
currentStepIsComplete={!!codeGuichet}
|
||||
onNextStep={() => updateSituationWithGuichet(codeGuichet)}
|
||||
nextStepLabel={
|
||||
guichetEntries?.length === 1 &&
|
||||
t('créer.activité-détails.next1', 'Continuer avec cette activité')
|
||||
|
|
|
@ -24,7 +24,7 @@ export function guichetToPLMétier(
|
|||
? guichet.code === '07140111'
|
||||
? "'santé . sage-femme'"
|
||||
: "'santé . chirurgien-dentiste'"
|
||||
: caisse === 'CARPV'
|
||||
: caisse === 'CAVP'
|
||||
? "'santé . pharmacien'"
|
||||
: caisse === 'CARPIMKO'
|
||||
? "'santé . auxiliaire médical'"
|
||||
|
|
Loading…
Reference in New Issue