-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update after changes in design + finish TODO comments
- Loading branch information
1 parent
8d23a08
commit 95d403e
Showing
48 changed files
with
2,831 additions
and
1,021 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
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
libs/api/domains/secondary-school/src/lib/graphql/main.resolver.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
80 changes: 80 additions & 0 deletions
80
...es/src/lib/modules/templates/secondary-school/emailGenerators/applicationRejectedEmail.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,80 @@ | ||
import { SecondarySchoolAnswers } from '@island.is/application/templates/secondary-school' | ||
import { Message } from '@island.is/email-service' | ||
import { EmailTemplateGeneratorProps } from '../../../../types' | ||
import { EmailRecipient } from '../types' | ||
import { pathToAsset } from '../utils' | ||
import { ApplicationConfigurations } from '@island.is/application/types' | ||
|
||
export type ApplicationRejectedEmail = ( | ||
props: EmailTemplateGeneratorProps, | ||
recipient: EmailRecipient, | ||
) => Message | ||
|
||
export const generateApplicationRejectedEmail: ApplicationRejectedEmail = ( | ||
props, | ||
recipient, | ||
): Message => { | ||
const { | ||
application, | ||
options: { email, clientLocationOrigin }, | ||
} = props | ||
const answers = application.answers as SecondarySchoolAnswers | ||
|
||
if (!recipient.email) throw new Error('Recipient email was undefined') | ||
|
||
const applicantName = answers.applicant.name | ||
const applicantNationalId = answers.applicant.nationalId | ||
|
||
const subject = 'Umsókn um framhaldsskóla - Umsókn eydd' | ||
|
||
const message = | ||
`<span>Umsókn nemandans</span><br/>` + | ||
`<span>${applicantName}, kt. ${applicantNationalId}</span><br/>` + | ||
`<span>um nám í framhaldsskóla hefur verið eytt.</span><br/>` + | ||
`<span>Þú getur farið inn á mínar síður og skoðað sögu umsóknarinnar.</span>` | ||
|
||
return { | ||
from: { | ||
name: email.sender, | ||
address: email.address, | ||
}, | ||
to: [{ name: recipient.name, address: recipient.email }], | ||
subject, | ||
template: { | ||
title: subject, | ||
body: [ | ||
{ | ||
component: 'Image', | ||
context: { | ||
src: pathToAsset('logo.jpg'), | ||
alt: 'Ísland.is logo', | ||
}, | ||
}, | ||
{ | ||
component: 'Image', | ||
context: { | ||
src: pathToAsset('computerIllustration.jpg'), | ||
alt: 'Kaffi við skjá myndskreyting', | ||
}, | ||
}, | ||
{ | ||
component: 'Heading', | ||
context: { copy: subject }, | ||
}, | ||
{ | ||
component: 'Copy', | ||
context: { | ||
copy: message, | ||
}, | ||
}, | ||
{ | ||
component: 'Button', | ||
context: { | ||
copy: 'Skoða umsókn', | ||
href: `${clientLocationOrigin}/${ApplicationConfigurations.SecondarySchool.slug}/${application.id}`, | ||
}, | ||
}, | ||
], | ||
}, | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
...s/src/lib/modules/templates/secondary-school/emailGenerators/applicationSubmittedEmail.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,80 @@ | ||
import { SecondarySchoolAnswers } from '@island.is/application/templates/secondary-school' | ||
import { Message } from '@island.is/email-service' | ||
import { EmailTemplateGeneratorProps } from '../../../../types' | ||
import { EmailRecipient } from '../types' | ||
import { pathToAsset } from '../utils' | ||
import { ApplicationConfigurations } from '@island.is/application/types' | ||
|
||
export type ApplicationSubmittedEmail = ( | ||
props: EmailTemplateGeneratorProps, | ||
recipient: EmailRecipient, | ||
) => Message | ||
|
||
export const generateApplicationSubmittedEmail: ApplicationSubmittedEmail = ( | ||
props, | ||
recipient, | ||
): Message => { | ||
const { | ||
application, | ||
options: { email, clientLocationOrigin }, | ||
} = props | ||
const answers = application.answers as SecondarySchoolAnswers | ||
|
||
if (!recipient.email) throw new Error('Recipient email was undefined') | ||
|
||
const applicantName = answers.applicant.name | ||
const applicantNationalId = answers.applicant.nationalId | ||
|
||
const subject = 'Umsókn um framhaldsskóla - Umsókn send' | ||
|
||
const message = | ||
`<span>Umsókn nemandans</span><br/>` + | ||
`<span>${applicantName}, kt. ${applicantNationalId}</span><br/>` + | ||
`<span>í framhaldsskóla hefur verið móttekin.</span><br/>` + | ||
`<span>Þú getur farið inn á mínar síður og fylgst með framgangi umsóknarinnar.</span>` | ||
|
||
return { | ||
from: { | ||
name: email.sender, | ||
address: email.address, | ||
}, | ||
to: [{ name: recipient.name, address: recipient.email }], | ||
subject, | ||
template: { | ||
title: subject, | ||
body: [ | ||
{ | ||
component: 'Image', | ||
context: { | ||
src: pathToAsset('logo.jpg'), | ||
alt: 'Ísland.is logo', | ||
}, | ||
}, | ||
{ | ||
component: 'Image', | ||
context: { | ||
src: pathToAsset('computerIllustration.jpg'), | ||
alt: 'Kaffi við skjá myndskreyting', | ||
}, | ||
}, | ||
{ | ||
component: 'Heading', | ||
context: { copy: subject }, | ||
}, | ||
{ | ||
component: 'Copy', | ||
context: { | ||
copy: message, | ||
}, | ||
}, | ||
{ | ||
component: 'Button', | ||
context: { | ||
copy: 'Skoða umsókn', | ||
href: `${clientLocationOrigin}/${ApplicationConfigurations.SecondarySchool.slug}/${application.id}`, | ||
}, | ||
}, | ||
], | ||
}, | ||
} | ||
} |
Binary file added
BIN
+25 KB
...ules/templates/secondary-school/emailGenerators/assets/computerIllustration.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.82 KB
...ules/src/lib/modules/templates/secondary-school/emailGenerators/assets/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
.../template-api-modules/src/lib/modules/templates/secondary-school/emailGenerators/index.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,2 @@ | ||
export * from './applicationSubmittedEmail' | ||
export * from './applicationRejectedEmail' |
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
Oops, something went wrong.