Skip to content

Commit beaf544

Browse files
authored
Merge pull request #381 from shariquerik/email-status
fix: show email status read/sent on UI
2 parents ecfadea + dd441fb commit beaf544

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

crm/api/activities.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ def get_deal_activities(name):
125125
"bcc": communication.bcc,
126126
"attachments": get_attachments('Communication', communication.name),
127127
"read_by_recipient": communication.read_by_recipient,
128+
"delivery_status": communication.delivery_status,
128129
},
129130
"is_lead": False,
130131
}
@@ -238,6 +239,7 @@ def get_lead_activities(name):
238239
"bcc": communication.bcc,
239240
"attachments": get_attachments('Communication', communication.name),
240241
"read_by_recipient": communication.read_by_recipient,
242+
"delivery_status": communication.delivery_status,
241243
},
242244
"is_lead": True,
243245
}

frontend/src/components/Activities/EmailArea.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
/>
1717
</div>
1818
<div class="flex items-center gap-2 shrink-0">
19+
<Badge
20+
v-if="status.label"
21+
:label="__(status.label)"
22+
variant="subtle"
23+
:theme="status.color"
24+
/>
1925
<Tooltip :text="dateFormat(activity.creation, dateTooltipFormat)">
2026
<div class="text-sm text-gray-600">
2127
{{ __(timeAgo(activity.creation)) }}
@@ -87,6 +93,7 @@ import AttachmentItem from '@/components/AttachmentItem.vue'
8793
import EmailContent from '@/components/Activities/EmailContent.vue'
8894
import { Badge, Tooltip } from 'frappe-ui'
8995
import { timeAgo, dateFormat, dateTooltipFormat } from '@/utils'
96+
import { computed } from 'vue'
9097
9198
const props = defineProps({
9299
activity: Object,
@@ -140,4 +147,19 @@ function reply(email, reply_all = false) {
140147
.focus('start')
141148
.run()
142149
}
150+
151+
const status = computed(() => {
152+
let _status = props.activity?.data?.delivery_status
153+
let indicator_color = 'red'
154+
if (['Sent', 'Clicked'].includes(_status)) {
155+
indicator_color = 'green'
156+
} else if (['Sending', 'Scheduled'].includes(_status)) {
157+
indicator_color = 'orange'
158+
} else if (['Opened', 'Read'].includes(_status)) {
159+
indicator_color = 'blue'
160+
} else if (_status == 'Error') {
161+
indicator_color = 'red'
162+
}
163+
return { label: _status, color: indicator_color }
164+
})
143165
</script>

0 commit comments

Comments
 (0)