diff --git a/resources/js/views/form/Conditions.vue b/resources/js/views/form/Conditions.vue
index ad38db12..a494075e 100644
--- a/resources/js/views/form/Conditions.vue
+++ b/resources/js/views/form/Conditions.vue
@@ -10,17 +10,24 @@
Bedingung einfügen
-
+
+
@@ -57,10 +71,10 @@ const props = defineProps({
});
const comparatorOptions = ref([
- {id: 'isEqual', name: 'ist gleich', defaultValue: null},
- {id: 'isNotEqual', name: 'ist ungleich', defaultValue: null},
- {id: 'isIn', name: 'ist in', defaultValue: []},
- {id: 'isNotIn', name: 'ist nicht in', defaultValue: []},
+ {id: 'isEqual', name: 'ist gleich', defaultValue: {DropdownField: null, RadioField: null, CheckboxField: false}},
+ {id: 'isNotEqual', name: 'ist ungleich', defaultValue: {DropdownField: null, RadioField: null, CheckboxField: false}},
+ {id: 'isIn', name: 'ist in', defaultValue: {DropdownField: [], RadioField: [], CheckboxField: false}},
+ {id: 'isNotIn', name: 'ist nicht in', defaultValue: {DropdownField: [], RadioField: [], CheckboxField: false}},
]);
const modeOptions = ref([
@@ -81,9 +95,23 @@ const fields = computed(() => {
return result;
});
-function updateComparator(condition, comparator) {
- condition.value = comparatorOptions.value.find((c) => c.id === comparator).defaultValue;
- condition.comparator = comparator;
+function update(index, key, value) {
+ if (key === 'comparator') {
+ var old = inner.value.ifs[index];
+ inner.value.ifs[index] = {
+ field: old.field,
+ comparator: value,
+ value: old.field ? comparatorOptions.value.find((c) => c.id === value).defaultValue[getField(old.field).type] : null,
+ };
+ }
+ if (key === 'field') {
+ var old = inner.value.ifs[index];
+ inner.value.ifs[index] = {
+ field: value,
+ comparator: null,
+ value: null,
+ };
+ }
}
function getField(fieldName) {