Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

375 - front ajouter une infraction pour cette cible #378

Merged
merged 33 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
59f3d39
feat(365)- display du bouton "ajouter une infraction pour cette cible…
aleckvincent Sep 30, 2024
9c5127e
feat(365)- une tuile par infraction
aleckvincent Sep 30, 2024
a3db448
feat(365)- remove useless props in test
aleckvincent Sep 30, 2024
2ba9a88
feat(365)- check with action targetType
aleckvincent Oct 1, 2024
ab47f9c
bugfix(376) - fix issue with hook useMissionTimeLine for checking isM…
aleckvincent Sep 30, 2024
55d1c4e
fix(missions): update getMissions fetch policy
lwih Sep 30, 2024
6189ae8
fix(fish): remove warning about missiong key in map
lwih Sep 30, 2024
d6ba6cf
fix(login): trim and lowercase email
lwih Sep 30, 2024
acd4a79
fix(infractions): fix infractions not being submitted
lwih Sep 30, 2024
1fb0592
fix(controls): toggle on unitHasConfirmed when required
lwih Sep 30, 2024
c717dc6
fix(controls): fix fish controls being toggled on automatically on ac…
lwih Sep 30, 2024
36e9131
Release 2.0.9
lwih Oct 1, 2024
4787459
fix issue with tests
aleckvincent Oct 1, 2024
7deab13
feat(infraction)- groupby controlled person also
xtiannyeto Oct 1, 2024
d84d4db
fix(warning): remove front dead code
xtiannyeto Jul 25, 2024
e10435d
fix(warning): remove unused import
xtiannyeto Aug 22, 2024
8f5287c
fix(build): update import
xtiannyeto Oct 2, 2024
f516445
fix(build): update import
xtiannyeto Oct 2, 2024
0f040c5
fix(build): update import
xtiannyeto Oct 2, 2024
57f85cb
fix(build): update import
xtiannyeto Oct 2, 2024
daf30d5
fix(build): update import
xtiannyeto Oct 2, 2024
0f56cbd
feat(RapportPatrouille): move docx creation into rapportnav2
lwih Oct 1, 2024
5fc2f7a
fix(crew): update Themis A
lwih Oct 2, 2024
b30778c
Release 2.1.0
lwih Oct 2, 2024
e17df4b
fix(login): fix faulty lowercase method on the email
lwih Oct 2, 2024
04fb4b1
Release 2.1.1
lwih Oct 2, 2024
4b8366f
Release 2.1.2
lwih Oct 2, 2024
bd06058
use "Personne morale" instead of "Société"
aleckvincent Oct 7, 2024
d48dba4
display identifiedControlledPerson name
aleckvincent Oct 7, 2024
d4418df
add Display button when controlType is null
aleckvincent Oct 8, 2024
198ae62
fix(rapport de patrouille): fix encoding
lwih Oct 2, 2024
ad6c6e8
feat(rapport de patrouille): add bilan opérationnel
lwih Oct 8, 2024
cca7e7e
Release 2.2.0
lwih Oct 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ const EnvInfractionExistingTargets: React.FC<EnvInfractionExistingTargetProps> =
<div
key={infractionByTarget.vesselIdentifier}
style={{
width: '100%',
backgroundColor: THEME.color.white,
padding: '1rem',
marginBottom: '0.25rem'
width: '100%'
}}
>
{selectedVessel === infractionByTarget.vesselIdentifier ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,21 @@ const infractionByTargetMock = (infractions: Infraction[]) => ({
targetAddedByUnit: false
})

const infractionByTargetCompanyMock = (infractions: Infraction[]) => ({
vesselIdentifier: null,
vesselType: null,
infractions,
controlTypesWithInfraction: [ControlType.ADMINISTRATIVE],
targetAddedByUnit: false
})

const props = infractionByTarget => ({
infractionByTarget,
onAddInfractionForTarget: vi.fn(),
onEditInfractionForTarget: vi.fn(),
onDeleteInfraction: vi.fn()
})

describe('EnvInfractionSummary', () => {
describe('testing rendering', () => {
test('renders the component', async () => {
Expand Down Expand Up @@ -92,4 +101,11 @@ describe('EnvInfractionSummary', () => {
expect(onDeleteInfraction).toHaveBeenCalled()
})
})

describe('rendering button "Ajouter une infraction pour cette cible"', () => {
test('should not render button "Ajouter une infraction pour cette cible" if is not a vessel', async () => {
render(<EnvInfractionSummary {...props(infractionByTargetCompanyMock([infractionMock]))} />)
expect(screen.queryByText('infraction pour cette cible')).not.toBeInTheDocument()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,32 @@ const EnvInfractionSummary: React.FC<EnvInfractionSummaryProps> = ({
{`${vesselTypeToHumanString(infractionByTarget?.vesselType)} - ${infractionByTarget?.vesselIdentifier}`}
</Text>
</Stack.Item>
<Stack.Item>
<Button
onClick={() =>
onAddInfractionForTarget({
target: infractionByTarget?.infractions?.find(infraction => !!infraction.target)?.target
})
}
accent={Accent.SECONDARY}
size={Size.NORMAL}
Icon={Icon.Plus}
role={'add-infraction'}
>
infraction pour cette cible
</Button>
</Stack.Item>
{infractionByTarget?.vesselType !== null && (
<Stack.Item>
<Button
onClick={() =>
onAddInfractionForTarget({
target: infractionByTarget?.infractions?.find(infraction => !!infraction.target)?.target
})
}
accent={Accent.SECONDARY}
size={Size.NORMAL}
Icon={Icon.Plus}
role={'add-infraction'}
>
infraction pour cette cible
</Button>
</Stack.Item>
)}

</Stack>
</Stack.Item>
{infractionByTarget?.infractions.map((infraction: Infraction) => (
<Stack.Item key={infraction.id} style={{ width: '100%' }}>
<Stack.Item key={infraction.id} style={{
width: '100%',
backgroundColor: THEME.color.white, padding: '0.8rem',
marginBottom: '0.05rem'
}}>
<Stack direction="row" spacing={'0.5rem'} justifyContent="space-between">
<Stack.Item>
<Stack direction="row" spacing={'0.5rem'} wrap={true}>
Expand Down
Loading