mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
Merge pull request #316 from Hestia-Homes/feature/new-cols-in-property-export
Additional columns in property export
This commit is contained in:
commit
f0bb2b237a
11 changed files with 103 additions and 11 deletions
|
|
@ -64,6 +64,10 @@ const COLUMN_LABELS: Record<string, string> = {
|
|||
epcPrn: "EPC Certificate Number",
|
||||
batch: "Group",
|
||||
batchDescription: "Group Description",
|
||||
coordinationComments: "Coordination Comments",
|
||||
dampAndMouldGrowth: "Damp and Mould Growth",
|
||||
dampMouldAndRepairComments: "Damp, Mould and Repair Comments",
|
||||
domnaSurveyRequested: "Domna Survey Requested"
|
||||
};
|
||||
|
||||
type DocFilter = "all" | "has_docs" | "incomplete" | "none";
|
||||
|
|
@ -106,6 +110,10 @@ export default function PropertyTable({ data, onOpenDrawer, portfolioId = "", sh
|
|||
epcPrn: false,
|
||||
batch: false,
|
||||
batchDescription: false,
|
||||
coordinationComments: false,
|
||||
dampAndMouldGrowth: false,
|
||||
dampMouldAndRepairComments: false,
|
||||
domnaSurveyRequested: false,
|
||||
});
|
||||
|
||||
// Pre-filter by stage, doc status, and removal status before TanStack gets it
|
||||
|
|
|
|||
|
|
@ -268,12 +268,12 @@ export function createPropertyTableColumns(
|
|||
|
||||
// ── EPC SAP score (potential) ─────────────────────────────────────────
|
||||
{
|
||||
accessorKey: "epcSapScorePotential",
|
||||
accessorKey: "potentialPostSapScoreDropdown",
|
||||
id: "epcSapScorePotential",
|
||||
header: ({ column }) => <SortableHeader label="EPC SAP (Potential)" column={column as any} />,
|
||||
cell: ({ row }) => (
|
||||
<span className="text-xs font-mono text-gray-600">
|
||||
{row.original.epcSapScorePotential ?? <span className="text-gray-300">—</span>}
|
||||
{row.original.potentialPostSapScoreDropdown ?? <span className="text-gray-300">—</span>}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
|
|
@ -371,6 +371,74 @@ export function createPropertyTableColumns(
|
|||
),
|
||||
},
|
||||
|
||||
// ── Coordination comments ────────────────────────────────────────────
|
||||
{
|
||||
accessorKey: "coordinationComments",
|
||||
id: "coordinationComments",
|
||||
header: () => (
|
||||
<span className="text-xs font-semibold uppercase tracking-wide text-gray-500">
|
||||
Coordination Comments
|
||||
</span>
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-xs text-gray-600 max-w-[220px] line-clamp-2 leading-snug">
|
||||
{row.original.coordinationComments ?? <span className="text-gray-300">—</span>}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
|
||||
// ── Damp and mould growth ────────────────────────────────────────────
|
||||
{
|
||||
id: "dampAndMouldGrowth",
|
||||
accessorFn: (row) => row.dampMouldFlag,
|
||||
header: () => (
|
||||
<span className="text-xs font-semibold uppercase tracking-wide text-gray-500">
|
||||
Damp & Mould Growth
|
||||
</span>
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-xs text-gray-600">
|
||||
{row.original.dampMouldFlag ?? <span className="text-gray-300">—</span>}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
|
||||
// ── Damp, mould and repair comments ─────────────────────────────────
|
||||
{
|
||||
accessorKey: "dampMouldAndRepairComments",
|
||||
id: "dampMouldAndRepairComments",
|
||||
header: () => (
|
||||
<span className="text-xs font-semibold uppercase tracking-wide text-gray-500">
|
||||
Damp, Mould & Repair Comments
|
||||
</span>
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<span className="text-xs text-gray-600 max-w-[220px] line-clamp-2 leading-snug">
|
||||
{row.original.dampMouldAndRepairComments ?? <span className="text-gray-300">—</span>}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
|
||||
// ── Domna survey required ────────────────────────────────────────────
|
||||
{
|
||||
id: "domnaSurveyRequested",
|
||||
accessorFn: (row) => row.domnasurveyRequired,
|
||||
header: () => (
|
||||
<span className="text-xs font-semibold uppercase tracking-wide text-gray-500">
|
||||
Domna Survey Required
|
||||
</span>
|
||||
),
|
||||
cell: ({ row }) => {
|
||||
const val = row.original.domnasurveyRequired;
|
||||
if (val === null || val === undefined) return <span className="text-gray-300">—</span>;
|
||||
return (
|
||||
<span className={`text-xs font-medium ${val ? "text-amber-700" : "text-gray-500"}`}>
|
||||
{val ? "Yes" : "No"}
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
if (showDocuments) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ export default function DealPage({
|
|||
});
|
||||
|
||||
const parsedPreSap = parsePreSap(deal.preSapScore);
|
||||
const epcPotential = sapToEpc(deal.epcSapScorePotential != null ? Number(deal.epcSapScorePotential) : null);
|
||||
const epcPotential = sapToEpc(deal.potentialPostSapScoreDropdown != null ? Number(deal.potentialPostSapScoreDropdown) : null);
|
||||
const technicalApprovedMeasures = parseMeasures(
|
||||
deal.technicalApprovedMeasuresForInstall ?? null,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ const mockDealRow = {
|
|||
eiScore: null,
|
||||
eiScorePotential: null,
|
||||
epcSapScore: null,
|
||||
epcSapScorePotential: null,
|
||||
potentialPostSapScoreDropdown: null,
|
||||
epcPrn: null,
|
||||
surveyType: null,
|
||||
measuresForPibiOrdered: null,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ export function mapDbRowToHubspotDeal(row: DealRow): HubspotDeal {
|
|||
sharepointLink: d.sharepointLink,
|
||||
dampMouldFlag: d.dampmouldGrowth,
|
||||
dampMouldAndRepairComments: d.dampMouldAndRepairComments,
|
||||
coordinationComments: d.coordination_comments,
|
||||
domnasurveyRequired: d.domnasurveyRequired,
|
||||
preSapScore: d.preSap,
|
||||
coordinator: row.coordinator,
|
||||
ioeV1Date: d.mtpCompletionDate,
|
||||
|
|
@ -58,7 +60,7 @@ export function mapDbRowToHubspotDeal(row: DealRow): HubspotDeal {
|
|||
eiScore: d.eiScore,
|
||||
eiScorePotential: d.eiScorePotential,
|
||||
epcSapScore: d.epcSapScore,
|
||||
epcSapScorePotential: d.epcSapScorePotential,
|
||||
potentialPostSapScoreDropdown: d.potentialPostSapScoreDropdown,
|
||||
epcPrn: d.epcPrn,
|
||||
surveyType: d.surveyType,
|
||||
measuresForPibiOrdered: d.measuresForPibiOrdered,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ function makeDeal(overrides: Partial<HubspotDeal> = {}): HubspotDeal {
|
|||
eiScore: null,
|
||||
eiScorePotential: null,
|
||||
epcSapScore: null,
|
||||
epcSapScorePotential: null,
|
||||
potentialPostSapScoreDropdown: null,
|
||||
epcPrn: null,
|
||||
surveyType: null,
|
||||
measuresForPibiOrdered: null,
|
||||
|
|
@ -60,6 +60,8 @@ function makeDeal(overrides: Partial<HubspotDeal> = {}): HubspotDeal {
|
|||
domnaSurveyDate: null,
|
||||
batch: null,
|
||||
batchDescription: null,
|
||||
coordinationComments: null,
|
||||
domnasurveyRequired: null,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
...overrides,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function makeDeal(overrides: Partial<ClassifiedDeal> = {}): ClassifiedDeal {
|
|||
eiScore: null,
|
||||
eiScorePotential: null,
|
||||
epcSapScore: null,
|
||||
epcSapScorePotential: null,
|
||||
potentialPostSapScoreDropdown: null,
|
||||
epcPrn: null,
|
||||
surveyType: null,
|
||||
measuresForPibiOrdered: null,
|
||||
|
|
@ -59,6 +59,8 @@ function makeDeal(overrides: Partial<ClassifiedDeal> = {}): ClassifiedDeal {
|
|||
domnaSurveyDate: null,
|
||||
batch: null,
|
||||
batchDescription: null,
|
||||
coordinationComments: null,
|
||||
domnasurveyRequired: null,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
displayStage: "Coordination in Progress",
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ function makeDeal(overrides: Partial<HubspotDeal> = {}): HubspotDeal {
|
|||
eiScore: null,
|
||||
eiScorePotential: null,
|
||||
epcSapScore: null,
|
||||
epcSapScorePotential: null,
|
||||
potentialPostSapScoreDropdown: null,
|
||||
epcPrn: null,
|
||||
surveyType: null,
|
||||
measuresForPibiOrdered: null,
|
||||
|
|
@ -59,6 +59,8 @@ function makeDeal(overrides: Partial<HubspotDeal> = {}): HubspotDeal {
|
|||
domnaSurveyDate: null,
|
||||
batch: null,
|
||||
batchDescription: null,
|
||||
coordinationComments: null,
|
||||
domnasurveyRequired: null,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
...overrides,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export const PROPERTY_CSV_FIELDS: PropertyCsvField[] = [
|
|||
{ key: "eiScore", label: "EI Score" },
|
||||
{ key: "eiScorePotential", label: "EI Score (Potential)" },
|
||||
{ key: "epcSapScore", label: "EPC SAP Score" },
|
||||
{ key: "epcSapScorePotential", label: "EPC SAP (Potential)" },
|
||||
{ key: "potentialPostSapScoreDropdown", label: "EPC SAP (Potential)" },
|
||||
{ key: "lodgementStatus", label: "Lodgement Status" },
|
||||
{ key: "surveyedDate", label: "Surveyed Date" },
|
||||
{ key: "designDate", label: "Design Date" },
|
||||
|
|
@ -26,6 +26,10 @@ export const PROPERTY_CSV_FIELDS: PropertyCsvField[] = [
|
|||
{ key: "epcPrn", label: "EPC Certificate Number" },
|
||||
{ key: "batch", label: "Group" },
|
||||
{ key: "batchDescription", label: "Group Description" },
|
||||
{ key: "coordinationComments", label: "Coordination Comments" },
|
||||
{ key: "dampMouldFlag", label: "Damp and Mould Growth" },
|
||||
{ key: "dampMouldAndRepairComments", label: "Damp Mould and Repair Comments" },
|
||||
{ key: "domnasurveyRequired", label: "Domna Survey Required" },
|
||||
];
|
||||
|
||||
export function escapeCsvCell(value: unknown): string {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ function makeDeal(overrides: Partial<HubspotDeal> = {}): HubspotDeal {
|
|||
eiScore: null,
|
||||
eiScorePotential: null,
|
||||
epcSapScore: null,
|
||||
epcSapScorePotential: null,
|
||||
potentialPostSapScoreDropdown: null,
|
||||
epcPrn: null,
|
||||
surveyType: null,
|
||||
measuresForPibiOrdered: null,
|
||||
|
|
@ -66,6 +66,8 @@ function makeDeal(overrides: Partial<HubspotDeal> = {}): HubspotDeal {
|
|||
domnaSurveyDate: null,
|
||||
batch: null,
|
||||
batchDescription: null,
|
||||
coordinationComments: null,
|
||||
domnasurveyRequired: null,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
...overrides,
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ export type HubspotDeal = {
|
|||
sharepointLink: string | null;
|
||||
dampMouldFlag: string | null; // coordinator-stage damp/mould flag
|
||||
dampMouldAndRepairComments: string | null; // coordinator damp/mould comments
|
||||
coordinationComments: string | null;
|
||||
domnasurveyRequired: boolean | null;
|
||||
preSapScore: string | null; // kept as text (HubSpot returns strings)
|
||||
coordinator: string | null;
|
||||
ioeV1Date: Date | null;
|
||||
|
|
@ -52,7 +54,7 @@ export type HubspotDeal = {
|
|||
eiScore: string | null;
|
||||
eiScorePotential: string | null;
|
||||
epcSapScore: string | null;
|
||||
epcSapScorePotential: string | null;
|
||||
potentialPostSapScoreDropdown: string | null;
|
||||
epcPrn: string | null;
|
||||
|
||||
// ── New per-deal workflow fields (issue #249 slice) ────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue