diff --git a/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js b/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js index fbe554fd..baed06c5 100644 --- a/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js +++ b/frontend/cypress/e2e/shoulder-bolt-rifle-securing.cy.js @@ -18,7 +18,7 @@ describe('Shoulder Bolt Rifle Securing', () => { cy.getByDataTestid('next-step').should('not.have.attr', 'disabled') cy.getByDataTestid('next-step').click() cy.url().should('contain', '/guide-identification/resultat-final') - cy.getByDataTestid('arm-category').should('contain', 'Catégorie B') + cy.getByDataTestid('arm-category').should('contain', 'Catégorie C') cy.getByDataTestid('return-to-home-end').click() cy.url().should('contain', '/accueil') }) diff --git a/frontend/src/assets/missing_card.png b/frontend/src/assets/missing_card.png new file mode 100644 index 00000000..8fc18a43 Binary files /dev/null and b/frontend/src/assets/missing_card.png differ diff --git a/frontend/src/components.d.ts b/frontend/src/components.d.ts index 300fa05d..34b2c090 100644 --- a/frontend/src/components.d.ts +++ b/frontend/src/components.d.ts @@ -27,6 +27,7 @@ declare module 'vue' { DsfrTag: typeof import('@gouvminint/vue-dsfr')['DsfrTag'] FooterMES: typeof import('./components/FooterMES.vue')['default'] HeaderMain: typeof import('./components/HeaderMain.vue')['default'] + MissingCardAlert: typeof import('./components/MissingCardAlert.vue')['default'] OnboardingSwiper: typeof import('./components/OnboardingSwiper.vue')['default'] PopupContact: typeof import('./components/PopupContact.vue')['default'] PopupVideo: typeof import('./components/PopupVideo.vue')['default'] diff --git a/frontend/src/components/MissingCardAlert.vue b/frontend/src/components/MissingCardAlert.vue new file mode 100644 index 00000000..a297769a --- /dev/null +++ b/frontend/src/components/MissingCardAlert.vue @@ -0,0 +1,11 @@ + diff --git a/frontend/src/components/ResultPage.vue b/frontend/src/components/ResultPage.vue index 1610b61e..f2f0809f 100644 --- a/frontend/src/components/ResultPage.vue +++ b/frontend/src/components/ResultPage.vue @@ -2,7 +2,7 @@ import { ref, computed, watchEffect } from 'vue' import axios from 'axios' import SnackbarAlert from '@/components/SnackbarAlert.vue' -import { resultTree, ALARM_GUNS_TYPOLOGIES, DISCLAIMERS } from '@/utils/firearms-utils/index' +import { resultTree, ALARM_GUNS_TYPOLOGIES, MEASURED_GUNS_TYPOLOGIES, DISCLAIMERS } from '@/utils/firearms-utils/index' import { isUserUsingCrosscall } from '@/utils/isUserUsingCrosscall' import { useSnackbarStore } from '@/stores/snackbar' import { useStepsStore } from '@/stores/steps' @@ -52,6 +52,7 @@ const typology = computed(() => resultStore.typology) const isDummy = computed(() => stepsStore.isDummy) const isDummyTypology = computed(() => resultTree[typology.value]?.isDummyTypology === true) +const isCardDetected = computed(() => resultStore.gunLength !== null && resultStore.gunBarrelLength !== null) const isUp = ref(false) const isDown = ref(false) @@ -119,131 +120,111 @@ function sendFeedback (isCorrect: boolean) {
+ >
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 9cf75a73..93584ac8 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -2,6 +2,8 @@ import { createWebHistory, createRouter, type RouteRecordRaw, type RouteLocation import { clearLocalStorage } from '@/utils/storage-utils.js' +import MissingCardPage from '@/views/MissingCardPage.vue' + const HomePage = () => import('@/views/HomePage.vue') const StartPage = () => import('@/views/StartPage.vue') const InstructionsPage = () => import('@/views/InstructionsPage.vue') @@ -37,6 +39,11 @@ const routes: RouteRecordRaw[] = [ wholeLogo: true, }, }, + { + path: '/carte-manquante', + name: 'MissingCard', + component: MissingCardPage, + }, { path: '/accueil', name: 'StartPage', diff --git a/frontend/src/utils/firearms-utils/get-next-route-after-result.ts b/frontend/src/utils/firearms-utils/get-next-route-after-result.ts index 3022df2b..ba12b1ee 100644 --- a/frontend/src/utils/firearms-utils/get-next-route-after-result.ts +++ b/frontend/src/utils/firearms-utils/get-next-route-after-result.ts @@ -1,24 +1,27 @@ -import { resultTree } from '@/utils/firearms-utils/index' +import { resultTree, MEASURED_GUNS_TYPOLOGIES } from '@/utils/firearms-utils/index' export const getNextRouteAfterResult = ({ securingTutorial, confidenceLevel, typology, gunLength, gunBarrelLength }) => { - const noCardDetected = computed(() => gunLength === undefined || gunBarrelLength === undefined) + const isCardDetected = gunLength !== null && gunBarrelLength !== null + const isMeasuredGun = MEASURED_GUNS_TYPOLOGIES.includes(typology) - const isAbleToWatchTutorial = securingTutorial === true && confidenceLevel !== 'low' && noCardDetected + const isAbleToWatchTutorial = securingTutorial === true && confidenceLevel !== 'low' if (!isAbleToWatchTutorial) { - return { name: 'IdentificationTypologyResult' } + console.log(isAbleToWatchTutorial) + console.log(isCardDetected) + if (isCardDetected === false && isMeasuredGun === true) { return { name: 'MissingCard' } } else { return { name: 'IdentificationTypologyResult' } } } - const hasNoSecuringOptions = !resultTree[typology].isSecuringOptions && noCardDetected + const hasNoSecuringOptions = !resultTree[typology].isSecuringOptions && !isCardDetected if (hasNoSecuringOptions) { return { name: 'SecuringAchievement' } } - const hasMoreThanOneOptions = resultTree[typology]?.options_step_1 && noCardDetected + const hasMoreThanOneOptions = resultTree[typology]?.options_step_1 && !isCardDetected if (hasMoreThanOneOptions) { return { name: 'SecuringSelectOption', params: { step: 1 } } } - const hasSecuringOptions = resultTree[typology]?.options && noCardDetected + const hasSecuringOptions = resultTree[typology]?.options && !isCardDetected return { name: hasSecuringOptions ? 'SecuringSelectOption' : 'SecuringTutorialContent', ...(hasSecuringOptions ? { params: { step: 1 } } : {}), diff --git a/frontend/src/utils/firearms-utils/index.ts b/frontend/src/utils/firearms-utils/index.ts index f79eb5d7..9be54c2b 100644 --- a/frontend/src/utils/firearms-utils/index.ts +++ b/frontend/src/utils/firearms-utils/index.ts @@ -84,10 +84,17 @@ export const identificationRoutePathsWithArmeAlarme = [ ] as const export const ALARM_GUNS_TYPOLOGIES = ['pistolet_semi_auto_moderne', 'revolver'] +export const MEASURED_GUNS_TYPOLOGIES = [ + 'epaule_a_levier_sous_garde', + 'epaule_a_pompe', + 'epaule_a_un_coup_par_canon', + 'epaule_a_verrou', + 'epaule_semi_auto_style_chasse', +] export const DISCLAIMERS = { - epaule_a_levier_verrou: 'Si la capacité est supérieure à 11 munitions, ou si le canon est lisse : Catégorie B. Si le canon est rayé : Catégorie C.', + epaule_a_levier_verrou: '', semi_auto_style_chasse: 'Si la capacité est supérieure à 3 munitions, ou si le canon est lisse : Catégorie B. Si le canon est rayé : Catégorie C.', epaule_a_pompe: 'Attention : Si la capacité maximale (chambre comprise) est supérieure à 5, ou si la crosse n’est pas fixe, ou si le canon est lisse : Catégorie B.', epaule_semi_auto_style_militaire: 'Attention : Si à l’origine l’arme était à répétition automatique puis a été transformée en arme semi automatique, alors elle est de catégorie A. Si l’arme possède une crosse rétractable / pliable et qu’en configuration la plus courte elle mesure moins de 60 cm : Catégorie A.', - alarm_guns: 'Les armes d’alarmes sont susceptibles d’être modifiées pour tirer des munitions létales. Pour des raisons de sécurité, faites si possible expertiser l’arme.', + alarm_guns: 'Les armes d’alarmes sont susceptibles d’être modifiées pour tirer des munitions létales. Pour des raisons de sécurité, faites si possible expertiser l’arme.', } diff --git a/frontend/src/views/GuideIdentificationFirearm/IdentificationBlankGun.vue b/frontend/src/views/GuideIdentificationFirearm/IdentificationBlankGun.vue index 4eaf82ba..0d349c9d 100644 --- a/frontend/src/views/GuideIdentificationFirearm/IdentificationBlankGun.vue +++ b/frontend/src/views/GuideIdentificationFirearm/IdentificationBlankGun.vue @@ -97,8 +97,8 @@ const alarmGunsOptions = alarmGuns.options.filter(gun => gun.typology === result type="radio" name="armeAlarme" @input="stepsStore.selectedAlarmGun = ''" - > -