Skip to content

Commit

Permalink
Merge pull request #528 from mission-apprentissage/feat/accessibilite…
Browse files Browse the repository at this point in the history
…/controle-saisie

Feat/accessibilite/controle saisie
  • Loading branch information
LucasDetre authored Jan 21, 2025
2 parents 801ffc8 + 0d287fe commit 5adec0d
Show file tree
Hide file tree
Showing 272 changed files with 3,161 additions and 2,084 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@
"unused-imports"
],
"rules": {
"max-len": ["warn", { "code": 120 }],
"max-len": [
"warn",
{
"code": 120,
"ignorePattern": "^import\\s.+\\sfrom\\s.+;$",
"ignoreComments": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true
}
],
"simple-import-sort/imports": "error",
"no-extra-semi": "error",
"semi": ["error", "always"],
Expand Down
2 changes: 2 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ fileignoreconfig:
checksum: b1fa159bb2036a835b4138843b48043eca4ea374bcbb710ba4593bd39b1dfec1
- filename: .infra/vault/vault.yml
checksum: 0577a982f46500c55d62463f34fde72a3e14700b5235f8573cbf870e2452348f
- filename: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
checksum: a663e9955c2825bee3af55be1ebd6e26cd0a17fe7c614a13d726ddd4c7959b82
- filename: README.md
checksum: 00ac991f0b2746c5a5ffa14e2b3c5427b739c0d952aa3730efe1f234ac1fc3ca
- filename: server/.env.test
Expand Down
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ plugins:
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.6.1.cjs
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"node-cache": "^5.1.2",
"nodemailer": "^6.9.15",
"nodemailer-html-to-text": "^3.2.0",
"notion-to-md": "^3.1.1",
"notion-to-md": "^3.1.4",
"openid-client": "^5.6.5",
"pg": "^8.9.0",
"pino": "^9.4.0",
Expand Down
60 changes: 30 additions & 30 deletions server/src/commands.product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,26 @@ export function productCommands(cli: Command) {
}
});

cli
.command("importTensionFranceTravail")
.description("Import des données de tension (national/régional/départemental) depuis France Travail")
.argument("[usecase]")
.action(async (usecaseName: string) => {
const usecases = {
importTensionFranceTravailNational,
importTensionFranceTravailRegion,
importTensionFranceTravailDepartement,
};

if (usecaseName) {
await usecases[usecaseName as keyof typeof usecases]();
} else {
for (const usecase of Object.values(usecases)) {
await usecase();
}
}
});

cli
.command("importTables")
.argument("[usecase]")
Expand Down Expand Up @@ -315,14 +335,17 @@ export function productCommands(cli: Command) {
await refreshViews();
});

cli.command("refreshViews").action(async () => {
await refreshViews();
});

cli.command("importIJ").action(async () => {
await importIJData();
});

cli
.command("importPositionsQuadrant")
.description("Calcul des positions quadrants")
.action(async () => {
await importPositionsQuadrant();
});

cli
.command("importFormations")
.argument("[usecase]")
Expand All @@ -342,30 +365,7 @@ export function productCommands(cli: Command) {
await refreshViews();
});

cli
.command("importTensionFranceTravail")
.description("Import des données de tension (national/régional/départemental) depuis France Travail")
.argument("[usecase]")
.action(async (usecaseName: string) => {
const usecases = {
importTensionFranceTravailNational,
importTensionFranceTravailRegion,
importTensionFranceTravailDepartement,
};

if (usecaseName) {
await usecases[usecaseName as keyof typeof usecases]();
} else {
for (const usecase of Object.values(usecases)) {
await usecase();
}
}
});

