+
${unit.unitNumber}
+
+ ${unit.vehicles.map((v, i) => renderCoach(v, i, total)).join('\n')}
+
+ ${renderComments(unit.comments)}
+
`;
+}
+
+function renderCoach(vehicle: VehicleReport, index: number, total: number): string {
+ const cabMarkerHTML = vehicle.hasCabZone
+ ? `No comments submitted.
';
+
+ return `
+
+ `;
+}
+
+function wrapHtml(content: string, startDate: Date, endDate: Date): string {
+ const formatDate = (d: Date) => d.toISOString().split('T')[0];
+
+ return `
+
+
+
+
+
TrACreport
+
Report period: ${formatDate(startDate)} - ${formatDate(endDate)}
+
Total reports received for each vehicle in the West fleet
+
158 cabs are not recorded as cab cooling is disabled for Guards
+
+ ${content}
+
+`
+}
\ No newline at end of file
diff --git a/src/reports/reports.ts b/src/reports/reports.ts
new file mode 100644
index 0000000..053b24b
--- /dev/null
+++ b/src/reports/reports.ts
@@ -0,0 +1,103 @@
+interface BaseReport {
+ unitNumber: string;
+ reported: string;
+ comments?: string;
+ utcTimestamp: Date;
+ faults: Fault[];
+}
+
+interface Fault {
+ coach: string;
+ zone: string;
+}
+
+export interface GroupedUnitReport {
+ unitNumber: string;
+ vehicles: VehicleReport[];
+ comments: string[];
+}
+
+export interface VehicleReport {
+ vehicleNumber: string;
+ cabReports: number;
+ saloonReports: number;
+ hasCabZone: boolean;
+}
+
+async function fetchReports(): Promise
Comments
+ ${renderedComments} +