-
Notifications
You must be signed in to change notification settings - Fork 1
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 #415 from NIAEFEUP/feature/custom-mailto
Custom mailto for exchanges and enrollments
- Loading branch information
Showing
6 changed files
with
16 additions
and
33 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 |
---|---|---|
|
@@ -9,7 +9,7 @@ export const AdminSendEmail = ({ | |
nmec | ||
}: Props) => { | ||
return <> | ||
<a href={mailtoStringBuilder(nmec)}> | ||
<a href={`${mailtoStringBuilder(nmec)}?subject=Pedido de Inscrição em Turmas&[email protected]&body=Viva, Foram alocadas turmas nas UCs indicadas. Cmpts, Daniel Silva (pela comissão de inscrição em turmas)`}> | ||
<Button | ||
variant="secondary" | ||
> | ||
|
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 |
---|---|---|
|
@@ -10,8 +10,7 @@ import { TreatExchangeButton } from "./TreatExchangeButton" | |
|
||
type Props = { | ||
nmecs: Array<string>, | ||
rejectMessage: string, | ||
acceptMessage: string, | ||
exchangeMessage: string, | ||
requestType: AdminRequestType, | ||
requestId: number, | ||
showTreatButton?: boolean, | ||
|
@@ -22,15 +21,15 @@ type Props = { | |
|
||
const rejectRequest = async ( | ||
nmecs: Array<string>, | ||
rejectMessage: string, | ||
exchangeMessage: string, | ||
requestType: AdminRequestType, | ||
id: number | ||
) => { | ||
try { | ||
await exchangeRequestService.adminRejectExchangeRequest(requestType, id); | ||
|
||
const a = document.createElement('a'); | ||
a.href = `${mailtoStringBuilder(nmecs)}?subject=Pedido de troca rejeitado&body=${rejectMessage}`; | ||
a.href = `${mailtoStringBuilder(nmecs)}?subject=Pedido de Alteração de Turma&[email protected]&body=Viva, A alteração pedida não pode ser efetuada. ${exchangeMessage} Cmpts, Daniel Silva (pela comissão de inscrição em turmas)`; | ||
a.click(); | ||
} catch (e) { | ||
console.error(e); | ||
|
@@ -39,15 +38,15 @@ const rejectRequest = async ( | |
|
||
const acceptRequest = async ( | ||
nmecs: Array<string>, | ||
acceptMessage: string, | ||
exchangeMessage: string, | ||
requestType: AdminRequestType, | ||
id: number | ||
) => { | ||
try { | ||
await exchangeRequestService.adminAcceptExchangeRequest(requestType, id); | ||
|
||
const a = document.createElement('a'); | ||
a.href = `${mailtoStringBuilder(nmecs)}?subject=Pedido de troca aceito&body=${acceptMessage}`; | ||
a.href = `${mailtoStringBuilder(nmecs)}?subject=Pedido de Troca de Turma&[email protected]&body=Viva, A alteração pedida foi efetuada. ${exchangeMessage} Cmpts, Daniel Silva (pela comissão de inscrição em turmas)`; | ||
a.click(); | ||
} catch (e) { | ||
console.error(e); | ||
|
@@ -64,8 +63,7 @@ const markRequestAsAwaitingInformation = async (requestType: AdminRequestType, i | |
|
||
export const AdminRequestCardFooter = ({ | ||
nmecs, | ||
rejectMessage, | ||
acceptMessage, | ||
exchangeMessage, | ||
requestType, | ||
requestId, | ||
showTreatButton = true, | ||
|
@@ -80,7 +78,7 @@ export const AdminRequestCardFooter = ({ | |
<Button | ||
variant="destructive" | ||
onClick={async () => { | ||
await rejectRequest(nmecs, rejectMessage, requestType, requestId); | ||
await rejectRequest(nmecs, exchangeMessage, requestType, requestId); | ||
setExchange(prev => { | ||
const newPrev = {...prev }; | ||
newPrev.admin_state = "rejected"; | ||
|
@@ -93,7 +91,7 @@ export const AdminRequestCardFooter = ({ | |
|
||
<Button | ||
onClick={async () => { | ||
await acceptRequest(nmecs, acceptMessage, requestType, requestId); | ||
await acceptRequest(nmecs, exchangeMessage, requestType, requestId); | ||
setExchange(prev => { | ||
const newPrev = {...prev }; | ||
newPrev.admin_state = "accepted"; | ||
|
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