{{ selectedObservation.notes }}
@@ -320,7 +322,8 @@
-
{{ selectedObservation.observer_phone_number }}
+
{{ selectedObservation.observer_phone_number }}
+
@@ -528,7 +531,7 @@ export default {
}
});
const canViewRestrictedFields = computed(() => {
- return vespaStore.isAdmin ||
+ return vespaStore.isAdmin ||
(isLoggedIn.value && vespaStore.userMunicipalities.includes(selectedObservation.value?.municipality_name));
});
@@ -643,23 +646,23 @@ export default {
];
const hasEradicationData = eradicationFields.some(field => editableObservation.value[field]);
- if (
- editableObservation.value.eradication_result &&
- !editableObservation.value.eradication_date
- ) {
- const today = new Date();
- editableObservation.value.eradication_date = today.toISOString().split('T')[0];
- }
-
+ // if (
+ // editableObservation.value.eradication_result &&
+ // !editableObservation.value.eradication_date
+ // ) {
+ // const today = new Date();
+ // editableObservation.value.eradication_date = today.toISOString().split('T')[0];
+ // }
+
// Format eradication_date if provided, and check for valid eradication result
- if (editableObservation.value.eradication_date) {
- const date = new Date(editableObservation.value.eradication_date);
- if (!isNaN(date.getTime())) {
- editableObservation.value.eradication_date = date.toISOString().split('T')[0];
- } else {
- throw new Error("Invalid eradication date format");
- }
- }
+ // if (editableObservation.value.eradication_date) {
+ // const date = new Date(editableObservation.value.eradication_date);
+ // if (!isNaN(date.getTime())) {
+ // editableObservation.value.eradication_date = date.toISOString().split('T')[0];
+ // } else {
+ // throw new Error("Invalid eradication date format");
+ // }
+ // }
if (hasEradicationData && !editableObservation.value.eradication_result) {
eradicationResultError.value = 'Resultaat is verplicht wanneer andere bestrijdingsgegevens zijn ingevuld.';
@@ -679,7 +682,7 @@ export default {
errorMessage.value = 'Er is een fout opgetreden bij het opslaan van de wijzigingen.';
}
console.error('Error updating observation:', error);
- }finally {
+ } finally {
isUpdating.value = false;
}
};
@@ -769,7 +772,8 @@ export default {
editableObservation,
errorMessage,
eradicationResultError,
- canViewRestrictedFields
+ canViewRestrictedFields,
+ validationStatusEnum
};
}
};
diff --git a/src/stores/vespaStore.js b/src/stores/vespaStore.js
index 644c020..e59b0b8 100644
--- a/src/stores/vespaStore.js
+++ b/src/stores/vespaStore.js
@@ -54,8 +54,7 @@ export const useVespaStore = defineStore('vespaStore', {
)?.name;
return (
state.isLoggedIn &&
- state.userMunicipalities.includes(municipalityName) &&
- !observation.reserved_by
+ state.userMunicipalities.includes(municipalityName)
);
},
canEditAdminFields: (state) => state.isAdmin,
@@ -457,6 +456,8 @@ export const useVespaStore = defineStore('vespaStore', {
return '#198754';
} else if (status === 'eradicated') {
return '#198754';
+ } else if (status === 'unsuccessful') {
+ return '#198754';
} else if (status === 'reserved') {
return '#ea792a';
}
diff --git a/vespadb/observations/admin.py b/vespadb/observations/admin.py
index 59f578d..02e75b0 100644
--- a/vespadb/observations/admin.py
+++ b/vespadb/observations/admin.py
@@ -151,7 +151,6 @@ class ObservationAdmin(gis_admin.GISModelAdmin):
"source",
"wn_id",
"wn_validation_status",
- "wn_admin_notes",
"observer_name",
"observer_phone_number",
"created_datetime",
diff --git a/vespadb/observations/views.py b/vespadb/observations/views.py
index 38430cb..7577e03 100644
--- a/vespadb/observations/views.py
+++ b/vespadb/observations/views.py
@@ -46,7 +46,7 @@
from vespadb.observations.cache import invalidate_geojson_cache, invalidate_observation_cache
from vespadb.observations.filters import ObservationFilter
from vespadb.observations.helpers import parse_and_convert_to_utc
-from vespadb.observations.models import Municipality, Observation, Province
+from vespadb.observations.models import Municipality, Observation, Province, EradicationResultEnum
from vespadb.observations.serializers import (
MunicipalitySerializer,
ObservationSerializer,
@@ -393,7 +393,7 @@ def geojson(self, request: Request) -> HttpResponse:
"properties": {
"id": obs.id,
"status": "eradicated"
- if obs.eradication_result == "successful"
+ if obs.eradication_result is not None
else "reserved"
if obs.reserved_by
else "default",
@@ -744,7 +744,7 @@ def serialize_observation(self, obj: Observation, headers: list[str], allowed_fi
elif field == "anb_domain":
data.append(str(obj.anb))
elif field == "eradication_result":
- data.append(obj.eradication_result.value if obj.eradication_result else "")
+ data.append(obj.eradication_result if obj.eradication_result else "")
elif field == "nest_status":
logger.info("Getting status for observation %s", obj.eradication_result)
# This is handled as requested with eradication result