diff --git a/app/javascript/dashboard/components-next/ConversationWorkflow/AttributeListItem.vue b/app/javascript/dashboard/components-next/ConversationWorkflow/AttributeListItem.vue new file mode 100644 index 000000000..c91352dcd --- /dev/null +++ b/app/javascript/dashboard/components-next/ConversationWorkflow/AttributeListItem.vue @@ -0,0 +1,82 @@ + + + + + + + + {{ attribute.label }} + + + + {{ attribute.type }} + + + {{ attribute.value }} + + + + + + + + + + + + {{ attribute.attribute_description || attribute.description || '' }} + + + diff --git a/app/javascript/dashboard/components-next/tabbar/TabBar.vue b/app/javascript/dashboard/components-next/tabbar/TabBar.vue index 1b08b838c..552d356ac 100644 --- a/app/javascript/dashboard/components-next/tabbar/TabBar.vue +++ b/app/javascript/dashboard/components-next/tabbar/TabBar.vue @@ -20,7 +20,7 @@ const props = defineProps({ }, }); -const emit = defineEmits(['tabChanged']); +const emit = defineEmits(['change', 'tabChanged']); const activeTab = computed(() => props.initialActiveTab); @@ -51,6 +51,7 @@ onMounted(() => { }); const selectTab = index => { + emit('change', index); emit('tabChanged', props.tabs[index]); }; diff --git a/app/javascript/dashboard/routes/dashboard/settings/attributes/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/attributes/Index.vue index 636892005..842222c98 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/attributes/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/attributes/Index.vue @@ -2,9 +2,11 @@ import { computed, onMounted, ref } from 'vue'; import BaseSettingsHeader from '../components/BaseSettingsHeader.vue'; import AddAttribute from './AddAttribute.vue'; -import CustomAttribute from './CustomAttribute.vue'; +import EditAttribute from './EditAttribute.vue'; import SettingsLayout from '../SettingsLayout.vue'; import Button from 'dashboard/components-next/button/Button.vue'; +import TabBar from 'dashboard/components-next/tabbar/TabBar.vue'; +import AttributeListItem from 'dashboard/components-next/ConversationWorkflow/AttributeListItem.vue'; import { useI18n } from 'vue-i18n'; import { useStoreGetters, useStore } from 'dashboard/composables/store'; @@ -16,6 +18,9 @@ const store = useStore(); const showAddPopup = ref(false); const selectedTabIndex = ref(0); const uiFlags = computed(() => getters['attributes/getUIFlags'].value); +const showEditPopup = ref(false); +const showDeletePopup = ref(false); +const selectedAttribute = ref({}); const openAddPopup = () => { showAddPopup.value = true; @@ -23,6 +28,14 @@ const openAddPopup = () => { const hideAddPopup = () => { showAddPopup.value = false; }; +const hideEditPopup = () => { + showEditPopup.value = false; + selectedAttribute.value = {}; +}; +const closeDelete = () => { + showDeletePopup.value = false; + selectedAttribute.value = {}; +}; const tabs = computed(() => { return [ @@ -49,9 +62,23 @@ const attributes = computed(() => getters['attributes/getAttributesByModel'].value(attributeModel.value) ); -const onClickTabChange = index => { - selectedTabIndex.value = index; +const onClickTabChange = payload => { + selectedTabIndex.value = typeof payload === 'number' ? payload : payload?.key; }; + +const handleEditAttribute = attribute => { + selectedAttribute.value = attribute; + showEditPopup.value = true; +}; + +const handleDeleteAttribute = attribute => { + selectedAttribute.value = attribute; + showDeletePopup.value = true; +}; + +const badges = computed(() => { + return ['pre-chat', 'resolution']; +}); @@ -77,27 +104,30 @@ const onClickTabChange = index => { - - - - - - + + + + + + { :on-close="hideAddPopup" :selected-attribute-model-tab="selectedTabIndex" /> + + + + { + store.dispatch('attributes/delete', selectedAttribute.id); + closeDelete(); + } + " + @on-close="closeDelete" + />
+ {{ attribute.attribute_description || attribute.description || '' }} +