Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/code4romania/teo into de…
Browse files Browse the repository at this point in the history
…velop
  • Loading branch information
Birloi Florian authored and Birloi Florian committed Feb 27, 2024
2 parents 181f27a + 35fb530 commit 4beed2c
Show file tree
Hide file tree
Showing 11 changed files with 1,549 additions and 1,454 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
*.iml
4 changes: 2 additions & 2 deletions backend/src/common/constants/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export type QUEUES_TYPES = 'MAILS' | 'PUSH_NOTIFICATIONS_TICKETS'; // Union type

export const QUEUES: Record<QUEUES_TYPES, string> = {
MAILS: 'mails',
PUSH_NOTIFICATIONS_TICKETS: 'push-notifications-tickets',
MAILS: 'mails-vic',
PUSH_NOTIFICATIONS_TICKETS: 'push-notifications-tickets-vic',
};

export const DATE_CONSTANTS = {
Expand Down
28 changes: 14 additions & 14 deletions backend/src/common/constants/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,47 @@ export const NOTIFICATIONS = {
PUSH: {
title: 'TEO',
body: (organizationName: string): string =>
`Cerearea de inscriere in organizatia ${organizationName} a fost aprobata`,
`Cererea de înscriere în organizația ${organizationName} a fost aprobată`,
},
EMAIL: {
subject: (organizationName: string): string =>
`Cerearea de inscriere in organizatia ${organizationName} a fost aprobata`,
`Cererea de înscriere în organizația ${organizationName} a fost aprobată`,
body: '',
},
},
REJECT_ACCESS_REQUEST: {
PUSH: {
title: 'TEO',
body: (organizationName: string): string =>
`Cerearea de inscriere in organizatia ${organizationName} a fost respinsa`,
`Cererea de înscriere în organizația ${organizationName} a fost respinsă`,
},
EMAIL: {
subject: (organizationName: string): string =>
`Cerearea de inscriere in organizatia ${organizationName} a fost respinsa`,
`Cererea de înscriere în organizația ${organizationName} a fost respinsă`,
body: '',
},
},
ARCHIVE_VOLUNTEER: {
PUSH: {
title: 'TEO',
body: (organizationName: string): string =>
`${organizationName} a dezactivat contul tau din organizatie. Pentru detalii te rugăm să contactezi direct organizația. `,
`${organizationName} a dezactivat contul tău din organizație. Pentru detalii te rugăm să contactezi direct organizația.`,
},
EMAIL: {
subject: (organizationName: string): string =>
`${organizationName} a dezactivat contul tau din organizatie. Pentru detalii te rugăm să contactezi direct organizația. `,
`${organizationName} a dezactivat contul tău din organizație. Pentru detalii te rugăm să contactezi direct organizația.`,
body: '',
},
},
NEW_EVENT: {
PUSH: {
title: 'TEO',
body: (organizationName: string): string =>
`Organizatia ${organizationName} a adaugat un eveniment nou`,
`Organizația ${organizationName} a adăugat un eveniment nou`,
},
EMAIL: {
subject: (organizationName: string): string =>
`Organizatia ${organizationName} a adaugat un eveniment nou`,
`Organizația ${organizationName} a adăugat un eveniment nou`,
body: '',
},
},
Expand All @@ -65,35 +65,35 @@ export const NOTIFICATIONS = {
PUSH: {
title: 'TEO',
body: (organizationName: string): string =>
`${organizationName} ți-a generat contractul de voluntariat. Intră în app și descarcă documentul.`,
`${organizationName} ți-a generat contractul de voluntariat. Intră în aplicație și descarcă documentul.`,
},
EMAIL: {
subject: (organizationName: string): string =>
`${organizationName} ți-a generat contractul de voluntariat. Intră în app și descarcă documentul.`,
`${organizationName} ți-a generat contractul de voluntariat. Intră în aplicație și descarcă documentul.`,
body: '',
},
},
REJECT_CONTRACT: {
PUSH: {
title: 'TEO',
body: (organizationName: string, reason: string): string =>
`Contractul tau cu ${organizationName} a fost respins. Motiv: ${reason}`,
`Contractul tău cu ${organizationName} a fost respins. Motiv: ${reason}`,
},
EMAIL: {
subject: (organizationName: string, reason: string): string =>
`Contractul tau cu ${organizationName} a fost respins. Motiv: ${reason}`,
`Contractul tău cu ${organizationName} a fost respins. Motiv: ${reason}`,
body: '',
},
},
APPROVE_CONTRACT: {
PUSH: {
title: 'TEO',
body: (organizationName: string): string =>
`Contractul tau cu ${organizationName} a fost aprobat. Descarca documentul direct din aplicatie`,
`Contractul tău cu ${organizationName} a fost aprobat. Descarcă documentul direct din aplicație`,
},
EMAIL: {
subject: (organizationName: string): string =>
`Contractul tau cu ${organizationName} a fost respins. Descarca documentul direct din aplicatie`,
`Contractul tău cu ${organizationName} a fost respins. Descarcă documentul direct din aplicație`,
body: '',
},
},
Expand Down
8 changes: 7 additions & 1 deletion backend/src/infrastructure/config/email-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class EmailConfigService {
preview: true,
template: {
dir: __dirname + '/../../modules/mail/templates',
adapter: new HandlebarsAdapter(),
adapter: new HandlebarsAdapter({ asset_url: this.createAssetUrl }),
options: {
strict: true,
},
Expand All @@ -40,4 +40,10 @@ export class EmailConfigService {
},
};
}

createAssetUrl = (assetName: string): string => {
return `https://${this.configService.get(
'AWS_S3_BUCKET_NAME_PUBLIC',
)}/${assetName}`;
};
}
4 changes: 4 additions & 0 deletions backend/src/modules/mail/services/mail.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class MailService {
from,
template: './mail-template',
...email,
context: {
...email.context,
contactEmail: process.env.MAIL_CONTACT, // To make available the variable to all templates, especially the partials (header and footer)
},
});
}
}
9 changes: 7 additions & 2 deletions backend/src/modules/mail/templates/mail-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
}
#content {
padding: 1rem 5rem;
padding: 1rem 1.5rem;
}
</style>
</head>
Expand All @@ -67,7 +67,12 @@
<div id="content">
<h1>{{title}}</h1>
<p class="p1">{{subtitle}}</p>
{{> faq-tc}}
{{#if cta}}
<a href={{cta.link}} target="_blank">
<button type="button">{{cta.label}}</button>
</a>
{{/if}}
{{!-- {{> faq-tc}} --}}
</div>
{{> footer}}
</div>
Expand Down
97 changes: 83 additions & 14 deletions backend/src/modules/mail/templates/partials/footer.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,84 @@
<style>
.footer-container { background-color: #000000; color: #ffffff; display: flex;
flex-direction: column; align-items: center; padding: 1.5rem 5rem; }
.disclaimer { color: #6B7280; } .flex-row { display: flex; flex-direction:
row; } .icon { margin: 0 1rem; } .cg-1 { column-gap: 1rem; } .rg-2 { row-gap:
1.5rem; } .w-full { width: 100%; } .items-center { align-items: center; }
.justify-center { justify-content: center; } #divider { width: 100%; height:
1px; background: #FFFFFF; } #social { display: flex; flex-direction: row; }
</style>
<div class='footer-container rg-2'>
<p class='p2 text-center w-full'>Dacă vrei să iei legătura cu noi o poți face
pe e-mail la adresa: [email protected]
<div
style='background-color: #000000; color: #ffffff !important; padding: 1.5rem 1.5rem; width: 100%;'
>
<table
style='width: 80%; border: none; margin-left: auto; margin-right: auto; padding-bottom: 1rem'
>
<tr>
<td>
<p style='color: #ffffff !important; font-size: 0.75rem'>
Soluție proiectată, dezvoltată și administrată pro-bono de
</p>
</td>
<td>
<img
class='logo'
style='width:140px'
src={{asset_url 'email/logo.png'}}
/>
</td>
</tr>
</table>

<div style='width: 100%; height: 1px; background: #ffffff'></div>

<p
style='
text-align: center;
width: 100%;
color: #ffffff !important;
font-size: 0.75rem;
margin-top: 1.5rem
'
>
Dacă vrei să iei legătura cu noi o poți face pe e-mail la adresa:
<a
style='color: #ffffff !important; font-size: 0.75rem;'
href='mailto:{{contactEmail}}'
>{{contactEmail}}</a>
</p>
<p class='p2 disclaimer text-center'>© 2020 Code4Romania. All rights reserved.</p>
</div>

<table
style='width: 50%; border: none; margin-left: auto; margin-right: auto; padding-top: 1rem'
>
<tr>
<td style='width: 30px; height: 30px'>
<a
style='text-decoration: none; color: #1a15ea'
href='https://www.facebook.com/code4romania/'
target='_blank'
>
<img class='icon' src={{asset_url 'email/social/facebook.png'}} />
</a>
</td>
<td style='width: 30px; height: 30px'>
<a
style='text-decoration: none; color: #1a15ea'
href='https://www.instagram.com/code4romania'
target='_blank'
>
<img class='icon' src={{asset_url 'email/social/instagram.png'}} />
</a>
</td>
<td style='width: 30px; height: 30px'>
<a
style='text-decoration: none; color: #1a15ea'
href='https://www.youtube.com/@codeforromania5856'
target='_blank'
>
<img class='icon' src={{asset_url 'email/social/youtube.png'}} />
</a>
</td>
<td style='width: 30px; height: 30px'>
<a
style='text-decoration: none; color: #1a15ea'
href='https://github.com/code4romania/'
target='_blank'
>
<img class='icon' src={{asset_url 'email/social/github.png'}} />
</a>
</td>
</tr>
</table>
</div>
`
3 changes: 2 additions & 1 deletion backend/src/modules/mail/templates/partials/header.hbs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<div style='width: 100%; height: 50px; background-color: turquoise'>
<div style='width: 100%; background-color: black; padding: 1rem 1.5rem;'>
<img src={{asset_url 'email/vic-logo.png'}} />
</div>
10 changes: 5 additions & 5 deletions frontend/src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@
"label": "Choose tasks",
"tasks": "Tasks",
"required": "The choice of tasks is mandatory.",
"helper": "Lorem ipsum. Choose from the list"
"helper": "Choose from the list"
},
"observation": {
"title": "Remark (only visible to administrator)",
Expand Down Expand Up @@ -587,7 +587,7 @@
"pending_header": "{{hours}} hours pending approval",
"past": "History of volunteer hours",
"past_header": "{{hours}} volunteer hours approved, {{rejected}} rejected",
"description": "Lorem ipsum. View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years).",
"description": "View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years).",
"add": "Add hours",
"header": {
"task": "Task",
Expand Down Expand Up @@ -793,7 +793,7 @@
},
"documents": {
"title": "Volunteer contracts",
"description": "Lorem ipsum. View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years).",
"description": "View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years).",
"templates": {
"table": {
"header": {
Expand Down Expand Up @@ -941,7 +941,7 @@
},
"delete_modal": {
"title": "Are you sure you want to delete this contract?",
"description": "Lorem ipsum. View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years)."
"description": "View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years)."
},
"submit": {
"confirm": "The contract has been confirmed",
Expand All @@ -956,7 +956,7 @@
},
"upload": {
"title": "Upload signed contract",
"description": "Lorem ipsum. View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years)."
"description": "View the list of all your volunteer contracts in TEO. The volunteer contract has a predefined structure. You can create multiple contract templates (e.g. volunteer contract &gt;16 years, volunteer contract &lt;16 years)."
}
},
"popover": {
Expand Down
Loading

0 comments on commit 4beed2c

Please sign in to comment.