1
0
forked from test/crm

fix: attachments tab design similar to tasks

This commit is contained in:
Shariq Ansari 2024-10-17 17:15:23 +05:30
parent 3c7ba5e079
commit dc1c2d36a0
3 changed files with 79 additions and 74 deletions

View File

@ -67,13 +67,7 @@
v-else-if="title == 'Tasks'" v-else-if="title == 'Tasks'"
class="px-3 pb-3 sm:px-10 sm:pb-5 overflow-x-auto sm:w-full w-max" class="px-3 pb-3 sm:px-10 sm:pb-5 overflow-x-auto sm:w-full w-max"
> >
<TaskArea <TaskArea :modalRef="modalRef" :tasks="activities" :doctype="doctype" />
v-model="all_activities"
v-model:doc="doc"
:modalRef="modalRef"
:tasks="activities"
:doctype="doctype"
/>
</div> </div>
<div v-else-if="title == 'Calls'" class="activity"> <div v-else-if="title == 'Calls'" class="activity">
<div v-for="(call, i) in activities"> <div v-for="(call, i) in activities">
@ -104,20 +98,15 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else-if="title == 'Attachments'">
<div class="flex flex-col gap-2 px-3 sm:px-10 mb-4">
<div <div
v-for="attachment in activities" v-else-if="title == 'Attachments'"
:key="attachment.name" class="px-3 pb-3 sm:px-10 sm:pb-5 overflow-x-auto sm:w-full w-max"
class="activity"
> >
<AttachmentArea <AttachmentArea
:attachment="attachment" :attachments="activities"
@reload="all_activities.reload() && scroll()" @reload="all_activities.reload() && scroll()"
/> />
</div> </div>
</div>
</div>
<div <div
v-else v-else
v-for="(activity, i) in activities" v-for="(activity, i) in activities"

View File

@ -1,11 +1,13 @@
<template> <template>
<div v-if="attachments.length">
<div v-for="(attachment, i) in attachments" :key="attachment.name">
<div <div
class="flex justify-between gap-2 border rounded text-base px-3 py-2 cursor-pointer" class="activity flex justify-between gap-2 hover:bg-gray-50 rounded text-base p-2.5 cursor-pointer"
@click="openFile" @click="openFile(attachment)"
> >
<div class="flex gap-2 truncate"> <div class="flex gap-2 truncate">
<div <div
class="size-11 rounded overflow-hidden flex-shrink-0 flex justify-center items-center" class="size-11 bg-white rounded overflow-hidden flex-shrink-0 flex justify-center items-center"
:class="{ border: !isImage(attachment.file_type) }" :class="{ border: !isImage(attachment.file_type) }"
> >
<img <img
@ -14,7 +16,11 @@
:src="attachment.file_url" :src="attachment.file_url"
:alt="attachment.file_name" :alt="attachment.file_name"
/> />
<component v-else class="size-4" :is="fileIcon(attachment.file_type)" /> <component
v-else
class="size-4"
:is="fileIcon(attachment.file_type)"
/>
</div> </div>
<div class="flex flex-col justify-center gap-1 truncate"> <div class="flex flex-col justify-center gap-1 truncate">
<div class="text-base text-gray-800 truncate"> <div class="text-base text-gray-800 truncate">
@ -33,11 +39,15 @@
</Tooltip> </Tooltip>
<div class="flex gap-1"> <div class="flex gap-1">
<Tooltip <Tooltip
:text="attachment.is_private ? __('Make public') : __('Make private')" :text="
attachment.is_private ? __('Make public') : __('Make private')
"
> >
<Button <Button
class="!size-5" class="!size-5"
@click.stop="togglePrivate(attachment.name, attachment.is_private)" @click.stop="
togglePrivate(attachment.name, attachment.is_private)
"
> >
<FeatherIcon <FeatherIcon
:name="attachment.is_private ? 'lock' : 'unlock'" :name="attachment.is_private ? 'lock' : 'unlock'"
@ -56,6 +66,12 @@
</div> </div>
</div> </div>
</div> </div>
<div
v-if="i < attachments.length - 1"
class="mx-2 h-px border-t border-gray-200"
/>
</div>
</div>
</template> </template>
<script setup> <script setup>
import FileAudioIcon from '@/components/Icons/FileAudioIcon.vue' import FileAudioIcon from '@/components/Icons/FileAudioIcon.vue'
@ -72,15 +88,15 @@ import {
} from '@/utils' } from '@/utils'
const props = defineProps({ const props = defineProps({
attachment: Object, attachments: Array,
}) })
const emit = defineEmits(['reload']) const emit = defineEmits(['reload'])
const { $dialog } = globalStore() const { $dialog } = globalStore()
function openFile() { function openFile(attachment) {
window.open(props.attachment.file_url, '_blank') window.open(attachment.file_url, '_blank')
} }
function togglePrivate(fileName, isPrivate) { function togglePrivate(fileName, isPrivate) {

View File

@ -1,6 +1,6 @@
<template> <template>
<div v-if="tasks.length"> <div v-if="tasks.length">
<div v-for="(task, i) in tasks"> <div v-for="(task, i) in tasks" :key="task.name">
<div <div
class="activity flex cursor-pointer gap-6 rounded p-2.5 duration-300 ease-in-out hover:bg-gray-50" class="activity flex cursor-pointer gap-6 rounded p-2.5 duration-300 ease-in-out hover:bg-gray-50"
@click="modalRef.showTask(task)" @click="modalRef.showTask(task)"