Skip to content

Commit

Permalink
feat(lba-705): maj templates de réponses à un candidat (#1676)
Browse files Browse the repository at this point in the history
* feat: wip nouvelle version

* feat: ajout coordonnées candidats dans sujet

* feat: cc, subject et autres

* feat: ajout du traitement de partenaire dans le texte

* feat: ajustements pictos

* feat: ok success

* feat: clean en passant

* feat: prise en compte école / entreprise

* feat: détection CFA ENTREPRISE

* fix: copié raté

* feat: suppression bouton ne sais pas

* feat: suppression bouton ne sais pas

* feat: suppression lien

* feat: wording

* feat: métier optionnel

* fix: oubli

* feat: wording

* feat: gestion des sauts de lignes

* feat: mieux en sauvegardant

* fix: partenaire dans réponse positive

* MAJ utm email recruteur candid spont

* Update mail-candidat-entretien.mjml.ejs

Je supprime cette ligne car en visualisant l'email, comme le point est dans un span dédié, cela crée un grand espace entre le pouce et le point et c'est étrange.
Je le signale à Claire pour supprimer le point de la maquette

---------

Co-authored-by: guilletmarion <[email protected]>
  • Loading branch information
alanlr and guilletmarion authored Dec 2, 2024
1 parent 1bbdfba commit 57716db
Show file tree
Hide file tree
Showing 8 changed files with 492 additions and 183 deletions.
14 changes: 6 additions & 8 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
fileignoreconfig:
- filename: .infra/vault/vault.yml
checksum: 40717e8b277d9c9812c89d62fd3e09d0d70cdd0bb76a460f09486a31b6dd9cc7
- filename: server/src/jobs/brevoContacts/sendContactsToBrevo.ts
checksum: cdb19cf5444adabf94cdac26c3f458415c633d35fdc523608ee0e1c0eab7feb1
- filename: server/src/services/formulaire.service.test.ts
checksum: a263b92a95e69de7efb856d73122b8f05ef98140c96dd0212213f26dce85056e
- filename: shared/routes/v3/jobs/jobs.routes.v3.model.ts
checksum: 94f2736d7791571d7888a50f53e36e2af246f22c1c832b85477c34cb5328af0d
- filename: cypress/e2e/manual/create-many-applications.cy.ts
checksum: 752e2ab70ab367400bc0e831904b09e3bb131fdfaafb8c38aff89393414f62c5
- filename: cypress/pages/FlowAdminPage.ts
Expand Down Expand Up @@ -51,6 +45,8 @@ fileignoreconfig:
checksum: 0eb3948d875508edf6d31f0ffe1290aac0cc02c9c80c913bcb04a312edd062cc
- filename: server/src/http/sentry.ts
checksum: 4e555f9ed2542b3852a3d8e27cf7805375b78dbd724b20f337be186f754144c0
- filename: server/src/jobs/brevoContacts/sendContactsToBrevo.ts
checksum: cdb19cf5444adabf94cdac26c3f458415c633d35fdc523608ee0e1c0eab7feb1
- filename: server/src/jobs/database/obfuscateCollections.ts
checksum: e00973a1dcdd3af56c176f07d642b18956d21c2034ca49f1b0e3d670ed09782b
- filename: server/src/jobs/job.actions.ts
Expand Down Expand Up @@ -100,15 +96,15 @@ fileignoreconfig:
- filename: server/static/templates/mail-bienvenue.mjml.ejs
checksum: 34eb30b463153df565aa89f8e42f08eb77633b6bfa4673f4d6ef5f40633c6101
- filename: server/static/templates/mail-candidat-entretien.mjml.ejs
checksum: 55e635282f6a7ac57319c69cbc98f484b9c5d7e6c4ba0901e1e5395caac9e8cd
checksum: 53067858567e2878f5f65da06be9efc6902a691b36299167d54343ab30162e49
- filename: server/static/templates/mail-candidat-nsp.mjml.ejs
checksum: 203d57160c0cda492f4172d9651c2dea9b8d7b4b3ab0e25f80a24438e3f1e184
- filename: server/static/templates/mail-candidat-offre-emploi-lba.mjml.ejs
checksum: 3188f43c847d071acfb7a366748647ab88d821abb3e022830b82fd092db90f83
- filename: server/static/templates/mail-candidat-recruteur-lba.mjml.ejs
checksum: 0b806bca197dba97415902339e84f924cb45dae766cf8d3cfc47d80d2bdd203c
- filename: server/static/templates/mail-candidat-refus.mjml.ejs
checksum: 7e912b174e33f96f0fbb180bdb5d04d92951c2db880ab147eba395a24c74ae87
checksum: 3fcfa9586df3283a3f50cf6751b735b646d3f3ac64e8e4a8453999e9e5aea881
- filename: server/static/templates/mail-echec-envoi-candidature.mjml.ejs
checksum: 9055c5495ced85a674770e7fb8a81b3bd84949f9ff8f6e6450989aa3b7cda326
- filename: server/tests/fixture/connectedUser.fixture.ts
Expand Down Expand Up @@ -171,6 +167,8 @@ fileignoreconfig:
checksum: aa0fb2458520f24921a48af03ad05c3f4a92052374182851f24a3afa7421a5b8
- filename: shared/routes/v3/jobs/jobs.routes.v3.model.test.ts
checksum: f4f3e429e6a7871a218f19eead273c0477636ed3c19b9e4dfd9e55bde1bc7dc8
- filename: shared/routes/v3/jobs/jobs.routes.v3.model.ts
checksum: 94f2736d7791571d7888a50f53e36e2af246f22c1c832b85477c34cb5328af0d
- filename: shared/utils/objectUtils.ts
checksum: cfd0e48e8762b43c6431dad873727f6ac091ca6f5c7555e37a8ee3fba03184d1
- filename: ui/common/hooks/useAuth.ts
Expand Down
50 changes: 42 additions & 8 deletions server/src/services/application.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { ApplicantIntention } from "shared/constants/application"
import { BusinessErrorCodes } from "shared/constants/errorCodes"
import { LBA_ITEM_TYPE, LBA_ITEM_TYPE_OLD, getDirectJobPath, newItemTypeToOldItemType } from "shared/constants/lbaitem"
import { RECRUITER_STATUS } from "shared/constants/recruteur"
import { CFA, ENTREPRISE, RECRUITER_STATUS } from "shared/constants/recruteur"
import { prepareMessageForMail, removeUrlsFromText } from "shared/helpers/common"
import { ITrackingCookies } from "shared/models/trafficSources.model"
import { IUserWithAccount } from "shared/models/userWithAccount.model"
Expand Down Expand Up @@ -54,6 +54,11 @@ const publicUrl = config.publicUrl

const imagePath = `${config.publicUrl}/images/emails/`

const PARTNER_NAMES = {
oc: "OpenClassrooms",
"1jeune1solution": "1jeune1solution",
}

const images: object = {
images: {
logoLba: `${imagePath}logo_LBA.png`,
Expand Down Expand Up @@ -409,7 +414,6 @@ const buildRecruiterEmailUrls = async (application: IApplication) => {
const urls = {
jobUrl: "",
meetCandidateUrl: buildReplyLink(application, ApplicantIntention.ENTRETIEN, userForToken),
waitCandidateUrl: buildReplyLink(application, ApplicantIntention.NESAISPAS, userForToken),
refuseCandidateUrl: buildReplyLink(application, ApplicantIntention.REFUS, userForToken),
lbaRecruiterUrl: `${config.publicUrl}/acces-recruteur?${utmRecruiterData}-acces-recruteur`,
unsubscribeUrl: `${config.publicUrl}/desinscription?application_id=${createToken({ application_id: application._id }, "30d", "desinscription")}${utmRecruiterData}-desinscription`,
Expand Down Expand Up @@ -692,6 +696,16 @@ const checkUserApplicationCountV2 = async (applicantEmail: string, LbaJob: IJobO
}
}

const getJobSourceType = async (application: IApplication) => {
if (LBA_ITEM_TYPE.OFFRES_EMPLOI_LBA === application.job_origin && application.job_id) {
const recruiter = await getDbCollection("recruiters").findOne({ "jobs._id": new ObjectId(application.job_id) })
if (recruiter?.cfa_delegated_siret) {
return CFA
}
}

return ENTREPRISE
}
/**
* @description sends notification email to applicant
*/
Expand All @@ -708,31 +722,51 @@ export const sendMailToApplicant = async ({
company_recruitment_intention: string
company_feedback: string
}): Promise<void> => {
const partner = (application.caller && PARTNER_NAMES[application.caller]) ?? null
const jobSourceType: string = await getJobSourceType(application)

switch (company_recruitment_intention) {
case ApplicantIntention.ENTRETIEN: {
mailer.sendEmail({
to: application.applicant_email,
subject: `Réponse positive de ${application.company_name}`,
cc: email!,
subject: `Réponse positive de ${application.company_name} à la candidature${partner ? ` ${partner}` : ""} de ${application.applicant_first_name} ${application.applicant_last_name}`,
template: getEmailTemplate("mail-candidat-entretien"),
data: { ...sanitizeApplicationForEmail(application), ...images, email, phone: sanitizeForEmail(removeUrlsFromText(phone)), comment: sanitizeForEmail(company_feedback) },
data: {
...sanitizeApplicationForEmail(application),
jobSourceType,
partner,
...images,
email,
phone: sanitizeForEmail(removeUrlsFromText(phone)),
comment: prepareMessageForMail(sanitizeForEmail(company_feedback)),
},
})
break
}
case ApplicantIntention.NESAISPAS: {
mailer.sendEmail({
to: application.applicant_email,
subject: `Réponse de ${application.company_name}`,
cc: email!,
subject: `Réponse de ${application.company_name} à la candidature de ${application.applicant_first_name} ${application.applicant_last_name}`,
template: getEmailTemplate("mail-candidat-nsp"),
data: { ...sanitizeApplicationForEmail(application), ...images, email, phone: sanitizeForEmail(removeUrlsFromText(phone)), comment: sanitizeForEmail(company_feedback) },
data: {
...sanitizeApplicationForEmail(application),
partner,
...images,
email,
phone: sanitizeForEmail(removeUrlsFromText(phone)),
comment: prepareMessageForMail(sanitizeForEmail(company_feedback)),
},
})
break
}
case ApplicantIntention.REFUS: {
mailer.sendEmail({
to: application.applicant_email,
subject: `Réponse négative de ${application.company_name}`,
subject: `Réponse négative de ${application.company_name} à la candidature${partner ? ` ${partner}` : ""} de ${application.applicant_first_name} ${application.applicant_last_name}`,
template: getEmailTemplate("mail-candidat-refus"),
data: { ...sanitizeApplicationForEmail(application), ...images, comment: sanitizeForEmail(company_feedback) },
data: { ...sanitizeApplicationForEmail(application), jobSourceType, partner, ...images, comment: prepareMessageForMail(sanitizeForEmail(company_feedback)) },
})
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@
<mj-section border-radius="0px" css-class="section" name="mj-section_group">
<mj-group>
<mj-column border-radius="0px" css-class="column" vertical-align="middle" width="14.83%">
<mj-image align="left" alt="Image" css-class="image" src="<%= data.images.logoRf %>" width="89px">
<mj-image align="left" alt="" css-class="image" src="<%= data.images.logoRf %>" width="89px">

</mj-image>
</mj-column>
<mj-column border-radius="0px" css-class="column" padding="0px 24px 0px 24px" vertical-align="middle" width="34.83%">
<mj-image align="left" alt="Image" css-class="image" padding="17px 0px 17px 0px" src="<%= data.images.logoLba %>" width="160px">
<mj-image align="left" alt="" css-class="image" padding="17px 0px 17px 0px" src="<%= data.images.logoLba %>" width="160px">

</mj-image>
</mj-column>
Expand Down
Loading

0 comments on commit 57716db

Please sign in to comment.