-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from mission-apprentissage/suppression-demande
Suppression demande
- Loading branch information
Showing
45 changed files
with
601 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,24 +22,15 @@ | |
background-color="#0e4194" | ||
color="white" | ||
> | ||
Lien d'activation | ||
Activer votre compte | ||
</mj-button> | ||
<mj-text> | ||
Concernant la saisie des demandes d’ouverture, fermeture… :<br /> | ||
- vous devez enregistrer la liste des demandes qui seront soumises | ||
au vote du Conseil Régional et non pas toutes les demandes que vous | ||
avez examinées.<br /> | ||
- vous pouvez enregistrer les demandes en mode brouillon ou | ||
soumettre à la validation<br /> | ||
- lorsque la saisie de toutes les demandes pour la Région Académique | ||
sera terminée, l’utilisateur “Pilote” (Recteur ou SGA) devra valider | ||
la liste<br /> | ||
<br /> | ||
Pour toute question, consultez la | ||
<a href="<%= utils.getPublicUrl(`/documentation`) %>"> | ||
documentation dans Orion</a | ||
> | ||
ou contactez-nous.<br /> | ||
ou contactez-nous à l'adresse suivante: | ||
[email protected]<br /> | ||
</mj-text> | ||
<%- include('./common/signature.ejs'); %> | ||
</mj-column> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<mjml> | ||
<%- include('./common/head.ejs'); %> | ||
<mj-body background-color="#f9fafc"> | ||
<%- include('./common/header.ejs'); %> | ||
<mj-wrapper padding="10px 20px"> | ||
<mj-section background-color="#ffffff" padding-top="0"> | ||
<mj-column> | ||
<mj-text> | ||
Bonjour <%= data.recipient.firstname %> <%= data.recipient.lastname | ||
%>,<br /> | ||
<br /> | ||
Orion vous donne accès à différentes données et indicateurs qui | ||
outillent les réflexions autour de la transformation de la carte des | ||
formations professionnelles en voie initiale.<br /> | ||
<br /> | ||
À compter d’aujourd’hui, vous pouvez saisir les demandes | ||
d’ouverture/fermeture de formations dans Orion, ce qui permettra | ||
d’initier le dialogue de gestion avec la DGESCO.<br /> | ||
<br /> | ||
Pour y accéder, activez votre compte en cliquant sur le lien | ||
ci-dessous :<br /> | ||
</mj-text> | ||
<mj-button | ||
href="<%= utils.getPublicUrl(`/auth/activer-compte?activationToken=${data.activationToken}`) %>" | ||
background-color="#0e4194" | ||
color="white" | ||
> | ||
Activer votre compte | ||
</mj-button> | ||
<mj-text> | ||
À venir pour compléter ce module de saisie : | ||
<br /> | ||
<ul> | ||
<li> | ||
Le 16/10, une console d’analyse des demandes enrichie par les | ||
indicateurs InserJeunes ; | ||
</li> | ||
<li> | ||
Le 23/10, une page de pilotage du taux de transformation de la | ||
carte. | ||
</li> | ||
</ul> | ||
</mj-text> | ||
<mj-text> | ||
Si vous rencontrez des problèmes lors de la connexion ou de la | ||
saisie, vous pouvez contacter notre équipe à l’adresse suivante : | ||
[email protected] | ||
</mj-text> | ||
<%- include('./common/signature.ejs'); %> | ||
</mj-column> | ||
</mj-section> | ||
</mj-wrapper> | ||
</mj-body> | ||
</mjml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
server/src/modules/intentions/usecases/deleteDemande/deleteDemande.dep.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { kdb } from "../../../../db/db"; | ||
|
||
export const deleteDemandeQuery = async (id: string) => { | ||
await kdb.deleteFrom("demande").where("id", "=", id).execute(); | ||
}; |
30 changes: 30 additions & 0 deletions
30
server/src/modules/intentions/usecases/deleteDemande/deleteDemande.usecase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Boom from "@hapi/boom"; | ||
import { getPermissionScope, guardScope } from "shared"; | ||
|
||
import { RequestUser } from "../../../core/model/User"; | ||
import { findOneDemande } from "../../repositories/findOneDemande.query"; | ||
import { deleteDemandeQuery } from "./deleteDemande.dep"; | ||
|
||
export const deleteDemandeFactory = | ||
(deps = { findOneDemande, deleteDemandeQuery }) => | ||
async ({ | ||
id, | ||
user, | ||
}: { | ||
id: string; | ||
user: Pick<RequestUser, "id" | "role" | "codeRegion">; | ||
}) => { | ||
const demande = await deps.findOneDemande(id); | ||
if (!demande) throw Boom.notFound(); | ||
|
||
const scope = getPermissionScope(user.role, "intentions/ecriture"); | ||
const isAllowed = guardScope(scope?.default, { | ||
user: () => user.id === demande.createurId, | ||
region: () => user.codeRegion === demande.codeRegion, | ||
national: () => true, | ||
}); | ||
if (!isAllowed) throw Boom.forbidden(); | ||
await deps.deleteDemandeQuery(demande.id); | ||
}; | ||
|
||
export const deleteDemande = deleteDemandeFactory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
ui/app/(wrapped)/intentions/components/ConfirmationDelete.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
AlertDialog, | ||
AlertDialogBody, | ||
AlertDialogContent, | ||
AlertDialogFooter, | ||
AlertDialogOverlay, | ||
Button, | ||
Heading, | ||
Text, | ||
useDisclosure, | ||
} from "@chakra-ui/react"; | ||
import { FC, MouseEventHandler, useRef } from "react"; | ||
|
||
import { ArrowIcon } from "@/components/icons/arrowIcon"; | ||
|
||
export const ConfirmationDelete = ({ | ||
Trigger, | ||
onConfirm, | ||
}: { | ||
Trigger: FC<{ onClick: MouseEventHandler<HTMLButtonElement> }>; | ||
onConfirm: () => Promise<void>; | ||
}) => { | ||
const { isOpen, onOpen, onClose } = useDisclosure(); | ||
const cancelRef = useRef(null); | ||
|
||
return ( | ||
<> | ||
<Trigger onClick={onOpen} /> | ||
<AlertDialog | ||
isOpen={isOpen} | ||
leastDestructiveRef={cancelRef} | ||
onClose={onClose} | ||
size="xl" | ||
isCentered | ||
> | ||
<AlertDialogOverlay> | ||
<AlertDialogContent borderRadius={0}> | ||
<AlertDialogBody> | ||
<Heading fontSize="3xl" mt="6"> | ||
<ArrowIcon mr="2" mb="1" /> | ||
Confirmation de suppression | ||
</Heading> | ||
<Text mt="4"> | ||
Êtes-vous sûr de vouloir supprimer la demande ? | ||
</Text> | ||
<Text mt="4"> | ||
Cette action est irréversible, vous perdrez l’ensemble des | ||
données associées à votre demande. | ||
</Text> | ||
</AlertDialogBody> | ||
|
||
<AlertDialogFooter> | ||
<Button variant="secondary" ref={cancelRef} onClick={onClose}> | ||
Annuler | ||
</Button> | ||
<Button variant="primary" onClick={onConfirm} ml={3}> | ||
Confirmer la suppression | ||
</Button> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialogOverlay> | ||
</AlertDialog> | ||
</> | ||
); | ||
}; |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.