mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
more formatting
This commit is contained in:
parent
8184bbd0fb
commit
d1514672cc
1 changed files with 126 additions and 15 deletions
|
|
@ -2,6 +2,104 @@
|
|||
|
||||
import React, { useState } from "react";
|
||||
|
||||
export const ELEMENT_TYPE_LABELS: Record<string, string> = {
|
||||
access_ramp: "Access Ramp",
|
||||
accessible_housing_register: "Accessible Housing Register",
|
||||
additional_wc_or_whb: "Additional WC or WHB",
|
||||
asbestos: "Asbestos",
|
||||
bathroom: "Bathroom",
|
||||
bathroom_remaining_life_source: "Bathroom Remaining Life Source",
|
||||
boiler_fuel: "Boiler Fuel",
|
||||
central_heating: "Central Heating",
|
||||
chimney: "Chimney",
|
||||
community_heating: "Community Heating",
|
||||
downpipes: "Downpipes",
|
||||
drop_kerb: "Drop Kerb",
|
||||
electrics: "Electrics",
|
||||
external_brickwork_pointing: "External Brickwork Pointing",
|
||||
external_decoration: "External Decoration",
|
||||
external_door: "External Door",
|
||||
external_noise_insulation: "External Noise Insulation",
|
||||
external_structural_defects: "External Structural Defects",
|
||||
external_wall: "External Wall",
|
||||
external_windows: "External Windows",
|
||||
fascia_soffit_bargeboards: "Fascia Soffit Bargeboards",
|
||||
ffhh_damp: "FFHH Damp",
|
||||
ffhh_drainage_lavatories: "FFHH Drainage Lavatories",
|
||||
ffhh_food_prep_and_washup: "FFHH Food Prep and Washup",
|
||||
ffhh_hold_and_cold_water: "FFHH Hold and Cold Water",
|
||||
ffhh_natural_light: "FFHH Natural Light",
|
||||
ffhh_neglected: "FFHH Neglected",
|
||||
ffhh_unsafe_layout: "FFHH Unsafe Layout",
|
||||
ffhh_unstable_building: "FFHH Unstable Building",
|
||||
ffhh_ventilation: "FFHH Ventilation",
|
||||
fire_risk_assessment: "Fire Risk Assessment",
|
||||
floor_level: "Floor Level",
|
||||
floor_level_front_door: "Floor Level Front Door",
|
||||
garage_and_store_door: "Garage and Store Door",
|
||||
garage_and_store_roof: "Garage and Store Roof",
|
||||
garage_and_store_windows: "Garage and Store Windows",
|
||||
garage_door: "Garage Door",
|
||||
garage_roof: "Garage Roof",
|
||||
garage_windows: "Garage Windows",
|
||||
gas_available: "Gas Available",
|
||||
gutters: "Gutters",
|
||||
heat_recovery_units: "Heat Recovery Units",
|
||||
heating_system: "Heating System",
|
||||
hhsrs_amenities: "HHSRS Amenities",
|
||||
hhsrs_asbestos_and_mmf: "HHSRS Asbestos and MMF",
|
||||
hhsrs_biocides: "HHSRS Biocides",
|
||||
hhsrs_carbon_monoxide: "HHSRS Carbon Monoxide",
|
||||
hhsrs_collision_and_entrapment: "HHSRS Collision and Entrapment",
|
||||
hhsrs_crowding_and_space: "HHSRS Crowding and Space",
|
||||
hhsrs_damp_and_mould: "HHSRS Damp and Mould",
|
||||
hhsrs_domestic_hygiene_pests_refuse: "HHSRS Domestic Hygiene, Pests & Refuse",
|
||||
hhsrs_electrical_hazards: "HHSRS Electrical Hazards",
|
||||
hhsrs_entry_by_intruders: "HHSRS Entry by Intruders",
|
||||
hhsrs_excess_cold: "HHSRS Excess Cold",
|
||||
hhsrs_excess_heat: "HHSRS Excess Heat",
|
||||
hhsrs_explosions: "HHSRS Explosions",
|
||||
hhsrs_falls_associated_with_baths: "HHSRS Falls Associated with Baths",
|
||||
hhsrs_falls_between_levels: "HHSRS Falls Between Levels",
|
||||
hhsrs_falls_on_level_surfaces: "HHSRS Falls on Level Surfaces",
|
||||
hhsrs_falls_on_stairs: "HHSRS Falls on Stairs",
|
||||
hhsrs_fire: "HHSRS Fire",
|
||||
hhsrs_flames_hot_surfaces: "HHSRS Flames / Hot Surfaces",
|
||||
hhsrs_food_safety: "HHSRS Food Safety",
|
||||
hhsrs_lead: "HHSRS Lead",
|
||||
hhsrs_lighting: "HHSRS Lighting",
|
||||
hhsrs_noise: "HHSRS Noise",
|
||||
hhsrs_personal_hygiene_sanitation: "HHSRS Personal Hygiene & Sanitation",
|
||||
hhsrs_radiation: "HHSRS Radiation",
|
||||
hhsrs_structural_collapse: "HHSRS Structural Collapse",
|
||||
hhsrs_uncombusted_fuel_gas: "HHSRS Uncombusted Fuel Gas",
|
||||
hhsrs_volatile_organic_compounds: "HHSRS Volatile Organic Compounds",
|
||||
hhsrs_water_supply: "HHSRS Water Supply",
|
||||
internal_downpipes_external_area: "Internal Downpipes External Area",
|
||||
kitchen: "Kitchen",
|
||||
kitchen_remaining_life_source: "Kitchen Remaining Life Source",
|
||||
lintel: "Lintel",
|
||||
loft_insulation: "Loft Insulation",
|
||||
outbuilding_overhaul: "Outbuilding Overhaul",
|
||||
parking_areas: "Parking Areas",
|
||||
paths_and_hardstandings: "Paths and Hardstandings",
|
||||
patio_french_door: "Patio French Door",
|
||||
porch_canopy: "Porch Canopy",
|
||||
private_balcony: "Private Balcony",
|
||||
programmable_heating: "Programmable Heating",
|
||||
property: "Property",
|
||||
quality_standard: "Quality Standard",
|
||||
roof: "Roof",
|
||||
smoke_detection: "Smoke Detection",
|
||||
steps_to_front_door: "Steps to Front Door",
|
||||
store_door: "Store Door",
|
||||
store_roof: "Store Roof",
|
||||
store_windows: "Store Windows",
|
||||
tenant_installed_kitchen: "Tenant Installed Kitchen",
|
||||
water_heating: "Water Heating",
|
||||
};
|
||||
|
||||
|
||||
export type AspectCondition = {
|
||||
id: string;
|
||||
elementId: string;
|
||||
|
|
@ -84,7 +182,7 @@ export default function ElementTable({ groupedElements }: Props) {
|
|||
<thead>
|
||||
<tr>
|
||||
<th style={thStyle}>
|
||||
Element Type
|
||||
Element
|
||||
<div style={{ position: "relative", display: "inline-block", marginLeft: "0.5rem" }}>
|
||||
<button
|
||||
onClick={() => setShowDropdown(!showDropdown)}
|
||||
|
|
@ -113,16 +211,25 @@ export default function ElementTable({ groupedElements }: Props) {
|
|||
</button>
|
||||
<button onClick={deselectAll}>Deselect All</button>
|
||||
</div>
|
||||
{uniqueElementTypes.map(type => (
|
||||
<label key={type} style={{ display: "block", cursor: "pointer" }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedTypes.has(type)}
|
||||
onChange={() => toggleTypeFilter(type)}
|
||||
/>{" "}
|
||||
{type.replaceAll("_", " ")}
|
||||
</label>
|
||||
))}
|
||||
|
||||
{uniqueElementTypes
|
||||
.sort((a, b) => {
|
||||
// Sort alphabetically by human-readable label
|
||||
const labelA = ELEMENT_TYPE_LABELS[a] ?? a.replaceAll("_", " ");
|
||||
const labelB = ELEMENT_TYPE_LABELS[b] ?? b.replaceAll("_", " ");
|
||||
return labelA.localeCompare(labelB);
|
||||
})
|
||||
.map(type => (
|
||||
<label key={type} style={{ display: "block", cursor: "pointer" }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedTypes.has(type)}
|
||||
onChange={() => toggleTypeFilter(type)}
|
||||
/>{" "}
|
||||
{ELEMENT_TYPE_LABELS[type] ?? type.replaceAll("_", " ")}
|
||||
</label>
|
||||
))}
|
||||
|
||||
<button
|
||||
style={{ marginTop: "0.5rem" }}
|
||||
onClick={() => setShowDropdown(false)}
|
||||
|
|
@ -131,11 +238,11 @@ export default function ElementTable({ groupedElements }: Props) {
|
|||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
|
||||
</th>
|
||||
<th style={thStyle}>Instance</th>
|
||||
<th style={thStyle}># Aspects</th>
|
||||
<th style={thStyle}>No. Aspects</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -154,8 +261,12 @@ export default function ElementTable({ groupedElements }: Props) {
|
|||
fontWeight: "bold",
|
||||
}}
|
||||
>
|
||||
<td style={tdStyle}>{group.elementType.replaceAll("_", " ")}</td>
|
||||
<td style={tdStyle}>{group.elementInstance}</td>
|
||||
{/* <td style={tdStyle}>
|
||||
{group.elementType.replaceAll("_", " ") + (group.elementInstance > 1 ? " (" + group.elementInstance + ")" : "")}
|
||||
</td> */}
|
||||
<td style={tdStyle}>
|
||||
{`${ELEMENT_TYPE_LABELS[group.elementType] ?? group.elementType.replaceAll("_", " ")}${group.elementInstance > 1 ? ` (${group.elementInstance})` : ""}`}
|
||||
</td>
|
||||
<td style={tdStyle}>{totalAspects}</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue