feat: add labels

This commit is contained in:
Muhsin Keloth
2024-03-29 13:59:16 +05:30
parent 89cac2dec7
commit cf1a8c4b17
6 changed files with 25 additions and 7 deletions
@@ -45,6 +45,11 @@ export default {
type: Number,
required: true,
},
conversationLabels: {
type: String,
required: false,
default: '',
},
},
data() {
return {
@@ -4,6 +4,10 @@ export default {
computed: {
...mapGetters({ accountLabels: 'labels/getLabels' }),
savedLabels() {
// If conversationLabels is passed as prop, use it
if (this.conversationLabels)
return this.conversationLabels.split(',').map(item => item.trim());
// Otherwise, get labels from store
return this.$store.getters['conversationLabels/getConversationLabels'](
this.conversationId
);
@@ -8,7 +8,6 @@
:sla-reports="slaReports"
:current-page="Number(slaMeta.currentPage)"
:total-count="Number(slaMeta.count)"
:page-size="3"
@page-change="onPageChange"
/>
</div>
@@ -9,6 +9,10 @@ defineProps({
type: Number,
required: true,
},
conversation: {
type: Object,
required: true,
},
});
</script>
@@ -24,8 +28,11 @@ defineProps({
<div
class="flex items-center col-span-6 px-0 py-2 text-sm tracking-[0.5] text-slate-700 dark:text-slate-100 rtl:text-right"
>
#{{ conversationId }} with John Doe
<card-labels :conversation-id="148" />
#{{ conversationId }} with {{ conversation.contact.name }}
<card-labels
:conversation-id="conversationId"
:conversation-labels="conversation.labels"
/>
</div>
<div
class="flex items-center col-span-2 px-0 py-2 text-sm tracking-[0.5] text-slate-700 dark:text-slate-100 rtl:text-right"
@@ -30,7 +30,8 @@
v-for="sla in slaReports"
:key="sla.id"
:sla-name="sla.sla_policy.name"
:conversation-id="sla.conversation.id"
:conversation="sla.conversation"
:conversation-id="sla.conversation_id"
/>
</div>
<table-footer
@@ -1,5 +1,3 @@
json.payload do
json.array! @applied_slas do |applied_sla|
json.id applied_sla.id
@@ -9,7 +7,11 @@ json.payload do
json.created_at applied_sla.created_at
json.updated_at applied_sla.updated_at
json.conversation do
json.partial! 'api/v1/models/conversation', conversation: applied_sla.conversation
json.contact do
json.name applied_sla.conversation.contact.name
end
json.labels applied_sla.conversation.cached_label_list
json.assignee applied_sla.conversation.assignee
end
json.sla_events applied_sla.sla_events do |sla_event|
json.partial! 'api/v1/models/sla_event', formats: [:json], sla_event: sla_event