cli
.command("importPositionsQuadrant")
.description("Calcul des positions quadrants")
.action(async () => {
await importPositionsQuadrant();
});
cli.command("refreshViews").action(async () => {
await refreshViews();
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export const localFilePathManagerFactory = (): FilePathManager => {
return `./public/upload/${id}/${filename}`;
},
getFranceTravailIndicateurTensionDepartementStatsFilePath: () => {
return "./public/files/tension_rome_departement.csv";
return "./static/files/tension_rome_departement.csv";
},
getFranceTravailIndicateurTensionRegionStatsFilePath: () => {
return "./public/files/tension_rome_region.csv";
return "./static/files/tension_rome_region.csv";
},
getFranceTravailIndicateurTensionStatsFilePath: () => {
return "./public/files/tension_rome.csv";
return "./static/files/tension_rome.csv";
},
};
};
Expand Down
36 changes: 18 additions & 18 deletions shared/security/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export type Permission = KeyOfUnion<(typeof PERMISSIONS)[keyof typeof PERMISSION

export const PERMISSIONS = {
admin: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
"pilotage_reforme/lecture": { default: "national" },
"intentions/lecture": { default: "national", draft: "national" },
"intentions/ecriture": { default: "national" },
Expand All @@ -24,21 +22,21 @@ export const PERMISSIONS = {
"intentions-perdir-statut/lecture": { default: "national" },
"intentions-perdir-avis/ecriture": { default: "national" },
"intentions-perdir-avis/lecture": { default: "national" },
},
pilote: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
pilote: {
"intentions/lecture": { default: "national", draft: "national" },
"pilotage_reforme/lecture": { default: "national" },
"restitution-intentions/lecture": { default: "national" },
"pilotage-intentions/lecture": { default: "national" },
"intentions-perdir/lecture": { default: "national", draft: "national" },
"intentions-perdir-statut/lecture": { default: "national" },
"intentions-perdir-avis/lecture": { default: "national" },
},
admin_region: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
admin_region: {
"intentions/lecture": { default: "national", draft: "national" },
"intentions/ecriture": { default: "region", draft: "region" },
"restitution-intentions/lecture": { default: "national" },
Expand All @@ -51,21 +49,21 @@ export const PERMISSIONS = {
"intentions-perdir-statut/lecture": { default: "region" },
"intentions-perdir-avis/ecriture": { default: "region" },
"intentions-perdir-avis/lecture": { default: "region" },
},
region: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
region: {
"intentions/lecture": { default: "region", draft: "region" },
"restitution-intentions/lecture": { default: "region" },
"pilotage-intentions/lecture": { default: "national" },
"intentions-perdir/lecture": { default: "region", draft: "region" },
"intentions-perdir-statut/lecture": { default: "region" },
"intentions-perdir-avis/ecriture": { default: "region" },
"intentions-perdir-avis/lecture": { default: "region" },
},
pilote_region: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
pilote_region: {
"intentions/lecture": { default: "national", draft: "national" },
"intentions/ecriture": { default: "region", draft: "region" },
"restitution-intentions/lecture": { default: "national" },
Expand All @@ -76,10 +74,10 @@ export const PERMISSIONS = {
"intentions-perdir-statut/lecture": { default: "region" },
"intentions-perdir-avis/ecriture": { default: "region" },
"intentions-perdir-avis/lecture": { default: "region" },
},
gestionnaire_region: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
gestionnaire_region: {
"intentions/lecture": { default: "region", draft: "region" },
"intentions/ecriture": { default: "region", draft: "region" },
"restitution-intentions/lecture": { default: "region" },
Expand All @@ -90,37 +88,39 @@ export const PERMISSIONS = {
"intentions-perdir-statut/lecture": { default: "region" },
"intentions-perdir-avis/ecriture": { default: "region" },
"intentions-perdir-avis/lecture": { default: "region" },
},
expert_region: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
expert_region: {
"intentions/lecture": { default: "region", draft: "region" },
"restitution-intentions/lecture": { default: "region" },
"pilotage-intentions/lecture": { default: "national" },
"intentions-perdir/lecture": { default: "region", draft: "region" },
"intentions-perdir-statut/lecture": { default: "region" },
"intentions-perdir-avis/ecriture": { default: "region" },
"intentions-perdir-avis/lecture": { default: "region" },
},
perdir: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
perdir: {
"intentions/lecture": { default: "uai", draft: "uai" },
"intentions-perdir/lecture": { default: "uai", draft: "uai" },
"intentions-perdir/ecriture": { default: "uai", draft: "uai" },
"restitution-intentions/lecture": { default: "uai" },
"pilotage-intentions/lecture": { default: "uai" },
"intentions-perdir-statut/lecture": { default: "uai" },
"intentions-perdir-avis/lecture": { default: "uai" },
},
invite: {
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
invite: {
"intentions/lecture": { default: "role", draft: "role" },
"restitution-intentions/lecture": { default: "role" },
"intentions-perdir/lecture": { default: "region", draft: "region" },
"intentions-perdir-statut/lecture": { default: "region" },
"intentions-perdir-avis/lecture": { default: "region" },
"enregistrement-requete/lecture": { default: "national" },
"enregistrement-requete/ecriture": { default: "national" },
},
} satisfies {
[R: string]: {
Expand Down
1 change: 1 addition & 0 deletions shared/utils/emailRegex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
// ignore eslint rule no-control-regex
/* eslint-disable no-control-regex */
export const emailRegex =
// eslint-disable-next-line max-len
/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
14 changes: 12 additions & 2 deletions ui/app/(wrapped)/admin/campagnes/CreateCampagne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const CreateCampagne = ({ isOpen, onClose }: { isOpen: boolean; onClose:
{!!errors.statut && <FormErrorMessage>{errors.statut.message}</FormErrorMessage>}
</FormControl>
<FormControl mb="4" isInvalid={!!errors.dateDebut} isRequired>
<FormLabel>Date début</FormLabel>
<FormLabel htmlFor="input-date-debut">Date début</FormLabel>
<SingleDatepicker
date={getValues("dateDebut") ? toDate(getValues("dateDebut")) : undefined}
onDateChange={(date) => {
Expand All @@ -134,11 +134,16 @@ export const CreateCampagne = ({ isOpen, onClose }: { isOpen: boolean; onClose:
}}
maxDate={getValues("dateFin") ? toDate(getValues("dateFin")) : undefined}
configs={getDatePickerConfig()}
propsConfigs={{
inputProps: {
id: "input-date-debut",
},
}}
/>
{!!errors.dateDebut && <FormErrorMessage>{errors.dateDebut.message}</FormErrorMessage>}
</FormControl>
<FormControl mb="4" isInvalid={!!errors.dateFin} isRequired>
<FormLabel>Date de fin</FormLabel>
<FormLabel htmlFor="input-date-fin">Date de fin</FormLabel>
<SingleDatepicker
date={getValues("dateFin") ? toDate(getValues("dateFin")) : undefined}
onDateChange={(date) => {
Expand All @@ -148,6 +153,11 @@ export const CreateCampagne = ({ isOpen, onClose }: { isOpen: boolean; onClose:
}}
minDate={getValues("dateDebut") ? toDate(getValues("dateDebut")) : undefined}
configs={getDatePickerConfig()}
propsConfigs={{
inputProps: {
id: "input-date-fin",
},
}}
/>
{!!errors.dateFin && <FormErrorMessage>{errors.dateFin.message}</FormErrorMessage>}
</FormControl>
Expand Down
1 change: 1 addition & 0 deletions ui/app/(wrapped)/admin/campagnes/EditCampagne.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const EditCampagne = ({

useEffect(() => {
reset(campagne, { keepDefaultValues: true });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen, reset]);

const queryClient = useQueryClient();
Expand Down
14 changes: 7 additions & 7 deletions ui/app/(wrapped)/admin/campagnes/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ export default () => {
</Button>
</Flex>
<TableContainer overflowY="auto" flex={1}>
<Table sx={{ td: { py: "2", px: 4 }, th: { px: 4 } }} size="md" fontSize="14px" gap="0">
<Table sx={{ td: { py: "2", px: 4 }, th: { px: 4 } }} size="md" fontSize={14} gap="0">
<Thead position="sticky" top="0" boxShadow="0 0 6px 0 rgb(0,0,0,0.15)" bg="white">
<Tr>
<Th width={"10%"}>Id</Th>
<Th>Année</Th>
<Th textAlign={"center"}>Statut</Th>
<Th width={"10%"}>Date de début</Th>
<Th width={"10%"}>Date de fin</Th>
<Th width={"5%"} isNumeric>
<Th width={"10%"} fontSize={12}>Id</Th>
<Th fontSize={12}>Année</Th>
<Th textAlign={"center"} fontSize={12}>Statut</Th>
<Th width={"10%"} fontSize={12}>Date de début</Th>
<Th width={"10%"} fontSize={12}>Date de fin</Th>
<Th width={"5%"} isNumeric fontSize={12}>
Actions
</Th>
</Tr>
Expand Down
8 changes: 4 additions & 4 deletions ui/app/(wrapped)/admin/roles/components/PermissionBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const PermissionBadge = ({ rights, scope }: { rights: string[]; scope: Scope })

if (rights.length === 0) {
return (
<Badge variant="grey" size="md">
<Badge variant="grey" size="md" fontSize={12}>
<Box pr="4px">
<Icon icon="ri:eye-off-fill" />
</Box>
Expand All @@ -51,7 +51,7 @@ const PermissionBadge = ({ rights, scope }: { rights: string[]; scope: Scope })
if (rights.includes("lecture")) {
i++;
icons.push(
<Box pr="4px" key={`${i}-permission-badge-icon`}>
<Box pr="4px" key={`${i}-permission-badge-icon`} fontSize={12}>
<Icon icon="ri:eye-fill" />
</Box>
);
Expand All @@ -60,14 +60,14 @@ const PermissionBadge = ({ rights, scope }: { rights: string[]; scope: Scope })
if (rights.includes("ecriture")) {
i++;
icons.push(
<Box pr="4px" key={`${i}-permission-badge-icon`}>
<Box pr="4px" key={`${i}-permission-badge-icon`} fontSize={12}>
<Icon icon="ri:pencil-fill" />
</Box>
);
}

return (
<Badge variant={getVariant()} size="md">
<Badge variant={getVariant()} size="md" fontSize={12}>
{icons} {formatScopeLabel(scope)}
</Badge>
);
Expand Down
Loading

0 comments on commit 5adec0d

Please sign in to comment.