Skip to content

Commit

Permalink
fix: added Attachments tab in lead/deal page
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Oct 14, 2024
1 parent ae93b72 commit b40fd4a
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
19 changes: 19 additions & 0 deletions frontend/src/components/Activities/Activities.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<ActivityHeader
v-model="tabIndex"
v-model:showWhatsappTemplates="showWhatsappTemplates"
v-model:showFilesUploader="showFilesUploader"
:tabs="tabs"
:title="title"
:doc="doc"
Expand Down Expand Up @@ -362,6 +363,11 @@
:label="__('Create Task')"
@click="modalRef.showTask()"
/>
<Button
v-else-if="title == 'Attachments'"
:label="__('Upload Attachment')"
@click="showFilesUploader = true"
/>
</div>
</FadedScrollableDiv>
<div>
Expand Down Expand Up @@ -395,6 +401,12 @@
:doctype="doctype"
:doc="doc"
/>
<FilesUploader
v-if="doc.data?.name"
v-model="showFilesUploader"
:doctype="doctype"
:docname="doc.data.name"
/>
</template>
<script setup>
import ActivityHeader from '@/components/Activities/ActivityHeader.vue'
Expand All @@ -409,6 +421,7 @@ import Email2Icon from '@/components/Icons/Email2Icon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import NoteIcon from '@/components/Icons/NoteIcon.vue'
import TaskIcon from '@/components/Icons/TaskIcon.vue'
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
import WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
import WhatsAppArea from '@/components/Activities/WhatsAppArea.vue'
import WhatsAppBox from '@/components/Activities/WhatsAppBox.vue'
Expand All @@ -426,6 +439,7 @@ import FadedScrollableDiv from '@/components/FadedScrollableDiv.vue'
import CommunicationArea from '@/components/CommunicationArea.vue'
import WhatsappTemplateSelectorModal from '@/components/Modals/WhatsappTemplateSelectorModal.vue'
import AllModals from '@/components/Activities/AllModals.vue'
import FilesUploader from '@/components/FilesUploader/FilesUploader.vue'
import {
timeAgo,
dateFormat,
Expand Down Expand Up @@ -475,6 +489,7 @@ const tabIndex = defineModel('tabIndex')
const reload_email = ref(false)
const modalRef = ref(null)
const showFilesUploader = ref(false)
const title = computed(() => props.tabs?.[tabIndex.value]?.name || 'Activity')
Expand Down Expand Up @@ -667,6 +682,8 @@ const emptyText = computed(() => {
text = 'No Notes'
} else if (title.value == 'Tasks') {
text = 'No Tasks'
} else if (title.value == 'Attachments') {
text = 'No Attachments'
} else if (title.value == 'WhatsApp') {
text = 'No WhatsApp Messages'
}
Expand All @@ -685,6 +702,8 @@ const emptyTextIcon = computed(() => {
icon = NoteIcon
} else if (title.value == 'Tasks') {
icon = TaskIcon
} else if (title.value == 'Attachments') {
icon = AttachmentIcon
} else if (title.value == 'WhatsApp') {
icon = WhatsAppIcon
}
Expand Down
17 changes: 17 additions & 0 deletions frontend/src/components/Activities/ActivityHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@
</template>
<span>{{ __('New Task') }}</span>
</Button>
<Button
v-else-if="title == 'Attachments'"
variant="solid"
@click="showFilesUploader = true"
>
<template #prefix>
<FeatherIcon name="plus" class="h-4 w-4" />
</template>
<span>{{ __('Upload Attachment') }}</span>
</Button>
<div class="flex gap-2 shrink-0" v-else-if="title == 'WhatsApp'">
<Button
:label="__('Send Template')"
Expand Down Expand Up @@ -91,6 +101,7 @@ import CommentIcon from '@/components/Icons/CommentIcon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import NoteIcon from '@/components/Icons/NoteIcon.vue'
import TaskIcon from '@/components/Icons/TaskIcon.vue'
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
import WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
import { globalStore } from '@/stores/global'
import { whatsappEnabled, callEnabled } from '@/composables/settings'
Expand All @@ -110,6 +121,7 @@ const { makeCall } = globalStore()
const tabIndex = defineModel()
const showWhatsappTemplates = defineModel('showWhatsappTemplates')
const showFilesUploader = defineModel('showFilesUploader')
const defaultActions = computed(() => {
let actions = [
Expand Down Expand Up @@ -139,6 +151,11 @@ const defaultActions = computed(() => {
label: __('New Task'),
onClick: () => props.modalRef.showTask(),
},
{
icon: h(AttachmentIcon, { class: 'h-4 w-4' }),
label: __('Upload Attachment'),
onClick: () => (showFilesUploader.value = true),
},
{
icon: h(WhatsAppIcon, { class: 'h-4 w-4' }),
label: __('New WhatsApp Message'),
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/Deal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ const tabs = computed(() => {
label: __('Notes'),
icon: NoteIcon,
},
{
name: 'Attachments',
label: __('Attachments'),
icon: AttachmentIcon,
},
{
name: 'WhatsApp',
label: __('WhatsApp'),
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/Lead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ const tabs = computed(() => {
label: __('Notes'),
icon: NoteIcon,
},
{
name: 'Attachments',
label: __('Attachments'),
icon: AttachmentIcon,
},
{
name: 'WhatsApp',
label: __('WhatsApp'),
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/pages/MobileDeal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ import CommentIcon from '@/components/Icons/CommentIcon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import TaskIcon from '@/components/Icons/TaskIcon.vue'
import NoteIcon from '@/components/Icons/NoteIcon.vue'
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
import WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import ArrowUpRightIcon from '@/components/Icons/ArrowUpRightIcon.vue'
Expand Down Expand Up @@ -467,6 +468,11 @@ const tabs = computed(() => {
label: __('Notes'),
icon: NoteIcon,
},
{
name: 'Attachments',
label: __('Attachments'),
icon: AttachmentIcon,
},
{
name: 'WhatsApp',
label: __('WhatsApp'),
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/pages/MobileLead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ import CommentIcon from '@/components/Icons/CommentIcon.vue'
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
import TaskIcon from '@/components/Icons/TaskIcon.vue'
import NoteIcon from '@/components/Icons/NoteIcon.vue'
import AttachmentIcon from '@/components/Icons/AttachmentIcon.vue'
import WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
Expand Down Expand Up @@ -377,6 +378,11 @@ const tabs = computed(() => {
label: __('Notes'),
icon: NoteIcon,
},
{
name: 'Attachments',
label: __('Attachments'),
icon: AttachmentIcon,
},
{
name: 'WhatsApp',
label: __('WhatsApp'),
Expand Down

0 comments on commit b40fd4a

Please sign in to comment.