Skip to content
Snippets Groups Projects
Commit f99ba070 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Show grid weather data option in forecast config form only if current organization supports it

parent 2cbe908c
Branches
No related tags found
1 merge request!191Add map module and Open-Meteo support
......@@ -15,6 +15,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
--><#include "master.ftl">
<#assign isGridForecastSupported = (user.organizationId.defaultGridWeatherStationDataSource?has_content)>
<#macro page_head>
<title>${i18nBundle.viewForecastConfiguration}</title>
</#macro>
......@@ -229,7 +230,9 @@
};
// Setting weather station select list state correct on page load
<#if isGridForecastSupported>
handleUseGridWeatherDataClicked(document.getElementById("useGridWeatherData")<#if forecastConfiguration.weatherStationPointOfInterestId?has_content && forecastConfiguration.weatherStationPointOfInterestId.pointOfInterestId?has_content>,${forecastConfiguration.weatherStationPointOfInterestId.pointOfInterestId}</#if>);
</#if>
</script>
</#macro>
......@@ -325,7 +328,9 @@
<div class="form-group">
<label for="weatherStationPointOfInterestId">${i18nBundle.weatherStationPointOfInterestId}</label>
<select class="form-control" id="weatherStationPointOfInterestId" name="weatherStationPointOfInterestId" onblur="if(!document.getElementById('useGridWeatherData').checked) {validateField(this);};">
<option value="-2">${i18nBundle.doNotUse} ${i18nBundle.weatherStationPointOfInterestId?lower_case}</option>
<#if isGridForecastSupported>
<option value="-2">${i18nBundle.doNotUse} ${i18nBundle.weatherStationPointOfInterestId?lower_case}</option>
</#if>
<option value="-1"<#if !forecastConfiguration.weatherStationPointOfInterestId?has_content && !forecastConfiguration.useGridWeatherData> selected="selected"</#if>>${i18nBundle.pleaseSelect} ${i18nBundle.weatherStationPointOfInterestId?lower_case}</option>
<#list weatherStationPointOfInterests?sort_by("name") as poi>
<option value="${poi.pointOfInterestId}"<#if
......@@ -336,15 +341,17 @@
</select>
<span class="help-block" id="${formId}_weatherStationPointOfInterestId_validation"></span>
</div>
<input type="hidden" id="weatherStationPointOfInterestIdHidden" name="weatherStationPointOfInterestIdDisabled" value="-2" disabled="disabled"/>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" id="useGridWeatherData" name="useGridWeatherData"<#if forecastConfiguration.useGridWeatherData?has_content && forecastConfiguration.useGridWeatherData == true> checked="checked"</#if> onclick="handleUseGridWeatherDataClicked(this);"/>
</label>
${i18nBundle.useGridWeatherData}
<span class="help-block" id="${formId}_useGridWeatherData_validation"></span>
</div>
<#if isGridForecastSupported>
<input type="hidden" id="weatherStationPointOfInterestIdHidden" name="weatherStationPointOfInterestIdDisabled" value="-2" disabled="disabled"/>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" id="useGridWeatherData" name="useGridWeatherData"<#if forecastConfiguration.useGridWeatherData?has_content && forecastConfiguration.useGridWeatherData == true> checked="checked"</#if> onclick="handleUseGridWeatherDataClicked(this);"/>
</label>
${i18nBundle.useGridWeatherData}
<span class="help-block" id="${formId}_useGridWeatherData_validation"></span>
</div>
</#if>
<#else>
<input type="hidden" name="multipleNew" value="true"/>
<div class="form-group">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment