From b0e2e97f0983094fdf3ae5f2c35a14f91ff9604f Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Wed, 15 Apr 2026 16:59:53 +0000 Subject: [PATCH] Make changes actually reflect the changes --- ts/view/review/Pool.vue | 59 ++++++++++++----------------------------- 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/ts/view/review/Pool.vue b/ts/view/review/Pool.vue index 6a1c9ede..c6d0e967 100644 --- a/ts/view/review/Pool.vue +++ b/ts/view/review/Pool.vue @@ -112,17 +112,8 @@ import { Bounds, Contact, Location, ReviewTask } from "@/type/api"; import { Camera } from "@/type/map"; import { MapClickEvent, Marker } from "@/types"; -interface FormData { - latitude: number; - longitude: number; - condition: string; - ownerContact: string; - residentContact: string; - poolShape: string; -} - interface FieldConfig { - key: keyof FormData; + key: keyof ReviewTaskPoolForm; label: string; } @@ -154,10 +145,6 @@ const error = ref(null); const loading = ref(true); const mapBounds = ref(null); const mapFlyoverCamera = ref(new Camera()); -const newPoolCondition = ref(""); -const newPoolLocation = ref({ latitude: 0, longitude: 0 }); -const newOwnerName = ref(""); -const newResidentName = ref(""); const poolLocation = ref({ latitude: 0, longitude: 0, @@ -181,50 +168,42 @@ const mapTile = ref(null); // Computed: track which fields have changed const changes = computed(() => { - const pool = selectedTask.value?.pool; + const task = selectedTask.value; + const pool = task?.pool; if (!pool) return { updated: [], unchanged: [] }; const updated: string[] = []; const unchanged: string[] = []; const fields: FieldConfig[] = [ - { key: "latitude", label: "Latitude" }, - { key: "longitude", label: "Longitude" }, + { key: "location", label: "Location" }, { key: "condition", label: "Pool condition" }, - { key: "ownerContact", label: "Owner contact" }, - { key: "residentContact", label: "Resident contact" }, + { key: "owner", label: "Owner contact" }, + { key: "resident", label: "Resident contact" }, ]; - if (newPoolCondition.value != pool.condition) { + if (reviewForm.value.condition != pool.condition) { updated.push("condition"); } else { unchanged.push("condition"); } if ( - newPoolLocation.value && - newPoolLocation.value.latitude != pool.site.address.location?.latitude + reviewForm.value.location.latitude != pool.location?.latitude || + reviewForm.value.location.longitude != pool.location?.longitude ) { - updated.push("latitude"); + updated.push("location"); } else { - unchanged.push("latitude"); + unchanged.push("location"); } - if ( - newPoolLocation.value && - newPoolLocation.value.longitude != pool.site.address.location?.longitude - ) { - updated.push("longitude"); + if (reviewForm.value.owner != (pool.site.owner?.name ?? "")) { + updated.push("owner"); } else { - unchanged.push("longitude"); + unchanged.push("owner"); } - if (newOwnerName.value != pool.site.owner?.name) { - updated.push("ownerContact"); + if (reviewForm.value.resident != (pool.site.resident?.name ?? "")) { + updated.push("resident"); } else { - unchanged.push("ownerContact"); - } - if (newResidentName.value != pool.site.resident?.name) { - updated.push("residentContact"); - } else { - unchanged.push("residentContact"); + unchanged.push("resident"); } return { updated, unchanged }; @@ -270,10 +249,6 @@ function selectTask(id: number): void { } console.log("selecting task", id, task); mapFlyoverCamera.value = new Camera(pool.location, 20); - newPoolCondition.value = pool.condition; - newPoolLocation.value = pool.location; - newOwnerName.value = pool.site.owner?.name ?? ""; - newResidentName.value = pool.site.resident?.name ?? ""; reviewForm.value = { address: formatAddress(task.address), condition: pool.condition,