diff --git a/ts/components/ReviewPoolColumnDetail.vue b/ts/components/ReviewPoolColumnDetail.vue index 5ac21436..4d4a76a5 100644 --- a/ts/components/ReviewPoolColumnDetail.vue +++ b/ts/components/ReviewPoolColumnDetail.vue @@ -24,9 +24,9 @@ -
+
-

Entry #{{ selectedTask.id }} Details

+

Entry #{{ selectedTask?.id ?? "" }} Details

@@ -51,7 +51,7 @@ :class="{ 'border-warning': modelValue.location.longitude !== - selectedTask.pool?.location?.longitude, + selectedTask?.pool?.location?.longitude, }" />
@@ -67,7 +67,7 @@ :class="{ 'border-warning': modelValue.location.latitude !== - selectedTask.pool?.location?.latitude, + selectedTask?.pool?.location?.latitude, }" />
@@ -81,7 +81,7 @@ v-model="modelValue.condition" :class="{ 'border-warning': - modelValue.condition !== selectedTask.pool?.condition, + modelValue.condition !== selectedTask?.pool?.condition, }" > @@ -105,7 +105,7 @@ :class="{ 'border-warning': siteOwner.name !== - (selectedTask.pool?.site.owner?.name ?? ''), + (selectedTask?.pool?.site.owner?.name ?? ''), }" />
@@ -123,7 +123,7 @@ :class="{ 'border-warning': siteResident.name !== - (selectedTask.pool?.site.resident?.name ?? ''), + (selectedTask?.pool?.site.resident?.name ?? ''), }" />
@@ -141,7 +141,8 @@
@@ -256,32 +256,6 @@ function selectTask(id: number): void { owner: pool.site.owner?.name ?? "", resident: pool.site.resident?.name ?? "", }; - - // Update map - updateMap(task); -} - -// Map Update -function updateMap(task: ReviewTask): void { - console.log("Updating map for task:", task.id); - - const map = mapMultipoint.value; - if (!map) return; - - const loc = task.pool?.location; - if (!loc) { - map.SetMarkers([]); - return; - } - - const bounds = new maplibregl.LngLatBounds( - new maplibregl.LngLat(loc.longitude - 0.005, loc.latitude - 0.005), - new maplibregl.LngLat(loc.longitude + 0.005, loc.latitude + 0.005), - ); - - map.FitBounds(bounds, { - padding: 50, - }); } // Submit Review @@ -293,9 +267,13 @@ async function submitReview(action: "committed" | "discarded"): Promise { try { const payload: any = { - task_id: selectedTask.value.id, status: action, - //updates: selectedTaskChanges, + task_id: selectedTask.value.id, + updates: { + condition: reviewForm.value.condition, + latitude: reviewForm.value.location.latitude, + longitude: reviewForm.value.location.longitude, + }, }; const response = await fetch("/api/review/pool", { @@ -322,7 +300,8 @@ async function submitReview(action: "committed" | "discarded"): Promise { // Select the next item in the list let new_index = index < all_tasks.length ? index : all_tasks.length - 1; - selectedTaskID.value = all_tasks[new_index].id; + const new_id = all_tasks[new_index].id; + selectTask(new_id); } catch (err) { error.value = err instanceof Error ? err.message : "Unknown error"; console.error("Error submitting review:", err); @@ -447,6 +426,8 @@ watch( onMounted(async () => { initializeMaps(); + loading.value = true; await storeReviewTask.fetchAll(); + loading.value = false; });