From f5f2046dd8c2148d48b2a7858f20181a84b626b9 Mon Sep 17 00:00:00 2001
From: Tor-Einar Skog <tor-einar.skog@nibio.no>
Date: Tue, 24 May 2022 09:55:50 +0200
Subject: [PATCH] Added broadcastMessage option

---
 src/components/Observation.vue                | 38 ++++++++++++++++---
 .../ObservationIllustrationBoard.vue          |  3 +-
 src/locales/en.json                           |  4 +-
 src/locales/nb.json                           |  4 +-
 src/main.js                                   |  2 +
 5 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/src/components/Observation.vue b/src/components/Observation.vue
index 379bd0f..fea2367 100644
--- a/src/components/Observation.vue
+++ b/src/components/Observation.vue
@@ -99,6 +99,7 @@
 			v-bind:observationId="observation.observationId"
 			@observationIllustrationSetUpdated="handleObservationIllustrationSetUpdated" />
 
+		
 
 		<div ref='divObservationText' class="form-group">
 			<div>
@@ -110,10 +111,16 @@
 			<div><textarea v-model="observation.observationText" class="form-control" rows="4"
 					:placeholder="$t('observation.detail.body.placeholder')" /></div>
 		</div>
-		<!--div v-show="isSync"><sync ref="sync" :isSyncNeeded="isSync"/></div-->
-
-
-
+		
+		<div class="form-group">
+	  		<div class="checkbox">
+				<label>
+					<input type="checkbox" v-model="observation.broadcastMessage" name="broadcastMessage" checked="checked">
+				</label>
+				{{ $t("observation.broadcast.label") }}
+				<font-awesome-icon icon="fa-solid fa-circle-question" class="helpIcon" onclick="document.getElementById('infoModal').style.display = 'block';"/>
+	  		</div>
+	  	</div>
 
 		<div v-if="observation.deleted"></div>
 		<div v-else class="float-right">
@@ -121,6 +128,12 @@
 			<a v-show="isDeleteBttnVisible" class="vips-btn danger"
 				v-on:click="callForRemoveObservation">{{$t("delete.label")}}</a>
 		</div>
+		
+		<div class="centeredModal" id="infoModal" onclick="this.style.display='none';">
+			<font-awesome-icon icon="fa-solid fa-circle-question"/>
+			<p>{{ $t("observation.broadcast.helptext") }}</p>
+		</div>
+		
 		<sync ref="sync" />
 	</div>
 
@@ -778,4 +791,19 @@
 	#divSchemaForm {
 		padding: 10px;
 	}
-</style>
\ No newline at end of file
+	.centeredModal {
+		position: fixed;
+		display: none;
+		width: 95%;
+		padding: 10px;
+		border: 2px solid #3d8052;
+		border-radius: 5px;
+		background-color: white;
+		top: 50%;
+		left: 50%;
+		transform: translate(-50%, -50%);
+	}
+	.helpIcon {
+		color: #3d8052;
+	}
+</style>
diff --git a/src/components/ObservationIllustrationBoard.vue b/src/components/ObservationIllustrationBoard.vue
index 02edd7b..f0001d9 100644
--- a/src/components/ObservationIllustrationBoard.vue
+++ b/src/components/ObservationIllustrationBoard.vue
@@ -43,7 +43,8 @@
 			</div>
 		</div>
 		<div class="centeredModal" id="observationModal" onclick="this.style.display='none';">
-			<img :src="modalImageBase64Data" class="img-fluid" /></div>
+			<img :src="modalImageBase64Data" class="img-fluid" />
+		</div>
 	</div>
 	</div>
 
diff --git a/src/locales/en.json b/src/locales/en.json
index 4a98d4e..d1a260d 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -16,6 +16,8 @@
 	"observation.quantification.form.label": "Observasjon quantification",
 	"observation.detail.heading.placeholder": "Heading (What was found and where?)",
 	"observation.detail.body.placeholder": "Text body (more details, please)",
+	"observation.broadcast.label": "Visible for others in VIPS",
+	"observation.broadcast.helptext": "The observation description will be readable by others, and notification subscribers will receive push messages. Geographic visibility is controlled by the select list under the map.",
 	"observation.map.label": "Observation Map",
 	"observation.msg": "Observation",
 	"observation.selectcrop": "Select crop",
@@ -62,7 +64,7 @@
 	"err.observation.remove.warn": "This Observation will be removed",
 	"sync": "Sync to server",
 	"settings.heading": "Settings",
-	"visibility.label.undefined": "Select visibility",
+	"visibility.label.undefined": "Select geographic visibility",
 	"visibility.label.private": "Private",
 	"visibility.label.public": "Public",
 	"index.header": "Field observations",
diff --git a/src/locales/nb.json b/src/locales/nb.json
index bad4312..b800e1b 100644
--- a/src/locales/nb.json
+++ b/src/locales/nb.json
@@ -16,6 +16,8 @@
 	"observation.quantification.form.label": "Observasjonsspesifikke detaljer",
 	"observation.detail.heading.placeholder": "Overskrift (Hva er funnet hvor?)",
 	"observation.detail.body.placeholder": "Brødtekst (Flere detaljer)",
+	"observation.broadcast.label": "Synlig for andre i VIPS",
+	"observation.broadcast.helptext": "Beskrivelsen av observasjonen vil kunne leses av andre, og de som abonnerer på meldinger om denne skadegjøreren/kulturen vil bli informert. Geografisk synlighet styres av valglisten under kartet.",
 	"observation.map.label": "Velg plassering",
 	"observation.msg": "Registrer observasjon",
 	"observation.selectcrop": "Velg kultur",
@@ -62,7 +64,7 @@
 	"err.observation.remove.warn": "Observasjonen vil bli slettet",
 	"sync": "Synkroniser med server",
 	"settings.heading": "Innstillinger",
-	"visibility.label.undefined": "Velg synlighet",
+	"visibility.label.undefined": "Velg geografisk synlighet",
 	"visibility.label.private": "Privat",
 	"visibility.label.public": "Offentlig",
 	"index.header": "Feltobservasjoner",
diff --git a/src/main.js b/src/main.js
index a099c0e..aa4e140 100644
--- a/src/main.js
+++ b/src/main.js
@@ -29,6 +29,8 @@ import { faMagnifyingGlassPlus } from '@fortawesome/free-solid-svg-icons'
 library.add(faMagnifyingGlassPlus);
 import { faUser } from '@fortawesome/free-solid-svg-icons'
 library.add(faUser);
+import { faCircleQuestion } from '@fortawesome/free-solid-svg-icons'
+library.add(faCircleQuestion);
 import { faTrashCan } from '@fortawesome/free-regular-svg-icons'
 library.add(faTrashCan);
 
-- 
GitLab