From d5f419efdaa51c4c9a0f91400a2bbe945a8c9156 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Sat, 25 Jan 2025 15:47:08 +0530 Subject: [PATCH] fix: different autmation rule fields for different types of automation rules, as conversation update and time triggers don't need conversation content & subject. --- .../admin/automation/CreateOrEditRule.vue | 11 ++++ .../components/admin/automation/RuleBox.vue | 36 ++++++++++--- .../src/composables/useConversationFilters.js | 51 ++++++++++++++++++- 3 files changed, 91 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/admin/automation/CreateOrEditRule.vue b/frontend/src/components/admin/automation/CreateOrEditRule.vue index 0b4e4025..79bf32f2 100644 --- a/frontend/src/components/admin/automation/CreateOrEditRule.vue +++ b/frontend/src/components/admin/automation/CreateOrEditRule.vue @@ -96,6 +96,7 @@ @update-group="handleUpdateGroup" @add-condition="handleAddCondition" @remove-condition="handleRemoveCondition" + :type="form.values.type" :groupIndex="0" /> @@ -121,6 +122,7 @@ @update-group="handleUpdateGroup" @add-condition="handleAddCondition" @remove-condition="handleRemoveCondition" + :type="form.values.type" :groupIndex="1" />

Perform these actions

@@ -361,6 +363,15 @@ const areRulesValid = () => { if (rule.value.rules[0].groups[0].rules.length == 0) { return false } + + // Make sure each rule has all the required fields. + for (const group of rule.value.rules[0].groups) { + for (const rule of group.rules) { + if (!rule.value || !rule.operator || !rule.field) { + return false + } + } + } return true } diff --git a/frontend/src/components/admin/automation/RuleBox.vue b/frontend/src/components/admin/automation/RuleBox.vue index 1598e310..439519e8 100644 --- a/frontend/src/components/admin/automation/RuleBox.vue +++ b/frontend/src/components/admin/automation/RuleBox.vue @@ -36,7 +36,7 @@ Conversation - + {{ field.label }} @@ -157,6 +157,7 @@ +

Press enter to select a value

@@ -184,7 +185,7 @@