Skip to content

Commit

Permalink
fix: email wording
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementNumericite committed Nov 7, 2024
1 parent 72096f0 commit bdaf8c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions webapp/src/server/api/routers/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export const orderRouter = createTRPCRouter({
data: {
order: id,
},
depth: 1,
});

const users = await ctx.payload.find({
Expand All @@ -401,8 +402,8 @@ export const orderRouter = createTRPCRouter({
ctx.payload.sendEmail({
from: process.env.SMTP_FROM_ADDRESS,
to: currentUser.userEmail,
subject: 'Signalement d\'une commande sur la carte "jeune engagé"',
html: getHtmlSignalOrder(currentUser),
subject: "Signalement d'une commande défaillante",
html: getHtmlSignalOrder(currentUser, orderSignal.order as Order),
});

return {
Expand Down
9 changes: 6 additions & 3 deletions webapp/src/utils/emailHtml.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { formatDateTime, getBaseUrl } from "./tools";
import { User } from "~/payload/payload-types";
import { Order, User } from "~/payload/payload-types";

export const getHtmlLoginByEmail = (user: User, userAuthToken: string) => {
return `
Expand Down Expand Up @@ -70,7 +70,7 @@ export const getHtmlLoginByEmail = (user: User, userAuthToken: string) => {
`;
};

export const getHtmlSignalOrder = (user: User) => {
export const getHtmlSignalOrder = (user: User, order: Order) => {
const now = new Date();
return `
<!DOCTYPE html>
Expand Down Expand Up @@ -129,7 +129,10 @@ export const getHtmlSignalOrder = (user: User) => {
<hr/>
<p class="bottom-container"><b>Date de votre demande : ${formatDateTime(now)}</b>
<p class="bottom-container">
<b>Numéro de commande :</b> ${order.number}<br/>
<b>Date de votre demande :</b> ${formatDateTime(now)}
</p>
</div>
</body>
</html>
Expand Down

0 comments on commit bdaf8c6

Please sign in to comment.