Non-Intrusive Survey
diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx
index 53c9cd94..a6956fc9 100644
--- a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx
+++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/DocumentsTable.tsx
@@ -1,11 +1,16 @@
"use client";
import React from "react";
-import { Table, TableBody, TableRow, TableCell } from "@/app/shadcn_components/ui/table";
+import {
+ Table,
+ TableBody,
+ TableRow,
+ TableCell,
+} from "@/app/shadcn_components/ui/table";
import { DocumentSection } from "./DocumentSection";
import {
type ReportType,
REPORT_TYPES,
- dbLabelToReportType, // <-- import the map
+ dbLabelToReportType, // <-- import the map
} from "@/app/db/surveyDB/schema/documents";
import type { getUploadedFile } from "@/app/db/surveyDB/schema/surveyDB";
@@ -14,7 +19,10 @@ type Props = {
uploadedFilesData: getUploadedFile[];
};
-export const DocumentsTable: React.FC
= ({ uprn, uploadedFilesData }) => {
+export const DocumentsTable: React.FC = ({
+ uprn,
+ uploadedFilesData,
+}) => {
const filesByType = React.useMemo(() => {
const map: Partial> = {};
@@ -26,7 +34,7 @@ export const DocumentsTable: React.FC = ({ uprn, uploadedFilesData }) =>
}
// newest first within each group
- Object.values(map).forEach(arr =>
+ Object.values(map).forEach((arr) =>
arr!.sort(
(a, b) =>
new Date(b.s3FileUploadTimestamp as any).getTime() -
@@ -37,18 +45,20 @@ export const DocumentsTable: React.FC = ({ uprn, uploadedFilesData }) =>
return map;
}, [uploadedFilesData]);
+ console.log("filesByType", filesByType);
+
return (
{REPORT_TYPES.map((reportType) => {
const filesForType = filesByType[reportType] ?? [];
- console.log("reportType", reportType)
+ console.log("reportType", reportType);
return (
diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/page.tsx
index 1ded30a0..799142af 100644
--- a/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/page.tsx
+++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/documents/page.tsx
@@ -5,22 +5,17 @@ import { surveyDB } from "@/app/db/surveyDB/connection";
import { uploadedFiles } from "@/app/db/surveyDB/schema/surveyDB";
import { type getUploadedFiles } from "@/app/db/surveyDB/schema/surveyDB";
-
-async function getDocuments(
- uprn: number
-): Promise< getUploadedFiles> {
+async function getDocuments(uprn: number): Promise {
const result = surveyDB.query.uploadedFiles.findMany({
where: eq(uploadedFiles.uprn, String(uprn)),
});
-
+
return result;
}
-export default async function DocumentsPage(
- props: {
- params: Promise<{ slug: string; propertyId: string }>;
- }
-) {
+export default async function DocumentsPage(props: {
+ params: Promise<{ slug: string; propertyId: string }>;
+}) {
const params = await props.params;
// Get the property UPRN
const propertyId = params.propertyId;
@@ -31,6 +26,8 @@ export default async function DocumentsPage(
const propertyMeta = await getPropertyMeta(propertyId);
const uploadedFiles = await getDocuments(propertyMeta.uprn);
+ console.log("Uploaded files:", uploadedFiles);
+
return (
<>
@@ -38,7 +35,7 @@ export default async function DocumentsPage(
Core Survey Documents
-
@@ -51,4 +48,3 @@ export default async function DocumentsPage(
>
);
}
-
diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/layout.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/layout.tsx
index 4a313f1d..5da4b86b 100644
--- a/src/app/portfolio/[slug]/building-passport/[propertyId]/layout.tsx
+++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/layout.tsx
@@ -12,17 +12,15 @@ function EstimatedDataNotification() {
);
}
-export default async function DashboardLayout(
- props: {
- children: React.ReactNode;
- params: Promise<{ slug: string; propertyId: string }>;
- }
-) {
+export default async function DashboardLayout(props: {
+ children: React.ReactNode;
+ params: Promise<{ slug: string; propertyId: string }>;
+}) {
const params = await props.params;
const {
// will be a page or nested layout
- children
+ children,
} = props;
const propertyId = params.propertyId ?? "";
@@ -32,9 +30,10 @@ export default async function DashboardLayout(
const propertyMeta = await getPropertyMeta(params.propertyId);
// We check if we have an uploaded condition report and if so, we show the condition tab. Otherwise, we
// don't show it
- const conditionReport = await getDocument(
- { uprn: String(propertyMeta.uprn), documentType: "ECO_CONDITION_REPORT" }
- );
+ const decentHomes = await getDocument({
+ uprn: String(propertyMeta.uprn),
+ documentType: "DECENT_HOMES_SUMMARY",
+ });
if (!propertyId && propertyId !== "0") {
throw Error("Invalid propertyId");
@@ -58,7 +57,11 @@ export default async function DashboardLayout(
{propertyMeta.postcode}
-
+
{propertyMeta.detailsEpc.estimated && }
{children}