From 388137736280e88de26424d2db3e3a688a025ced Mon Sep 17 00:00:00 2001
From: Lene Wasskog <lene.wasskog@nibio.no>
Date: Wed, 14 May 2025 11:31:11 +0200
Subject: [PATCH] fix: Remove dropdown for crop category for already persisted
 timeseries [VIPSUTV-1067]

---
 .../templates/observationTimeSeriesForm.ftl    | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/main/webapp/templates/observationTimeSeriesForm.ftl b/src/main/webapp/templates/observationTimeSeriesForm.ftl
index b1db7bc5..722cf20f 100644
--- a/src/main/webapp/templates/observationTimeSeriesForm.ftl
+++ b/src/main/webapp/templates/observationTimeSeriesForm.ftl
@@ -420,14 +420,16 @@
                     <input type="hidden" name="locationPointOfInterestId" value="${observationTimeSeries.locationPointOfInterestId}">
                     <input type="hidden" name="locationVisibility" value="${locationVisibilityFormValue}">
                 <#else>
-                    <div class="form-group">
-                        <label for="cropCategoryIdList">${i18nBundle.listSelectedCropCategoryOnTop}</label>
-                        <select class="form-control" id="cropCategoryIdList" name="cropCategoryId"
-                                onchange="filterCrops(this.options[this.options.selectedIndex].value);">
-                            <option value="-1">${i18nBundle.pleaseSelect} ${i18nBundle.cropCategory?lower_case}</option>
-                            <!-- Options added by JavaScript function renderCropCategories() -->
-                        </select>
-                    </div>
+                    <#if ! observationTimeSeries.organism?has_content>
+                        <div class="form-group">
+                            <label for="cropCategoryIdList">${i18nBundle.listSelectedCropCategoryOnTop}</label>
+                            <select class="form-control" id="cropCategoryIdList" name="cropCategoryId"
+                                    onchange="filterCrops(this.options[this.options.selectedIndex].value);">
+                                <option value="-1">${i18nBundle.pleaseSelect} ${i18nBundle.cropCategory?lower_case}</option>
+                                <!-- Options added by JavaScript function renderCropCategories() -->
+                            </select>
+                        </div>
+                    </#if>
                     <div class="form-group">
                         <label for="cropOrganismIdList">${i18nBundle.cropOrganismId}</label>
                         <select class="form-control" id="cropOrganismIdList" name="cropOrganismId" onblur="validateField(this);" onchange="updateCropPests();">
-- 
GitLab