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

Préavis – Correction de divers points restants #3626

Merged
merged 13 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<li>Type(s) de préavis : <strong>{{ pno_types or "-" }}</strong></li>
</ul>
{% if note %}
<p><span style="color:red;"><strong>[ ! ] Points d'attention identifiés par le CNSP</strong></span> - Consultez le pdf du préavis et contactez le CNSP pour plus d'informations.</p>
<p><span style="color:red;"><strong>[ ! ] Demande de contrôle du CNSP</strong></span> - Consultez le pdf du préavis et contactez le CNSP pour plus d'informations.</p>
{% endif %}
</main>
<footer id="signature">---<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<li>Type(s) de préavis : <strong>Préavis type 1, Préavis type 2</strong></li>
</ul>

<p><span style="color:red;"><strong>[ ! ] Points d'attention identifiés par le CNSP</strong></span> - Consultez le pdf du préavis et contactez le CNSP pour plus d'informations.</p>
<p><span style="color:red;"><strong>[ ! ] Demande de contrôle du CNSP</strong></span> - Consultez le pdf du préavis et contactez le CNSP pour plus d'informations.</p>

</main>
<footer id="signature">---<br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ context('Side Window > Logbook Prior Notification Form > Form', () => {

// When
cy.fill("Points d'attention identifiés par le CNSP", "Un point d'attention.")
cy.fill('Par', 'ABC')
cy.fill('Saisi par', 'ABC')

cy.wait('@updateLogbookPriorNotification')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PriorNotification } from '@features/PriorNotification/PriorNotification.types'
import { assertNotNullish } from '@utils/assertNotNullish'
import { SideWindowMenuLabel } from 'domain/entities/sideWindow/constants'

Expand All @@ -6,8 +7,6 @@ import { assertAll } from '../../utils/assertAll'
import { customDayjs } from '../../utils/customDayjs'
import { getUtcDateInMultipleFormats } from '../../utils/getUtcDateInMultipleFormats'

import type { PriorNotification } from '@features/PriorNotification/PriorNotification.types'

context('Side Window > Prior Notification List > Filter Bar', () => {
const apiPathBase = '/bff/v1/prior_notifications?'

Expand Down Expand Up @@ -229,7 +228,7 @@ context('Side Window > Prior Notification List > Filter Bar', () => {
cy.get('.Table-SimpleTable tr').should('have.length.to.be.greaterThan', 0)
})

it('Should filter prior notifications by type', () => {
it('Should filter prior notifications by types', () => {
openSideWindowPriorNotificationListAsSuperUser()

cy.intercept('GET', `${apiPathBase}*priorNotificationTypes=Préavis type A,Préavis type C*`).as(
Expand All @@ -241,6 +240,22 @@ context('Side Window > Prior Notification List > Filter Bar', () => {
cy.get('.Table-SimpleTable tr').should('have.length.to.be.greaterThan', 0)
})

it('Should filter prior notifications by states', () => {
openSideWindowPriorNotificationListAsSuperUser()

cy.intercept(
'GET',
`${apiPathBase}*states=${PriorNotification.State.PENDING_SEND},${PriorNotification.State.PENDING_AUTO_SEND}*`
).as('getPriorNotifications')

cy.fill('Statuts de diffusion', [
PriorNotification.STATE_LABEL[PriorNotification.State.PENDING_SEND],
PriorNotification.STATE_LABEL[PriorNotification.State.PENDING_AUTO_SEND]
])

cy.get('.Table-SimpleTable tr').should('have.length.to.be.greaterThan', 0)
})

it('Should filter prior notifications for vessels with length < or >= 12 meters', () => {
openSideWindowPriorNotificationListAsSuperUser()

Expand Down
60 changes: 11 additions & 49 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"dependencies": {
"@dnd-kit/core": "6.1.0",
"@dnd-kit/modifiers": "6.0.1",
"@mtes-mct/monitor-ui": "21.2.0",
"@mtes-mct/monitor-ui": "21.3.0",
"@reduxjs/toolkit": "2.2.7",
"@sentry/react": "7.117.0",
"@tanstack/react-table": "8.20.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function Form({ detail, initialFormValues }: FormProps) {
<FormikTextarea label="Points d'attention identifiés par le CNSP" name="note" readOnly={isReadOnly} />
</FieldGroup>

{isSuperUser && <AuthorTrigramInput label="Par" name="authorTrigram" readOnly={isReadOnly} />}
{isSuperUser && <AuthorTrigramInput label="Saisi par" name="authorTrigram" readOnly={isReadOnly} />}

<hr />

Expand Down Expand Up @@ -151,6 +151,7 @@ const FieldGroup = styled.div.attrs({ className: 'FieldGroup' })`
`

const AuthorTrigramInput = styled(FormikTextInput)`
margin-top: 24px;
width: 120px;
`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,13 @@ export function Content({ detail, isValidatingOnChange, onClose, onSubmit, onVer

<Form isReadOnly={isReadOnly} />

{!!detail && !isInvalidated && !isPendingSend && (
<InvalidateButton accent={Accent.SECONDARY} Icon={Icon.Invalid} onClick={openInvalidationConfirmationModal}>
{!!detail && (
<InvalidateButton
accent={Accent.SECONDARY}
disabled={isReadOnly}
Icon={Icon.Invalid}
onClick={openInvalidationConfirmationModal}
>
Invalider le préavis
</InvalidateButton>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ export function Form({ isReadOnly }: FormProps) {

<FieldGroup>
<FormikTextarea label="Points d'attention identifiés par le CNSP" name="note" readOnly={isReadOnly} />
<FormikCheckbox
label="pas de pêche après le préavis zéro"
name="didNotFishAfterZeroNotice"
readOnly={isReadOnly}
/>
</FieldGroup>

<AuthorTrigramInput label="Saisi par" maxLength={3} name="authorTrigram" readOnly={isReadOnly} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function FormikExtraField({ allFishingsCatches, fishingsCatchesIndex, spe
<ExtendedSpecyCode>{extendedSpecyCode}</ExtendedSpecyCode>
<InputWithUnit>
<FormikNumberInput
areArrowsHidden
isErrorMessageHidden
isLabelHidden
label={`Quantité (${extendedSpecyCode})`}
Expand All @@ -33,6 +34,7 @@ export function FormikExtraField({ allFishingsCatches, fishingsCatchesIndex, spe
</InputWithUnit>
<InputWithUnit>
<FormikNumberInput
areArrowsHidden
isErrorMessageHidden
isLabelHidden
label={`Poids (${extendedSpecyCode})`}
Expand All @@ -53,6 +55,7 @@ export function FormikExtraField({ allFishingsCatches, fishingsCatchesIndex, spe
<StyledSubRow key="SWO">
<InputWithUnit>
<FormikNumberInput
areArrowsHidden
isLabelHidden
label={`Quantité (${specyCode})`}
name={`fishingCatches[${fishingsCatchesIndex}].quantity`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export function FormikFishingCatchesMultiSelect({ isReadOnly }: FormikFishingCat

<InputWithUnit>
<FormikNumberInput
areArrowsHidden
isErrorMessageHidden
isLabelHidden
label={`Poids (${fishingCatch.specyCode})`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,14 @@ export function FilterBar() {
<CheckPicker
isLabelHidden
isTransparent
label="Statuts"
label="Statuts de diffusion"
name="states"
onChange={updateStates}
options={PriorNotification.STATE_LABELS_AS_OPTIONS}
placeholder="Statuts"
renderValue={(_, items) => (items.length > 0 ? <SelectValue>Statuts ({items.length})</SelectValue> : <></>)}
placeholder="Statuts de diffusion"
renderValue={(_, items) =>
items.length > 0 ? <SelectValue>Statuts de diffusion ({items.length})</SelectValue> : <></>
}
value={listFilterValues.states}
/>
<RichBooleanCheckbox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export function Row({ row }: RowProps) {
</FixedTag>
)}

{isSuperUser && (
{isSuperUser && priorNotification.reportingCount > 0 && (
<FixedTag backgroundColor={THEME.color.maximumRed15} color={THEME.color.maximumRed}>{`${
priorNotification.reportingCount
} signalement${priorNotification.reportingCount > 1 ? 's' : ''}`}</FixedTag>
Expand All @@ -224,7 +224,7 @@ const ExpandableRowCell = styled(TableWithSelectableRows.Td)<{
cursor: pointer;
user-select: none;
color: ${p => (p.$isInvalidated ? p.theme.color.slateGray : p.theme.color.charcoal)};
background: ${p => (p.$isInvalidated ? p.theme.color.gainsboro : 'inherit')};
background: ${p => (p.$isInvalidated ? p.theme.color.gainsboro : p.theme.color.cultured)};
`

// TODO Add this feature in monitor-ui.
Expand All @@ -234,7 +234,7 @@ const ExpandedRow = styled(TableWithSelectableRows.BodyTr)<{
> td {
overflow: hidden !important;
color: ${p => (p.$isInvalidated ? p.theme.color.slateGray : p.theme.color.charcoal)};
background: ${p => (p.$isInvalidated ? p.theme.color.gainsboro : 'inherit')};
background: ${p => (p.$isInvalidated ? p.theme.color.gainsboro : p.theme.color.cultured)};
}

&:hover {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export function getColorsFromState(state: PriorNotification.State | undefined):

case PriorNotification.State.PENDING_AUTO_SEND:
case PriorNotification.State.PENDING_SEND:
colors = [THEME.color.gainsboro, THEME.color.slateGray, THEME.color.slateGray]
colors = [THEME.color.gainsboro, THEME.color.gainsboro, THEME.color.slateGray]
break

case PriorNotification.State.VERIFIED_AND_SENT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function DownloadButton({
return (
<>
{hasAuthorizedLandingDownload && (
<Dropdown accent={Accent.SECONDARY} Icon={Icon.Download} placement="topEnd" title="Télécharger les documents">
<Dropdown accent={Accent.SECONDARY} Icon={Icon.Download} placement="topEnd" title="Télécharger">
<>
{!isPriorNotificationDocumentAvailable && (
<Dropdown.Item disabled title="Document non généré">
Expand Down
Loading