diff --git a/resources/js/components/field-conditions/Builder.vue b/resources/js/components/field-conditions/Builder.vue index 95e75da164..04d65a4fc9 100644 --- a/resources/js/components/field-conditions/Builder.vue +++ b/resources/js/components/field-conditions/Builder.vue @@ -31,6 +31,7 @@ :index="index" :config="config" :condition="condition" + :conditions="conditions" :key="condition._id" :suggestable-fields="suggestableFields" @updated="updated(index, $event)" diff --git a/resources/js/components/field-conditions/Condition.vue b/resources/js/components/field-conditions/Condition.vue index 34460c111c..a00f387b9a 100644 --- a/resources/js/components/field-conditions/Condition.vue +++ b/resources/js/components/field-conditions/Condition.vue @@ -82,6 +82,10 @@ export default { type: Object, required: true }, + conditions: { + type: Array, + required: true + }, index: { type: Number, required: true @@ -116,8 +120,14 @@ export default { }, fieldOptions() { + const conditions = this.conditions.map(condition => condition.field); + return _(this.suggestableFields) - .reject(field => field.handle === this.config.handle || this.condition.field === field.handle) + .reject(field => { + return field.handle === this.config.handle // Exclude the field you're adding a condition to. + || this.condition.field === field.handle // Exclude the field being used in the current condition. + || conditions.includes(field.handle); // Exclude fields already used in other conditions. + }) .map(field => { let display = field.config.display;