Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions programmerbar-email-templates/templates/new-shift.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const NewShiftEmailSchema = z.object({
id: z.string(), // Not used in the email, but can be useful for ICS generation
startAt: z.string(),
endAt: z.string(),
startAtFormatted: z.string(),
endAtFormatted: z.string(),
summary: z.string(),
description: z.string().optional()
}),
Expand All @@ -31,11 +33,11 @@ export function NewShiftEmail({ shift, user }: NewShiftEmailSchemaType) {
<Text className="mt-4">Du har blitt tildelt en vakt med følgende detaljer:</Text>

<Text className="mt-2">
<strong>Fra:</strong> {new Date(shift.startAt).toLocaleString("nb-NO")}
<strong>Fra:</strong> {shift.startAtFormatted}
</Text>

<Text className="mt-1">
<strong>Til:</strong> {new Date(shift.endAt).toLocaleString("nb-NO")}
<strong>Til:</strong> {shift.endAtFormatted}
</Text>

{shift.description && (
Expand Down
3 changes: 3 additions & 0 deletions programmerbar-web/src/lib/remotes/events.remote.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { CreateEventSchema } from '$lib/validators';
import type { ShiftEmailProps } from '$lib/services/email.service';
import { normalDate } from '$lib/date';
import { z } from 'zod';
import { command, getRequestEvent } from '$app/server';

Expand Down Expand Up @@ -91,6 +92,8 @@ async function sendShiftEmails(
id: shift.id,
startAt: new Date(shift.startAt).toISOString(),
endAt: new Date(shift.endAt).toISOString(),
startAtFormatted: normalDate(shift.startAt),
endAtFormatted: normalDate(shift.endAt),
summary: `Vakt: ${eventName}`,
description: `Du har fått en vakt på "${eventName}".`
}
Expand Down
2 changes: 2 additions & 0 deletions programmerbar-web/src/lib/services/email.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export type ShiftEmailProps = {
id: string;
startAt: string;
endAt: string;
startAtFormatted: string;
endAtFormatted: string;
summary: string;
description?: string;
};
Expand Down