From 55cbee53d6a6baa9eab9f74551fa03ee67bd755b Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Tue, 16 May 2023 15:00:47 +0200
Subject: [PATCH] Add Observation is positive [VIPSUTV-471]

---
 src/components/Observation.vue | 17 ++++++++++++++++-
 src/components/Sync.vue        |  1 +
 src/locales/en.json            |  1 +
 src/locales/nb.json            |  1 +
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/components/Observation.vue b/src/components/Observation.vue
index bab0cbd..dd34103 100644
--- a/src/components/Observation.vue
+++ b/src/components/Observation.vue
@@ -49,7 +49,6 @@
 
 
 		<div class="form-group row">
-
 			<label for="strDateObservation" class="col-1 col-form-label">
 				<font-awesome-icon style="font-size: x-large;" icon="calendar-days" /></label>
 			<div class="col-7">
@@ -58,6 +57,14 @@
 					v-on:change="capturedTime($event)" />
 			</div>
 		</div>
+		<div class="form-group">
+	  		<div class="checkbox">
+				<label>
+					<input type="checkbox" v-model="observation.isPositive" name="isPositive">
+				</label>
+				{{ $t("observation.is_positive.label") }}
+	  		</div>
+	  	</div>
 
 		<div v-if="pest.pestId" class="row">
 			<div class="col-1">
@@ -159,6 +166,7 @@
 				isStrDateObservationEmpty: false,
 				isObservationHeaderEmpty: false,
 				isDeleteBttnVisible: true,
+				isPositive: true,
 				isQuantification: false,
 				isMounted: false,
 				msg: this.$i18n.t("observation.msg"),
@@ -321,6 +329,10 @@
 					else {
 						jsonObservation = lstObservations.find(({observationId}) => observationId === id);                           // Selection Observation
 						this.observation = jsonObservation;
+						if(this.observation.isPositive == undefined)
+						{
+							this.observation.isPositive = true;
+						}
 						this.observation.observationData = JSON.parse(jsonObservation.observationData);
 						if (jsonObservation.statusTypeId) {}
 						else {
@@ -581,6 +593,7 @@
 				this.observationForStore.cropOrganismId = this.observation.cropOrganismId;
 				this.observationForStore.organismId = this.observation.organismId;
 				this.observationForStore.timeOfObservation = this.strDateObservation;
+				this.observationForStore.isPositive= this.observation.isPositive;
 				this.observationForStore.statusChangedTime = this.strDateObservation;
 				if (this.observation.statusTypeId) {
 					this.observationForStore.statusTypeId = this.observation.statusTypeId;
@@ -615,6 +628,7 @@
 							jobservation.cropOrganismId = localObservationForStore.cropOrganismId;
 							jobservation.organismId = localObservationForStore.organismId;
 							jobservation.timeOfObservation = localObservationForStore.timeOfObservation;
+							jobservation.isPositive = localObservationForStore.isPositive;
 							jobservation.statusChangedTime = localObservationForStore.statusChangedTime;
 							jobservation.statusTypeId = localObservationForStore.statusTypeId;
 							jobservation.isQuantified = localObservationForStore.isQuantified;
@@ -769,6 +783,7 @@
 					this.observation.observationId = newObservationId;
 					this.observation.observationData = '';
 					this.observation.broadcastMessage = true;
+					this.observation.isPositive = true;
 					this.getNewObservation();
 					this.observation.observationIllustrationSet = [];
 				}
diff --git a/src/components/Sync.vue b/src/components/Sync.vue
index 0bff52e..505f531 100644
--- a/src/components/Sync.vue
+++ b/src/components/Sync.vue
@@ -573,6 +573,7 @@
 							observationForStore.cropOrganismId = observation.cropOrganismId;
 							observationForStore.organismId = observation.organismId
 							observationForStore.timeOfObservation = observation.timeOfObservation;
+							observationForStore.isPositive = observation.isPositive;
 							observationForStore.statusChangedTime = observation.statusChangedTime;
 							observationForStore.statusTypeId = observation.statusTypeId;
 							observationForStore.isQuantified = observation.isQuantified;
diff --git a/src/locales/en.json b/src/locales/en.json
index 4f34bbc..a2264a8 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -17,6 +17,7 @@
 	"login.forgotpassword.button.label": "Send e-mail address",
 	"login.forgotpassword.success.msg": "Your request has been accepted. An e-mail with further instructions has been sent.",
 	"observation.date.label": "Observation Date",
+	"observation.is_positive.label": "Pest presence confirmed",
 	"observation.quantification.label": "Quantify",
 	"observation.quantification.form.label": "Observasjon quantification",
 	"observation.detail.heading.placeholder": "Heading (What was found and where?)",
diff --git a/src/locales/nb.json b/src/locales/nb.json
index 5227ab9..2bad181 100644
--- a/src/locales/nb.json
+++ b/src/locales/nb.json
@@ -17,6 +17,7 @@
 	"login.forgotpassword.button.label": "Send e-postadresse",
 	"login.forgotpassword.success.msg": "Din henvendelse er behandlet og akseptert. En e-post med flere instruksjoner har blitt sendt til den registrerte e-postadressen. Vennligst sjekk alle spamfiltre hvis du ikke har mottatt den innen kort tid.",
 	"observation.date.label": "Observasjonsdato",
+	"observation.is_positive.label": "Skadegjører påvist",
 	"observation.quantification.label": "Tell/kvantifiser",
 	"observation.quantification.form.label": "Observasjonsspesifikke detaljer",
 	"observation.detail.heading.placeholder": "Overskrift (Hva er funnet hvor?)",
-- 
GitLab