Skip to content
Snippets Groups Projects
Commit 9587ca3f authored by Timothee P's avatar Timothee P :sunflower:
Browse files

Merge branch 'develop' into redmine-issues/18348

parents 563aea67 ca1d1678
No related branches found
No related tags found
1 merge request!669REDMINE_ISSUE-18348 | import geojson avec champ pre_recorded_list
import featureAPI from '@/services/feature-api';
import { isNil } from 'lodash';
export function formatStringDate(stringDate) {
const date = new Date(stringDate);
if (date instanceof Date && !isNaN(date.valueOf())) {
......@@ -202,12 +202,17 @@ export function isXtraFormActive(extraForms, config) { // return true if no conf
const { conditionField, conditionValue } = config;
// get the customForm which activates conditional field
const conditioningXForm = extraForms.find((xForm) => xForm.name === conditionField);
// check if its value match the condition value
// check if the conditioning extraform value match the condition value
if (conditioningXForm) {
if (Array.isArray(conditionValue) && conditioningXForm.value) {
// if the values to compare are null or undefined the field can't be activated
if (isNil(conditioningXForm.value) || isNil(conditionValue)) {
return false;
} else if (Array.isArray(conditionValue) && Array.isArray(conditioningXForm.value)) { // case of multiple list or prerecorded values list
return conditioningXForm.value.some((value) => conditionValue.includes(value));
} else if (typeof conditioningXForm.value === 'object' && conditioningXForm.value.label) { // case of simple list
return conditioningXForm.value.label === conditionValue.label;
} else {
return conditioningXForm.value === conditionValue;
return conditioningXForm.value === conditionValue; // more simple case of other fields
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment