Merge pull request #200 from frappe/develop
chore: Merge develop to main
1
.gitignore
vendored
@ -3,6 +3,7 @@
|
||||
*.egg-info
|
||||
*.swp
|
||||
__pycache__
|
||||
dev-dist
|
||||
tags
|
||||
node_modules
|
||||
crm/public/frontend
|
||||
|
||||
|
Before Width: | Height: | Size: 190 KiB |
BIN
crm/public/manifest/apple-icon-180.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
crm/public/manifest/apple-splash-1125-2436.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
crm/public/manifest/apple-splash-1136-640.jpg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
crm/public/manifest/apple-splash-1170-2532.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
crm/public/manifest/apple-splash-1179-2556.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
crm/public/manifest/apple-splash-1242-2208.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
crm/public/manifest/apple-splash-1242-2688.jpg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
crm/public/manifest/apple-splash-1284-2778.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
crm/public/manifest/apple-splash-1290-2796.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
crm/public/manifest/apple-splash-1334-750.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
crm/public/manifest/apple-splash-1488-2266.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
crm/public/manifest/apple-splash-1536-2048.jpg
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
crm/public/manifest/apple-splash-1620-2160.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
crm/public/manifest/apple-splash-1640-2360.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
crm/public/manifest/apple-splash-1668-2224.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
crm/public/manifest/apple-splash-1668-2388.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
crm/public/manifest/apple-splash-1792-828.jpg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
crm/public/manifest/apple-splash-2048-1536.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
crm/public/manifest/apple-splash-2048-2732.jpg
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
crm/public/manifest/apple-splash-2160-1620.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
crm/public/manifest/apple-splash-2208-1242.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
crm/public/manifest/apple-splash-2224-1668.jpg
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
crm/public/manifest/apple-splash-2266-1488.jpg
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
crm/public/manifest/apple-splash-2360-1640.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
crm/public/manifest/apple-splash-2388-1668.jpg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
crm/public/manifest/apple-splash-2436-1125.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
crm/public/manifest/apple-splash-2532-1170.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
crm/public/manifest/apple-splash-2556-1179.jpg
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
crm/public/manifest/apple-splash-2688-1242.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
crm/public/manifest/apple-splash-2732-2048.jpg
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
crm/public/manifest/apple-splash-2778-1284.jpg
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
crm/public/manifest/apple-splash-2796-1290.jpg
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
crm/public/manifest/apple-splash-640-1136.jpg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
crm/public/manifest/apple-splash-750-1334.jpg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
crm/public/manifest/apple-splash-828-1792.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
crm/public/manifest/manifest-icon-192.maskable.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
crm/public/manifest/manifest-icon-512.maskable.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
@ -2,16 +2,180 @@
|
||||
<html class="h-full" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, viewport-fit=cover maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<title>Frappe CRM</title>
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-title" content="Frappe CRM" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="white" />
|
||||
|
||||
<!-- PWA -->
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="196x196"
|
||||
href="/assets/crm/crm_logo.png"
|
||||
href="/assets/crm/manifest/apple-icon-180.png"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
href="/assets/crm/manifest/apple-icon-180.png"
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2048-2732.jpg"
|
||||
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2732-2048.jpg"
|
||||
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1668-2388.jpg"
|
||||
media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2388-1668.jpg"
|
||||
media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1536-2048.jpg"
|
||||
media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2048-1536.jpg"
|
||||
media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1668-2224.jpg"
|
||||
media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2224-1668.jpg"
|
||||
media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1620-2160.jpg"
|
||||
media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2160-1620.jpg"
|
||||
media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1290-2796.jpg"
|
||||
media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2796-1290.jpg"
|
||||
media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1179-2556.jpg"
|
||||
media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2556-1179.jpg"
|
||||
media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1284-2778.jpg"
|
||||
media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2778-1284.jpg"
|
||||
media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1170-2532.jpg"
|
||||
media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2532-1170.jpg"
|
||||
media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1125-2436.jpg"
|
||||
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2436-1125.jpg"
|
||||
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1242-2688.jpg"
|
||||
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2688-1242.jpg"
|
||||
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-828-1792.jpg"
|
||||
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1792-828.jpg"
|
||||
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1242-2208.jpg"
|
||||
media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-2208-1242.jpg"
|
||||
media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-750-1334.jpg"
|
||||
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1334-750.jpg"
|
||||
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-640-1136.jpg"
|
||||
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
|
||||
/>
|
||||
<link
|
||||
rel="apple-touch-startup-image"
|
||||
href="/assets/crm/manifest/apple-splash-1136-640.jpg"
|
||||
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
|
||||
/>
|
||||
</head>
|
||||
<body class="overscroll-y-none no-scrollbar">
|
||||
<body class="sm:overscroll-y-none no-scrollbar">
|
||||
<div id="app" class="h-full"></div>
|
||||
<div id="modals"></div>
|
||||
<div id="popovers"></div>
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"postcss": "^8.4.5",
|
||||
"vite": "^4.4.9"
|
||||
"vite": "^4.4.9",
|
||||
"vite-plugin-pwa": "^0.15.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,31 @@
|
||||
<template>
|
||||
<router-view v-if="$route.name == 'Login'" />
|
||||
<DesktopLayout v-else-if="session().isLoggedIn">
|
||||
<Layout v-else-if="session().isLoggedIn">
|
||||
<router-view />
|
||||
</DesktopLayout>
|
||||
</Layout>
|
||||
<Dialogs />
|
||||
<Toasts />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import DesktopLayout from '@/components/Layouts/DesktopLayout.vue'
|
||||
import { Dialogs } from '@/utils/dialogs'
|
||||
import { sessionStore as session } from '@/stores/session'
|
||||
import { useScreenSize } from '@/composables'
|
||||
import { Toasts } from 'frappe-ui'
|
||||
import { computed, defineAsyncComponent } from 'vue'
|
||||
|
||||
const screenSize = useScreenSize()
|
||||
const MobileLayout = defineAsyncComponent(() =>
|
||||
import('./components/Layouts/MobileLayout.vue')
|
||||
)
|
||||
const DesktopLayout = defineAsyncComponent(() =>
|
||||
import('./components/Layouts/DesktopLayout.vue')
|
||||
)
|
||||
const Layout = computed(() => {
|
||||
if (screenSize.width < 640) {
|
||||
return MobileLayout
|
||||
} else {
|
||||
return DesktopLayout
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div
|
||||
class="mx-10 mb-4 mt-8 flex items-center justify-between text-lg font-medium"
|
||||
class="mx-4 my-3 flex items-center justify-between text-lg font-medium sm:mx-10 sm:mb-4 sm:mt-8"
|
||||
>
|
||||
<div class="flex h-8 items-center text-xl font-semibold text-gray-800">
|
||||
{{ __(title) }}
|
||||
@ -56,7 +56,7 @@
|
||||
<template #prefix>
|
||||
<FeatherIcon name="plus" class="h-4 w-4" />
|
||||
</template>
|
||||
<span>{{ __('New WhatsApp Message') }}</span>
|
||||
<span>{{ __('New Message') }}</span>
|
||||
</Button>
|
||||
</div>
|
||||
<Dropdown v-else :options="defaultActions" @click.stop>
|
||||
@ -89,7 +89,7 @@
|
||||
class="activities flex-1 overflow-y-auto"
|
||||
>
|
||||
<WhatsAppArea
|
||||
class="px-10"
|
||||
class="px-4 sm:px-10"
|
||||
v-model="whatsappMessages"
|
||||
v-model:reply="replyMessage"
|
||||
:messages="whatsappMessages.data"
|
||||
@ -102,7 +102,7 @@
|
||||
>
|
||||
<div
|
||||
v-if="title == 'Notes'"
|
||||
class="activity grid grid-cols-1 gap-4 px-10 pb-5 lg:grid-cols-2 xl:grid-cols-3"
|
||||
class="activity grid grid-cols-1 gap-4 px-4 pb-3 sm:px-10 sm:pb-5 lg:grid-cols-2 xl:grid-cols-3"
|
||||
>
|
||||
<div
|
||||
v-for="note in activities"
|
||||
@ -158,7 +158,9 @@
|
||||
</div>
|
||||
<div v-else-if="title == 'Comments'" class="activity pb-5">
|
||||
<div v-for="(comment, i) in activities">
|
||||
<div class="grid grid-cols-[30px_minmax(auto,_1fr)] gap-4 px-10">
|
||||
<div
|
||||
class="grid grid-cols-[30px_minmax(auto,_1fr)] sm:gap-4 gap-2 px-4 sm:px-10"
|
||||
>
|
||||
<div
|
||||
class="relative flex justify-center after:absolute after:left-[50%] after:top-0 after:-z-10 after:border-l after:border-gray-200"
|
||||
:class="i != activities.length - 1 ? 'after:h-full' : 'after:h-4'"
|
||||
@ -212,7 +214,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="title == 'Tasks'" class="activity px-10 pb-5">
|
||||
<div
|
||||
v-else-if="title == 'Tasks'"
|
||||
class="activity px-4 pb-3 sm:px-10 sm:pb-5"
|
||||
>
|
||||
<div v-for="(task, i) in activities">
|
||||
<div
|
||||
class="flex cursor-pointer gap-6 rounded p-2.5 duration-300 ease-in-out hover:bg-gray-50"
|
||||
@ -307,7 +312,9 @@
|
||||
</div>
|
||||
<div v-else-if="title == 'Calls'" class="activity">
|
||||
<div v-for="(call, i) in activities">
|
||||
<div class="grid grid-cols-[30px_minmax(auto,_1fr)] gap-4 px-10">
|
||||
<div
|
||||
class="grid grid-cols-[30px_minmax(auto,_1fr)] gap-4 px-4 sm:px-10"
|
||||
>
|
||||
<div
|
||||
class="relative flex justify-center after:absolute after:left-[50%] after:top-0 after:-z-10 after:border-l after:border-gray-200"
|
||||
:class="i != activities.length - 1 ? 'after:h-full' : 'after:h-4'"
|
||||
@ -324,7 +331,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="mb-3 flex max-w-[70%] flex-col gap-3 rounded-md bg-gray-50 p-4"
|
||||
class="mb-3 flex flex-col gap-3 rounded-md bg-gray-50 p-4 sm:max-w-[70%]"
|
||||
>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
@ -410,8 +417,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div v-else v-for="(activity, i) in activities" class="activity">
|
||||
<div class="grid grid-cols-[30px_minmax(auto,_1fr)] gap-4 px-10">
|
||||
<div
|
||||
class="px-4 sm:px-10"
|
||||
:class="
|
||||
title == 'Activity'
|
||||
? 'grid grid-cols-[30px_minmax(auto,_1fr)] sm:gap-4 gap-2'
|
||||
: ''
|
||||
"
|
||||
>
|
||||
<div
|
||||
v-if="title == 'Activity'"
|
||||
class="relative flex justify-center before:absolute before:left-[50%] before:top-0 before:-z-10 before:border-l before:border-gray-200"
|
||||
:class="[
|
||||
i != activities.length - 1 ? 'before:h-full' : 'before:h-4',
|
||||
@ -574,7 +589,7 @@
|
||||
activity.activity_type == 'incoming_call' ||
|
||||
activity.activity_type == 'outgoing_call'
|
||||
"
|
||||
class="mb-3 flex max-w-[70%] flex-col gap-3 rounded-md bg-gray-50 p-4"
|
||||
class="mb-3 flex flex-col gap-3 rounded-md bg-gray-50 p-4 sm:max-w-[70%]"
|
||||
>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
@ -625,35 +640,39 @@
|
||||
:src="activity.recording_url"
|
||||
></audio>
|
||||
</div>
|
||||
<div class="flex items-center justify-between">
|
||||
<div
|
||||
class="flex items-center justify-between sm:justify-start sm:gap-1"
|
||||
>
|
||||
<div class="flex items-center gap-1">
|
||||
<Avatar
|
||||
:image="activity.caller.image"
|
||||
:label="activity.caller.label"
|
||||
size="xl"
|
||||
class="sm:h-8 sm:w-8"
|
||||
/>
|
||||
<div class="ml-1 flex flex-col gap-1">
|
||||
<div class="text-base font-medium">
|
||||
<div class="text-xs font-medium sm:text-base">
|
||||
{{ __(activity.caller.label) }}
|
||||
</div>
|
||||
<div class="text-xs text-gray-600">
|
||||
<div class="text-2xs text-gray-600 sm:text-xs">
|
||||
{{ activity.from }}
|
||||
</div>
|
||||
</div>
|
||||
<FeatherIcon
|
||||
name="arrow-right"
|
||||
class="mx-2 h-5 w-5 text-gray-600"
|
||||
/>
|
||||
</div>
|
||||
<FeatherIcon
|
||||
name="arrow-right"
|
||||
class="size-4 text-gray-600 sm:mx-2 sm:size-5"
|
||||
/>
|
||||
<div class="flex items-center gap-1">
|
||||
<Avatar
|
||||
:image="activity.receiver.image"
|
||||
:label="activity.receiver.label"
|
||||
size="xl"
|
||||
class="sm:h-8 sm:w-8"
|
||||
/>
|
||||
<div class="ml-1 flex flex-col gap-1">
|
||||
<div class="text-base font-medium">
|
||||
<div class="text-xs font-medium sm:text-base">
|
||||
{{ __(activity.receiver.label) }}
|
||||
</div>
|
||||
<div class="text-xs text-gray-600">
|
||||
<div class="text-2xs text-gray-600 sm:text-xs">
|
||||
{{ activity.to }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div v-show="showCallPopup">
|
||||
<div v-show="showCallPopup" v-bind="$attrs">
|
||||
<div
|
||||
ref="callPopup"
|
||||
class="fixed z-20 flex w-60 cursor-move select-none flex-col rounded-lg bg-gray-900 p-4 text-gray-300 shadow-2xl"
|
||||
@ -116,6 +116,7 @@
|
||||
v-show="showSmallCallWindow"
|
||||
class="ml-2 flex cursor-pointer select-none items-center justify-between gap-3 rounded-lg bg-gray-900 px-2 py-[7px] text-base text-gray-300"
|
||||
@click="toggleCallWindow"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
<Avatar
|
||||
|
||||
@ -12,14 +12,14 @@
|
||||
<template v-slot:editor="{ editor }">
|
||||
<EditorContent
|
||||
:class="[
|
||||
editable && 'mx-10 max-h-[50vh] overflow-y-auto border-t py-3',
|
||||
editable && 'sm:mx-10 mx-4 max-h-[50vh] overflow-y-auto border-t py-3',
|
||||
]"
|
||||
:editor="editor"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:bottom>
|
||||
<div v-if="editable" class="flex flex-col gap-2">
|
||||
<div class="flex flex-wrap gap-2 px-10">
|
||||
<div class="flex flex-wrap gap-2 sm:px-10 px-4">
|
||||
<AttachmentItem
|
||||
v-for="a in attachments"
|
||||
:key="a.file_url"
|
||||
@ -35,7 +35,7 @@
|
||||
</AttachmentItem>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between gap-2 overflow-hidden border-t px-10 py-2.5"
|
||||
class="flex justify-between gap-2 overflow-hidden border-t sm:px-10 px-4 py-2.5"
|
||||
>
|
||||
<div class="flex items-center overflow-x-auto">
|
||||
<TextEditorFixedMenu
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="flex justify-between gap-3 border-t px-10 py-2.5">
|
||||
<div class="flex justify-between gap-3 border-t sm:px-10 px-4 py-2.5">
|
||||
<div class="flex gap-1.5">
|
||||
<Button
|
||||
ref="sendEmailRef"
|
||||
|
||||
@ -14,8 +14,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import { computed, h } from 'vue'
|
||||
import { Dropdown } from 'frappe-ui'
|
||||
import { isMobileView } from '@/stores/settings'
|
||||
|
||||
const props = defineProps({
|
||||
actions: {
|
||||
@ -25,10 +26,30 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const groupedActions = computed(() => {
|
||||
return props.actions.filter((action) => action.group)
|
||||
let _actions = []
|
||||
let _normalActions = props.actions.filter((action) => !action.group)
|
||||
if (isMobileView.value && _normalActions.length) {
|
||||
_actions.push({
|
||||
group: __('Actions'),
|
||||
hideLabel: true,
|
||||
items: _normalActions.map((action) => ({
|
||||
label: action.label,
|
||||
onClick: action.onClick,
|
||||
icon: action.icon,
|
||||
})),
|
||||
})
|
||||
}
|
||||
_actions = _actions.concat(
|
||||
props.actions.filter((action) => action.group)
|
||||
)
|
||||
return _actions
|
||||
})
|
||||
|
||||
const normalActions = computed(() => {
|
||||
return props.actions.filter((action) => !action.group)
|
||||
let _actions = props.actions.filter((action) => !action.group)
|
||||
if (isMobileView.value && _actions.length) {
|
||||
return []
|
||||
}
|
||||
return _actions
|
||||
})
|
||||
</script>
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
:editable="editable"
|
||||
>
|
||||
<template #top>
|
||||
<div class="mx-10 flex items-center gap-2 border-t py-2.5">
|
||||
<div class="sm:mx-10 mx-4 flex items-center gap-2 border-t py-2.5">
|
||||
<span class="text-xs text-gray-500">{{ __('SUBJECT') }}:</span>
|
||||
<TextInput
|
||||
class="flex-1 border-none bg-white hover:bg-white focus:border-none focus:!shadow-none focus-visible:!ring-0"
|
||||
@ -17,7 +17,7 @@
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="mx-10 flex items-center gap-2 border-t py-2.5"
|
||||
class="sm:mx-10 mx-4 flex items-center gap-2 border-t py-2.5"
|
||||
:class="[cc || bcc ? 'border-b' : '']"
|
||||
>
|
||||
<span class="text-xs text-gray-500">{{ __('TO') }}:</span>
|
||||
@ -32,7 +32,7 @@
|
||||
</div>
|
||||
<div
|
||||
v-if="cc"
|
||||
class="mx-10 flex items-center gap-2 py-2.5"
|
||||
class="sm:mx-10 mx-4 flex items-center gap-2 py-2.5"
|
||||
:class="bcc ? 'border-b' : ''"
|
||||
>
|
||||
<span class="text-xs text-gray-500">{{ __('CC') }}:</span>
|
||||
@ -46,7 +46,7 @@
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="bcc" class="mx-10 flex items-center gap-2 py-2.5">
|
||||
<div v-if="bcc" class="sm:mx-10 mx-4 flex items-center gap-2 py-2.5">
|
||||
<span class="text-xs text-gray-500">{{ __('BCC') }}:</span>
|
||||
<MultiselectInput
|
||||
ref="bccInput"
|
||||
@ -62,14 +62,14 @@
|
||||
<template v-slot:editor="{ editor }">
|
||||
<EditorContent
|
||||
:class="[
|
||||
editable && 'mx-10 max-h-[50vh] overflow-y-auto border-t py-3',
|
||||
editable && 'sm:mx-10 mx-4 max-h-[50vh] overflow-y-auto border-t py-3',
|
||||
]"
|
||||
:editor="editor"
|
||||
/>
|
||||
</template>
|
||||
<template v-slot:bottom>
|
||||
<div v-if="editable" class="flex flex-col gap-2">
|
||||
<div class="flex flex-wrap gap-2 px-10">
|
||||
<div class="flex flex-wrap gap-2 sm:px-10 px-4">
|
||||
<AttachmentItem
|
||||
v-for="a in attachments"
|
||||
:key="a.file_url"
|
||||
@ -85,7 +85,7 @@
|
||||
</AttachmentItem>
|
||||
</div>
|
||||
<div
|
||||
class="flex justify-between gap-2 overflow-hidden border-t px-10 py-2.5"
|
||||
class="flex justify-between gap-2 overflow-hidden border-t sm:px-10 px-4 py-2.5"
|
||||
>
|
||||
<div class="flex items-center overflow-x-auto">
|
||||
<TextEditorFixedMenu
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
fill="#DB4EE0"
|
||||
/>
|
||||
<path
|
||||
d="M21.2488 27.5116V38.0122H85.7749V45.8876L62.5161 68.4639V80.7496L54.9557 83.3222V68.4639C54.9557 68.4639 41.1474 55.0756 36.3171 50.3504H21.3013L42.6175 71.089C43.825 72.2441 44.5076 73.8717 44.5076 75.5518V87.9425L73.0167 88.0475V75.5518C73.0167 73.8717 73.6992 72.2441 74.9068 71.089L96.2755 50.2979V27.5116H21.2488Z"
|
||||
d="M21.2487 27.5115V38.0121H85.7749V45.8875L62.5161 68.4638V80.9999H54.9556V68.4638C54.9556 68.4638 41.1474 55.0755 36.3171 50.3503H21.3013L42.6174 71.0889C43.825 72.244 44.5076 73.8716 44.5076 75.5517V87.9424L73.0167 88.0474V75.5517C73.0167 73.8716 73.6992 72.244 74.9068 71.0889L96.2755 50.2978V27.5115H21.2487Z"
|
||||
fill="#F1FCFF"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
20
frontend/src/components/Icons/DetailsIcon.vue
Normal file
@ -0,0 +1,20 @@
|
||||
<template>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="lucide lucide-list-collapse"
|
||||
>
|
||||
<path d="m3 10 2.5-2.5L3 5" />
|
||||
<path d="m3 19 2.5-2.5L3 14" />
|
||||
<path d="M10 6h11" />
|
||||
<path d="M10 12h11" />
|
||||
<path d="M10 18h11" />
|
||||
</svg>
|
||||
</template>
|
||||
@ -1,13 +1,15 @@
|
||||
<template>
|
||||
<Teleport to="#app-header" v-if="showHeader">
|
||||
<header class="flex justify-between items-center pl-5 py-2.5 h-12">
|
||||
<div class="flex items-center gap-2">
|
||||
<slot name="left-header" />
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<slot name="right-header" class="flex items-center gap-2" />
|
||||
</div>
|
||||
</header>
|
||||
<slot>
|
||||
<header class="flex h-12 items-center justify-between py-2.5 pl-5">
|
||||
<div class="flex items-center gap-2">
|
||||
<slot name="left-header" />
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<slot name="right-header" class="flex items-center gap-2" />
|
||||
</div>
|
||||
</header>
|
||||
</slot>
|
||||
</Teleport>
|
||||
</template>
|
||||
<script setup>
|
||||
|
||||
@ -74,7 +74,7 @@
|
||||
</Section>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m-2 flex flex-col gap-1">
|
||||
<div v-if="!isMobileView" class="m-2 flex flex-col gap-1">
|
||||
<SidebarLink
|
||||
:label="isSidebarCollapsed ? __('Expand') : __('Collapse')"
|
||||
:isCollapsed="isSidebarCollapsed"
|
||||
@ -116,6 +116,7 @@ import { notificationsStore } from '@/stores/notifications'
|
||||
import { FeatherIcon } from 'frappe-ui'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { computed, h } from 'vue'
|
||||
import { isMobileView } from '@/stores/settings'
|
||||
|
||||
const { getPinnedViews, getPublicViews } = viewsStore()
|
||||
const { toggle: toggleNotificationPanel } = notificationsStore()
|
||||
|
||||
13
frontend/src/components/Layouts/MobileLayout.vue
Normal file
@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<div class="flex h-screen w-screen">
|
||||
<MobileSidebar />
|
||||
<div class="flex h-full flex-1 flex-col overflow-auto">
|
||||
<MobileAppHeader />
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import MobileSidebar from '@/components/Mobile/MobileSidebar.vue'
|
||||
import MobileAppHeader from '@/components/Mobile/MobileAppHeader.vue'
|
||||
</script>
|
||||
16
frontend/src/components/Mobile/MobileAppHeader.vue
Normal file
@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div class="flex border-b pr-3">
|
||||
<div class="z-20 -mr-4 ml-1 flex items-center justify-center">
|
||||
<Button variant="ghosted" @click="sidebarOpened = !sidebarOpened">
|
||||
<FeatherIcon name="menu" class="size-4" />
|
||||
</Button>
|
||||
</div>
|
||||
<div id="app-header" class="flex-1" />
|
||||
</div>
|
||||
<CallUI class="mr-3 mt-2" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import CallUI from '@/components/CallUI.vue'
|
||||
import { mobileSidebarOpened as sidebarOpened } from '@/stores/settings'
|
||||
</script>
|
||||
213
frontend/src/components/Mobile/MobileSidebar.vue
Normal file
@ -0,0 +1,213 @@
|
||||
<template>
|
||||
<TransitionRoot :show="sidebarOpened">
|
||||
<Dialog as="div" @close="sidebarOpened = false" class="fixed inset-0 z-40">
|
||||
<TransitionChild
|
||||
as="template"
|
||||
enter="transition ease-in-out duration-200 transform"
|
||||
enter-from="-translate-x-full"
|
||||
enter-to="translate-x-0"
|
||||
leave="transition ease-in-out duration-200 transform"
|
||||
leave-from="translate-x-0"
|
||||
leave-to="-translate-x-full"
|
||||
>
|
||||
<div
|
||||
class="relative z-10 flex h-full w-[260px] flex-col justify-between border-r bg-gray-50 transition-all duration-300 ease-in-out"
|
||||
>
|
||||
<div><UserDropdown class="p-2" /></div>
|
||||
<div class="flex-1 overflow-y-auto">
|
||||
<div class="mb-3 flex flex-col">
|
||||
<SidebarLink
|
||||
id="notifications-btn"
|
||||
:label="__('Notifications')"
|
||||
:icon="NotificationsIcon"
|
||||
:to="{ name: 'Notifications' }"
|
||||
class="relative mx-2 my-0.5"
|
||||
>
|
||||
<template #right>
|
||||
<Badge
|
||||
v-if="notificationsStore().unreadNotificationsCount"
|
||||
:label="notificationsStore().unreadNotificationsCount"
|
||||
variant="subtle"
|
||||
/>
|
||||
</template>
|
||||
</SidebarLink>
|
||||
</div>
|
||||
<div v-for="view in allViews" :key="view.label">
|
||||
<Section
|
||||
:label="view.name"
|
||||
:hideLabel="view.hideLabel"
|
||||
:isOpened="view.opened"
|
||||
>
|
||||
<template #header="{ opened, hide, toggle }">
|
||||
<div
|
||||
v-if="!hide"
|
||||
class="ml-2 mt-4 flex h-7 w-auto cursor-pointer gap-1.5 px-1 text-base font-medium text-gray-600 opacity-100 transition-all duration-300 ease-in-out"
|
||||
@click="toggle()"
|
||||
>
|
||||
<FeatherIcon
|
||||
name="chevron-right"
|
||||
class="h-4 text-gray-900 transition-all duration-300 ease-in-out"
|
||||
:class="{ 'rotate-90': opened }"
|
||||
/>
|
||||
<span>{{ __(view.name) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<nav class="flex flex-col">
|
||||
<SidebarLink
|
||||
v-for="link in view.views"
|
||||
:icon="link.icon"
|
||||
:label="__(link.label)"
|
||||
:to="link.to"
|
||||
class="mx-2 my-0.5"
|
||||
/>
|
||||
</nav>
|
||||
</Section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</TransitionChild>
|
||||
<TransitionChild
|
||||
as="template"
|
||||
enter="transition-opacity ease-linear duration-200"
|
||||
enter-from="opacity-0"
|
||||
enter-to="opacity-100"
|
||||
leave="transition-opacity ease-linear duration-200"
|
||||
leave-from="opacity-100"
|
||||
leave-to="opacity-0"
|
||||
>
|
||||
<DialogOverlay class="fixed inset-0 bg-gray-600 bg-opacity-50" />
|
||||
</TransitionChild>
|
||||
</Dialog>
|
||||
</TransitionRoot>
|
||||
</template>
|
||||
<script setup>
|
||||
import {
|
||||
TransitionRoot,
|
||||
TransitionChild,
|
||||
Dialog,
|
||||
DialogOverlay,
|
||||
} from '@headlessui/vue'
|
||||
import Section from '@/components/Section.vue'
|
||||
import EmailIcon from '@/components/Icons/EmailIcon.vue'
|
||||
import PinIcon from '@/components/Icons/PinIcon.vue'
|
||||
import UserDropdown from '@/components/UserDropdown.vue'
|
||||
import LeadsIcon from '@/components/Icons/LeadsIcon.vue'
|
||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||
import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
|
||||
import NoteIcon from '@/components/Icons/NoteIcon.vue'
|
||||
import TaskIcon from '@/components/Icons/TaskIcon.vue'
|
||||
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
||||
import NotificationsIcon from '@/components/Icons/NotificationsIcon.vue'
|
||||
import SidebarLink from '@/components/SidebarLink.vue'
|
||||
import { viewsStore } from '@/stores/views'
|
||||
import { notificationsStore } from '@/stores/notifications'
|
||||
import { computed, h } from 'vue'
|
||||
import { mobileSidebarOpened as sidebarOpened } from '@/stores/settings'
|
||||
|
||||
const { getPinnedViews, getPublicViews } = viewsStore()
|
||||
|
||||
const links = [
|
||||
{
|
||||
label: 'Leads',
|
||||
icon: LeadsIcon,
|
||||
to: 'Leads',
|
||||
},
|
||||
{
|
||||
label: 'Deals',
|
||||
icon: DealsIcon,
|
||||
to: 'Deals',
|
||||
},
|
||||
{
|
||||
label: 'Contacts',
|
||||
icon: ContactsIcon,
|
||||
to: 'Contacts',
|
||||
},
|
||||
{
|
||||
label: 'Organizations',
|
||||
icon: OrganizationsIcon,
|
||||
to: 'Organizations',
|
||||
},
|
||||
{
|
||||
label: 'Notes',
|
||||
icon: NoteIcon,
|
||||
to: 'Notes',
|
||||
},
|
||||
{
|
||||
label: 'Tasks',
|
||||
icon: TaskIcon,
|
||||
to: 'Tasks',
|
||||
},
|
||||
{
|
||||
label: 'Call Logs',
|
||||
icon: PhoneIcon,
|
||||
to: 'Call Logs',
|
||||
},
|
||||
{
|
||||
label: 'Email Templates',
|
||||
icon: EmailIcon,
|
||||
to: 'Email Templates',
|
||||
},
|
||||
]
|
||||
|
||||
const allViews = computed(() => {
|
||||
let _views = [
|
||||
{
|
||||
name: 'All Views',
|
||||
hideLabel: true,
|
||||
opened: true,
|
||||
views: links,
|
||||
},
|
||||
]
|
||||
if (getPublicViews().length) {
|
||||
_views.push({
|
||||
name: 'Public views',
|
||||
opened: true,
|
||||
views: parseView(getPublicViews()),
|
||||
})
|
||||
}
|
||||
|
||||
if (getPinnedViews().length) {
|
||||
_views.push({
|
||||
name: 'Pinned views',
|
||||
opened: true,
|
||||
views: parseView(getPinnedViews()),
|
||||
})
|
||||
}
|
||||
return _views
|
||||
})
|
||||
|
||||
function parseView(views) {
|
||||
return views.map((view) => {
|
||||
return {
|
||||
label: view.label,
|
||||
icon: getIcon(view.route_name, view.icon),
|
||||
to: {
|
||||
name: view.route_name,
|
||||
query: { view: view.name },
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getIcon(routeName, icon) {
|
||||
if (icon) return h('div', { class: 'size-auto' }, icon)
|
||||
|
||||
switch (routeName) {
|
||||
case 'Leads':
|
||||
return LeadsIcon
|
||||
case 'Deals':
|
||||
return DealsIcon
|
||||
case 'Contacts':
|
||||
return ContactsIcon
|
||||
case 'Organizations':
|
||||
return OrganizationsIcon
|
||||
case 'Notes':
|
||||
return NoteIcon
|
||||
case 'Call Logs':
|
||||
return PhoneIcon
|
||||
default:
|
||||
return PinIcon
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -16,7 +16,7 @@
|
||||
</TextInput>
|
||||
<div
|
||||
v-if="filteredTemplates.length"
|
||||
class="mt-2 grid max-h-[560px] grid-cols-3 gap-2 overflow-y-auto"
|
||||
class="mt-2 grid max-h-[560px] sm:grid-cols-3 gris-cols-1 gap-2 overflow-y-auto"
|
||||
>
|
||||
<div
|
||||
v-for="template in filteredTemplates"
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
:placeholder="__('Took a call with John Doe and discussed the new project.')"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="flex items-center gap-2 overflow-x-auto">
|
||||
<Dropdown :options="taskStatusOptions(updateTaskStatus)">
|
||||
<Button :label="_task.status" class="w-full justify-between">
|
||||
<template #prefix>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
</TextInput>
|
||||
<div
|
||||
v-if="filteredTemplates.length"
|
||||
class="mt-2 grid max-h-[560px] grid-cols-3 gap-2 overflow-y-auto"
|
||||
class="mt-2 grid max-h-[560px] grid-cols-1 gap-2 overflow-y-auto sm:grid-cols-3"
|
||||
>
|
||||
<div
|
||||
v-for="template in filteredTemplates"
|
||||
@ -41,7 +41,11 @@
|
||||
<div class="text-lg text-gray-500">
|
||||
{{ __('No templates found') }}
|
||||
</div>
|
||||
<Button :label="__('Create New')" class="mt-4" />
|
||||
<Button
|
||||
:label="__('Create New')"
|
||||
class="mt-4"
|
||||
@click="newWhatsappTemplate"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -68,7 +72,7 @@ const templates = createListResource({
|
||||
doctype: 'WhatsApp Templates',
|
||||
cache: ['whatsappTemplates'],
|
||||
fields: ['name', 'template', 'footer'],
|
||||
filters: { status: 'APPROVED', for_doctype: ['in', [props.doctype, '']]},
|
||||
filters: { status: 'APPROVED', for_doctype: ['in', [props.doctype, '']] },
|
||||
orderBy: 'modified desc',
|
||||
pageLength: 99999,
|
||||
auto: true,
|
||||
@ -88,5 +92,10 @@ const filteredTemplates = computed(() => {
|
||||
)
|
||||
})
|
||||
|
||||
function newWhatsappTemplate() {
|
||||
show.value = false
|
||||
window.open('/app/whatsapp-templates/new')
|
||||
}
|
||||
|
||||
watch(show, (value) => value && nextTick(() => searchInput.value?.el?.focus()))
|
||||
</script>
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
<template>
|
||||
<div class="flex flex-col gap-1.5 border-b px-6 py-3">
|
||||
<div class="flex flex-col gap-1.5 border-b sm:px-6 py-3 px-4">
|
||||
<div
|
||||
v-for="s in slaSection"
|
||||
:key="s.label"
|
||||
class="flex items-center gap-2 text-base leading-5"
|
||||
>
|
||||
<div class="w-[106px] text-sm text-gray-600">{{ __(s.label) }}</div>
|
||||
<div class="sm:w-[106px] w-36 text-sm text-gray-600">{{ __(s.label) }}</div>
|
||||
<div class="grid min-h-[28px] items-center">
|
||||
<Tooltip v-if="s.tooltipText" :text="__(s.tooltipText)">
|
||||
<div class="ml-2 cursor-pointer">
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
class="flex items-center gap-2 px-3 leading-5 first:mt-3"
|
||||
>
|
||||
<Tooltip :text="__(field.label)" hoverDelay="1">
|
||||
<div class="w-[106px] shrink-0 truncate text-sm text-gray-600">
|
||||
<div class="sm:w-[106px] w-36 shrink-0 truncate text-sm text-gray-600">
|
||||
<span>{{ __(field.label) }}</span>
|
||||
<span class="text-red-500">{{ field.reqd ? ' *' : '' }}</span>
|
||||
</div>
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
import { Tooltip } from 'frappe-ui'
|
||||
import { computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { isMobileView, mobileSidebarOpened } from '@/stores/settings'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
@ -72,6 +73,9 @@ function handleClick() {
|
||||
} else {
|
||||
router.push({ name: props.to })
|
||||
}
|
||||
if (isMobileView.value) {
|
||||
mobileSidebarOpened.value = false
|
||||
}
|
||||
}
|
||||
|
||||
let isActive = computed(() => {
|
||||
|
||||
@ -1,5 +1,68 @@
|
||||
<template>
|
||||
<div class="flex items-center justify-between gap-2 px-5 py-4">
|
||||
<div
|
||||
v-if="isMobileView"
|
||||
class="flex flex-col justify-between gap-2 px-5 py-4"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div class="flex gap-2">
|
||||
<Dropdown :options="viewsDropdownOptions">
|
||||
<template #default="{ open }">
|
||||
<Button :label="__(currentView.label)">
|
||||
<template #prefix>
|
||||
<div v-if="isEmoji(currentView.icon)">
|
||||
{{ currentView.icon }}
|
||||
</div>
|
||||
<FeatherIcon v-else :name="currentView.icon" class="h-4" />
|
||||
</template>
|
||||
<template #suffix>
|
||||
<FeatherIcon
|
||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
||||
class="h-4 text-gray-600"
|
||||
/>
|
||||
</template>
|
||||
</Button>
|
||||
</template>
|
||||
</Dropdown>
|
||||
<Dropdown :options="viewActions">
|
||||
<template #default>
|
||||
<Button icon="more-horizontal" />
|
||||
</template>
|
||||
</Dropdown>
|
||||
</div>
|
||||
<Button :label="__('Refresh')" @click="reload()" :loading="isLoading">
|
||||
<template #icon>
|
||||
<RefreshIcon class="h-4 w-4" />
|
||||
</template>
|
||||
</Button>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<Filter
|
||||
v-model="list"
|
||||
:doctype="doctype"
|
||||
:default_filters="filters"
|
||||
@update="updateFilter"
|
||||
/>
|
||||
<div class="flex gap-2">
|
||||
<SortBy v-model="list" :doctype="doctype" @update="updateSort" />
|
||||
<ColumnSettings
|
||||
v-if="!options.hideColumnsButton"
|
||||
v-model="list"
|
||||
:doctype="doctype"
|
||||
@update="(isDefault) => updateColumns(isDefault)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="viewUpdated && route.query.view && (!view.public || isManager())"
|
||||
class="flex flex-row-reverse items-center gap-2 border-r pr-2"
|
||||
>
|
||||
<Button :label="__('Cancel')" @click="cancelChanges" />
|
||||
<Button :label="__('Save Changes')" @click="saveView" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="flex items-center justify-between gap-2 px-5 py-4">
|
||||
<div class="flex items-center gap-2">
|
||||
<Dropdown :options="viewsDropdownOptions">
|
||||
<template #default="{ open }">
|
||||
@ -205,6 +268,7 @@ import { createResource, Dropdown, call, FeatherIcon } from 'frappe-ui'
|
||||
import { computed, ref, onMounted, watch, h } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useDebounceFn } from '@vueuse/core'
|
||||
import { isMobileView } from '@/stores/settings'
|
||||
|
||||
const props = defineProps({
|
||||
doctype: {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="reply?.message"
|
||||
class="flex items-center justify-around gap-2 px-10 pt-2"
|
||||
class="flex items-center justify-around gap-2 sm:px-10 px-4 pt-2"
|
||||
>
|
||||
<div
|
||||
class="mb-1 ml-13 flex-1 cursor-pointer rounded border-0 border-l-4 border-green-500 bg-gray-100 p-2 text-base text-gray-600"
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
<Button variant="ghost" icon="x" @click="reply = {}" />
|
||||
</div>
|
||||
<div class="flex items-end gap-2 px-10 py-2.5">
|
||||
<div class="flex items-end gap-2 sm:px-10 px-4 py-2.5">
|
||||
<div class="flex h-8 items-center gap-2">
|
||||
<FileUploader @success="(file) => uploadFile(file)">
|
||||
<template v-slot="{ openFileSelector }">
|
||||
|
||||
23
frontend/src/composables/index.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { onMounted, onUnmounted, reactive } from 'vue'
|
||||
|
||||
export function useScreenSize() {
|
||||
const size = reactive({
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
})
|
||||
|
||||
const onResize = () => {
|
||||
size.width = window.innerWidth
|
||||
size.height = window.innerHeight
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('resize', onResize)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', onResize)
|
||||
})
|
||||
|
||||
return size
|
||||
}
|
||||
@ -7,7 +7,7 @@
|
||||
<div v-if="contact.data" class="flex h-full flex-col overflow-hidden">
|
||||
<FileUploader @success="changeContactImage" :validateFile="validateFile">
|
||||
<template #default="{ openFileSelector, error }">
|
||||
<div class="flex items-center justify-start gap-6 p-5">
|
||||
<div class="flex items-start justify-start gap-6 p-5 sm:items-center">
|
||||
<div class="group relative h-24 w-24">
|
||||
<Avatar
|
||||
size="3xl"
|
||||
@ -50,14 +50,16 @@
|
||||
</div>
|
||||
</component>
|
||||
</div>
|
||||
<div class="flex flex-col gap-0.5 truncate">
|
||||
<div class="flex flex-col gap-2 truncate sm:gap-0.5">
|
||||
<div class="truncate text-3xl font-semibold">
|
||||
<span v-if="contact.data.salutation">
|
||||
{{ contact.data.salutation + '. ' }}
|
||||
</span>
|
||||
<span>{{ contact.data.full_name }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 text-base text-gray-700">
|
||||
<div
|
||||
class="flex flex-col flex-wrap gap-3 text-base text-gray-700 sm:flex-row sm:items-center sm:gap-2"
|
||||
>
|
||||
<div
|
||||
v-if="contact.data.email_id"
|
||||
class="flex items-center gap-1.5"
|
||||
@ -67,7 +69,7 @@
|
||||
</div>
|
||||
<span
|
||||
v-if="contact.data.email_id"
|
||||
class="text-3xl leading-[0] text-gray-600"
|
||||
class="hidden text-3xl leading-[0] text-gray-600 sm:flex"
|
||||
>
|
||||
·
|
||||
</span>
|
||||
@ -79,7 +81,9 @@
|
||||
<div
|
||||
class="flex items-center gap-1.5"
|
||||
:class="callEnabled ? 'cursor-pointer' : ''"
|
||||
@click="callEnabled && makeCall(contact.data.actual_mobile_no)"
|
||||
@click="
|
||||
callEnabled && makeCall(contact.data.actual_mobile_no)
|
||||
"
|
||||
>
|
||||
<PhoneIcon class="h-4 w-4" />
|
||||
<span class="">{{ contact.data.actual_mobile_no }}</span>
|
||||
@ -87,7 +91,7 @@
|
||||
</component>
|
||||
<span
|
||||
v-if="contact.data.actual_mobile_no"
|
||||
class="text-3xl leading-[0] text-gray-600"
|
||||
class="hidden text-3xl leading-[0] text-gray-600 sm:flex"
|
||||
>
|
||||
·
|
||||
</span>
|
||||
@ -107,7 +111,7 @@
|
||||
</div>
|
||||
<span
|
||||
v-if="contact.data.company_name"
|
||||
class="text-3xl leading-[0] text-gray-600"
|
||||
class="hidden text-3xl leading-[0] text-gray-600 sm:flex"
|
||||
>
|
||||
·
|
||||
</span>
|
||||
@ -119,7 +123,7 @@
|
||||
"
|
||||
variant="ghost"
|
||||
:label="__('More')"
|
||||
class="-ml-1 cursor-pointer hover:text-gray-900"
|
||||
class="w-fit cursor-pointer hover:text-gray-900 sm:-ml-1"
|
||||
@click="
|
||||
() => {
|
||||
detailMode = true
|
||||
|
||||
575
frontend/src/pages/MobileDeal.vue
Normal file
@ -0,0 +1,575 @@
|
||||
<template>
|
||||
<LayoutHeader v-if="deal.data">
|
||||
<header
|
||||
class="relative flex h-12 items-center justify-between gap-2 py-2.5 pl-5"
|
||||
>
|
||||
<Breadcrumbs :items="breadcrumbs" />
|
||||
<div class="absolute right-0">
|
||||
<Dropdown :options="statusOptions('deal', updateField)">
|
||||
<template #default="{ open }">
|
||||
<Button
|
||||
:label="deal.data.status"
|
||||
:class="getDealStatus(deal.data.status).colorClass"
|
||||
>
|
||||
<template #prefix>
|
||||
<IndicatorIcon />
|
||||
</template>
|
||||
<template #suffix>
|
||||
<FeatherIcon
|
||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
||||
class="h-4"
|
||||
/>
|
||||
</template>
|
||||
</Button>
|
||||
</template>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</header>
|
||||
</LayoutHeader>
|
||||
<div
|
||||
v-if="deal.data"
|
||||
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
|
||||
>
|
||||
<component :is="deal.data._assignedTo?.length == 1 ? 'Button' : 'div'">
|
||||
<MultipleAvatar
|
||||
:avatars="deal.data._assignedTo"
|
||||
@click="showAssignmentModal = true"
|
||||
/>
|
||||
</component>
|
||||
<div class="flex items-center gap-2">
|
||||
<CustomActions
|
||||
v-if="deal.data._customActions"
|
||||
:actions="deal.data._customActions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="deal.data" class="flex h-full overflow-hidden">
|
||||
<Tabs
|
||||
v-model="tabIndex"
|
||||
v-slot="{ tab }"
|
||||
:tabs="tabs"
|
||||
tablistClass="!px-3"
|
||||
class="overflow-auto"
|
||||
>
|
||||
<div v-if="tab.name == 'Details'">
|
||||
<SLASection
|
||||
v-if="deal.data.sla_status"
|
||||
v-model="deal.data"
|
||||
@updateField="updateField"
|
||||
/>
|
||||
<div
|
||||
v-if="detailSections.length"
|
||||
class="flex flex-1 flex-col justify-between overflow-hidden"
|
||||
>
|
||||
<div class="flex flex-col overflow-y-auto">
|
||||
<div
|
||||
v-for="(section, i) in detailSections"
|
||||
:key="section.label"
|
||||
class="flex flex-col px-2 py-3 sm:p-3"
|
||||
:class="{ 'border-b': i !== detailSections.length - 1 }"
|
||||
>
|
||||
<Section :is-opened="section.opened" :label="section.label">
|
||||
<template #actions>
|
||||
<div v-if="section.contacts" class="pr-2">
|
||||
<Link
|
||||
value=""
|
||||
doctype="Contact"
|
||||
@change="(e) => addContact(e)"
|
||||
:onCreate="
|
||||
(value, close) => {
|
||||
_contact = {
|
||||
first_name: value,
|
||||
company_name: deal.data.organization,
|
||||
}
|
||||
showContactModal = true
|
||||
close()
|
||||
}
|
||||
"
|
||||
>
|
||||
<template #target="{ togglePopover }">
|
||||
<Button
|
||||
class="h-7 px-3"
|
||||
variant="ghost"
|
||||
icon="plus"
|
||||
@click="togglePopover()"
|
||||
/>
|
||||
</template>
|
||||
</Link>
|
||||
</div>
|
||||
</template>
|
||||
<SectionFields
|
||||
v-if="section.fields"
|
||||
:fields="section.fields"
|
||||
v-model="deal.data"
|
||||
@update="updateField"
|
||||
/>
|
||||
<div v-else>
|
||||
<div
|
||||
v-if="
|
||||
deal_contacts?.loading && deal_contacts?.data?.length == 0
|
||||
"
|
||||
class="flex min-h-20 flex-1 items-center justify-center gap-3 text-base text-gray-500"
|
||||
>
|
||||
<LoadingIndicator class="h-4 w-4" />
|
||||
<span>{{ __('Loading...') }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="section.contacts.length"
|
||||
v-for="(contact, i) in section.contacts"
|
||||
:key="contact.name"
|
||||
>
|
||||
<div
|
||||
class="px-2 pb-2.5"
|
||||
:class="[i == 0 ? 'pt-5' : 'pt-2.5']"
|
||||
>
|
||||
<Section :is-opened="contact.opened">
|
||||
<template #header="{ opened, toggle }">
|
||||
<div
|
||||
class="flex cursor-pointer items-center justify-between gap-2 pr-1 text-base leading-5 text-gray-700"
|
||||
>
|
||||
<div
|
||||
class="flex h-7 items-center gap-2 truncate"
|
||||
@click="toggle()"
|
||||
>
|
||||
<Avatar
|
||||
:label="contact.full_name"
|
||||
:image="contact.image"
|
||||
size="md"
|
||||
/>
|
||||
<div class="truncate">
|
||||
{{ contact.full_name }}
|
||||
</div>
|
||||
<Badge
|
||||
v-if="contact.is_primary"
|
||||
class="ml-2"
|
||||
variant="outline"
|
||||
:label="__('Primary')"
|
||||
theme="green"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<Dropdown :options="contactOptions(contact.name)">
|
||||
<Button
|
||||
icon="more-horizontal"
|
||||
class="text-gray-600"
|
||||
variant="ghost"
|
||||
/>
|
||||
</Dropdown>
|
||||
<Button
|
||||
variant="ghost"
|
||||
@click="
|
||||
router.push({
|
||||
name: 'Contact',
|
||||
params: { contactId: contact.name },
|
||||
})
|
||||
"
|
||||
>
|
||||
<ArrowUpRightIcon class="h-4 w-4" />
|
||||
</Button>
|
||||
<Button variant="ghost" @click="toggle()">
|
||||
<FeatherIcon
|
||||
name="chevron-right"
|
||||
class="h-4 w-4 text-gray-900 transition-all duration-300 ease-in-out"
|
||||
:class="{ 'rotate-90': opened }"
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div
|
||||
class="flex flex-col gap-1.5 text-base text-gray-800"
|
||||
>
|
||||
<div class="flex items-center gap-3 pb-1.5 pl-1 pt-4">
|
||||
<EmailIcon class="h-4 w-4" />
|
||||
{{ contact.email }}
|
||||
</div>
|
||||
<div class="flex items-center gap-3 p-1 py-1.5">
|
||||
<PhoneIcon class="h-4 w-4" />
|
||||
{{ contact.mobile_no }}
|
||||
</div>
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
<div
|
||||
v-if="i != section.contacts.length - 1"
|
||||
class="mx-2 h-px border-t border-gray-200"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="flex h-20 items-center justify-center text-base text-gray-600"
|
||||
>
|
||||
{{ __('No contacts added') }}
|
||||
</div>
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Activities
|
||||
v-else
|
||||
doctype="CRM Deal"
|
||||
:title="tab.name"
|
||||
v-model:reload="reload"
|
||||
v-model:tabIndex="tabIndex"
|
||||
v-model="deal"
|
||||
/>
|
||||
</Tabs>
|
||||
</div>
|
||||
<OrganizationModal
|
||||
v-model="showOrganizationModal"
|
||||
v-model:organization="_organization"
|
||||
:options="{
|
||||
redirect: false,
|
||||
afterInsert: (doc) =>
|
||||
updateField('organization', doc.name, () => {
|
||||
organizations.reload()
|
||||
}),
|
||||
}"
|
||||
/>
|
||||
<ContactModal
|
||||
v-model="showContactModal"
|
||||
:contact="_contact"
|
||||
:options="{
|
||||
redirect: false,
|
||||
afterInsert: (doc) => addContact(doc.name),
|
||||
}"
|
||||
/>
|
||||
<AssignmentModal
|
||||
v-if="deal.data"
|
||||
:doc="deal.data"
|
||||
doctype="CRM Deal"
|
||||
v-model="showAssignmentModal"
|
||||
v-model:assignees="deal.data._assignedTo"
|
||||
/>
|
||||
</template>
|
||||
<script setup>
|
||||
import DetailsIcon from '@/components/Icons/DetailsIcon.vue'
|
||||
import LoadingIndicator from '@/components/Icons/LoadingIndicator.vue'
|
||||
import ActivityIcon from '@/components/Icons/ActivityIcon.vue'
|
||||
import EmailIcon from '@/components/Icons/EmailIcon.vue'
|
||||
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 WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
|
||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||
import ArrowUpRightIcon from '@/components/Icons/ArrowUpRightIcon.vue'
|
||||
import SuccessIcon from '@/components/Icons/SuccessIcon.vue'
|
||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
import Activities from '@/components/Activities.vue'
|
||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
|
||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
||||
import ContactModal from '@/components/Modals/ContactModal.vue'
|
||||
import Link from '@/components/Controls/Link.vue'
|
||||
import Section from '@/components/Section.vue'
|
||||
import SectionFields from '@/components/SectionFields.vue'
|
||||
import SLASection from '@/components/SLASection.vue'
|
||||
import CustomActions from '@/components/CustomActions.vue'
|
||||
import {
|
||||
createToast,
|
||||
setupAssignees,
|
||||
setupCustomActions,
|
||||
errorMessage,
|
||||
} from '@/utils'
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { organizationsStore } from '@/stores/organizations'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
import { whatsappEnabled, callEnabled, isMobileView } from '@/stores/settings'
|
||||
import {
|
||||
createResource,
|
||||
Dropdown,
|
||||
Avatar,
|
||||
Tabs,
|
||||
Breadcrumbs,
|
||||
call,
|
||||
} from 'frappe-ui'
|
||||
import { ref, computed, h, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const { $dialog, makeCall } = globalStore()
|
||||
const { organizations, getOrganization } = organizationsStore()
|
||||
const { statusOptions, getDealStatus } = statusesStore()
|
||||
const router = useRouter()
|
||||
|
||||
const props = defineProps({
|
||||
dealId: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const deal = createResource({
|
||||
url: 'crm.fcrm.doctype.crm_deal.api.get_deal',
|
||||
params: { name: props.dealId },
|
||||
cache: ['deal', props.dealId],
|
||||
onSuccess: (data) => {
|
||||
setupAssignees(data)
|
||||
setupCustomActions(data, {
|
||||
doc: data,
|
||||
$dialog,
|
||||
router,
|
||||
updateField,
|
||||
createToast,
|
||||
deleteDoc: deleteDeal,
|
||||
call,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (deal.data) return
|
||||
deal.fetch()
|
||||
})
|
||||
|
||||
const reload = ref(false)
|
||||
const showOrganizationModal = ref(false)
|
||||
const showAssignmentModal = ref(false)
|
||||
const _organization = ref({})
|
||||
|
||||
const organization = computed(() => {
|
||||
return deal.data?.organization && getOrganization(deal.data.organization)
|
||||
})
|
||||
|
||||
function updateDeal(fieldname, value, callback) {
|
||||
value = Array.isArray(fieldname) ? '' : value
|
||||
|
||||
if (validateRequired(fieldname, value)) return
|
||||
|
||||
createResource({
|
||||
url: 'frappe.client.set_value',
|
||||
params: {
|
||||
doctype: 'CRM Deal',
|
||||
name: props.dealId,
|
||||
fieldname,
|
||||
value,
|
||||
},
|
||||
auto: true,
|
||||
onSuccess: () => {
|
||||
deal.reload()
|
||||
reload.value = true
|
||||
createToast({
|
||||
title: __('Deal updated'),
|
||||
icon: 'check',
|
||||
iconClasses: 'text-green-600',
|
||||
})
|
||||
callback?.()
|
||||
},
|
||||
onError: (err) => {
|
||||
createToast({
|
||||
title: __('Error updating deal'),
|
||||
text: __(err.messages?.[0]),
|
||||
icon: 'x',
|
||||
iconClasses: 'text-red-600',
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function validateRequired(fieldname, value) {
|
||||
let meta = deal.data.all_fields || {}
|
||||
if (meta[fieldname]?.reqd && !value) {
|
||||
createToast({
|
||||
title: __('Error Updating Deal'),
|
||||
text: __('{0} is a required field', [meta[fieldname].label]),
|
||||
icon: 'x',
|
||||
iconClasses: 'text-red-600',
|
||||
})
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const breadcrumbs = computed(() => {
|
||||
let items = [{ label: __('Deals'), route: { name: 'Deals' } }]
|
||||
items.push({
|
||||
label: organization.value?.name || __('Untitled'),
|
||||
route: { name: 'Deal', params: { dealId: deal.data.name } },
|
||||
})
|
||||
return items
|
||||
})
|
||||
|
||||
const tabIndex = ref(0)
|
||||
const tabs = computed(() => {
|
||||
let tabOptions = [
|
||||
{
|
||||
name: 'Details',
|
||||
label: __('Details'),
|
||||
icon: DetailsIcon,
|
||||
condition: () => isMobileView.value,
|
||||
},
|
||||
{
|
||||
name: 'Activity',
|
||||
label: __('Activity'),
|
||||
icon: ActivityIcon,
|
||||
},
|
||||
{
|
||||
name: 'Emails',
|
||||
label: __('Emails'),
|
||||
icon: EmailIcon,
|
||||
},
|
||||
{
|
||||
name: 'Comments',
|
||||
label: __('Comments'),
|
||||
icon: CommentIcon,
|
||||
},
|
||||
{
|
||||
name: 'Calls',
|
||||
label: __('Calls'),
|
||||
icon: PhoneIcon,
|
||||
condition: () => callEnabled.value,
|
||||
},
|
||||
{
|
||||
name: 'Tasks',
|
||||
label: __('Tasks'),
|
||||
icon: TaskIcon,
|
||||
},
|
||||
{
|
||||
name: 'Notes',
|
||||
label: __('Notes'),
|
||||
icon: NoteIcon,
|
||||
},
|
||||
{
|
||||
name: 'WhatsApp',
|
||||
label: __('WhatsApp'),
|
||||
icon: WhatsAppIcon,
|
||||
condition: () => whatsappEnabled.value,
|
||||
},
|
||||
]
|
||||
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||
})
|
||||
|
||||
const detailSections = computed(() => {
|
||||
let data = deal.data
|
||||
if (!data) return []
|
||||
return getParsedFields(data.doctype_fields, deal_contacts.data)
|
||||
})
|
||||
|
||||
function getParsedFields(sections, contacts) {
|
||||
sections.forEach((section) => {
|
||||
if (section.name == 'contacts_tab') {
|
||||
delete section.fields
|
||||
section.contacts =
|
||||
contacts?.map((contact) => {
|
||||
return {
|
||||
name: contact.name,
|
||||
full_name: contact.full_name,
|
||||
email: contact.email,
|
||||
mobile_no: contact.mobile_no,
|
||||
image: contact.image,
|
||||
is_primary: contact.is_primary,
|
||||
opened: false,
|
||||
}
|
||||
}) || []
|
||||
} else {
|
||||
section.fields.forEach((field) => {
|
||||
if (field.name == 'organization') {
|
||||
field.create = (value, close) => {
|
||||
_organization.value.organization_name = value
|
||||
showOrganizationModal.value = true
|
||||
close()
|
||||
}
|
||||
field.link = (org) =>
|
||||
router.push({
|
||||
name: 'Organization',
|
||||
params: { organizationId: org },
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
return sections
|
||||
}
|
||||
|
||||
const showContactModal = ref(false)
|
||||
const _contact = ref({})
|
||||
|
||||
function contactOptions(contact) {
|
||||
let options = [
|
||||
{
|
||||
label: __('Delete'),
|
||||
icon: 'trash-2',
|
||||
onClick: () => removeContact(contact),
|
||||
},
|
||||
]
|
||||
|
||||
if (!contact.is_primary) {
|
||||
options.push({
|
||||
label: __('Set as Primary Contact'),
|
||||
icon: h(SuccessIcon, { class: 'h-4 w-4' }),
|
||||
onClick: () => setPrimaryContact(contact),
|
||||
})
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
async function addContact(contact) {
|
||||
let d = await call('crm.fcrm.doctype.crm_deal.crm_deal.add_contact', {
|
||||
deal: props.dealId,
|
||||
contact,
|
||||
})
|
||||
if (d) {
|
||||
deal_contacts.reload()
|
||||
createToast({
|
||||
title: __('Contact added'),
|
||||
icon: 'check',
|
||||
iconClasses: 'text-green-600',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function removeContact(contact) {
|
||||
let d = await call('crm.fcrm.doctype.crm_deal.crm_deal.remove_contact', {
|
||||
deal: props.dealId,
|
||||
contact,
|
||||
})
|
||||
if (d) {
|
||||
deal_contacts.reload()
|
||||
createToast({
|
||||
title: __('Contact removed'),
|
||||
icon: 'check',
|
||||
iconClasses: 'text-green-600',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function setPrimaryContact(contact) {
|
||||
let d = await call('crm.fcrm.doctype.crm_deal.crm_deal.set_primary_contact', {
|
||||
deal: props.dealId,
|
||||
contact,
|
||||
})
|
||||
if (d) {
|
||||
deal_contacts.reload()
|
||||
createToast({
|
||||
title: __('Primary contact set'),
|
||||
icon: 'check',
|
||||
iconClasses: 'text-green-600',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const deal_contacts = createResource({
|
||||
url: 'crm.fcrm.doctype.crm_deal.api.get_deal_contacts',
|
||||
params: { name: props.dealId },
|
||||
cache: ['deal_contacts', props.dealId],
|
||||
auto: true,
|
||||
})
|
||||
|
||||
function updateField(name, value, callback) {
|
||||
updateDeal(name, value, () => {
|
||||
deal.data[name] = value
|
||||
callback?.()
|
||||
})
|
||||
}
|
||||
|
||||
async function deleteDeal(name) {
|
||||
await call('frappe.client.delete', {
|
||||
doctype: 'CRM Deal',
|
||||
name,
|
||||
})
|
||||
router.push({ name: 'Deals' })
|
||||
}
|
||||
</script>
|
||||
468
frontend/src/pages/MobileLead.vue
Normal file
@ -0,0 +1,468 @@
|
||||
<template>
|
||||
<LayoutHeader v-if="lead.data">
|
||||
<header
|
||||
class="relative flex h-12 items-center justify-between gap-2 py-2.5 pl-5"
|
||||
>
|
||||
<Breadcrumbs :items="breadcrumbs" />
|
||||
<div class="absolute right-0">
|
||||
<Dropdown :options="statusOptions('lead', updateField)">
|
||||
<template #default="{ open }">
|
||||
<Button
|
||||
:label="lead.data.status"
|
||||
:class="getLeadStatus(lead.data.status).colorClass"
|
||||
>
|
||||
<template #prefix>
|
||||
<IndicatorIcon />
|
||||
</template>
|
||||
<template #suffix>
|
||||
<FeatherIcon
|
||||
:name="open ? 'chevron-up' : 'chevron-down'"
|
||||
class="h-4"
|
||||
/>
|
||||
</template>
|
||||
</Button>
|
||||
</template>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</header>
|
||||
</LayoutHeader>
|
||||
<div
|
||||
v-if="lead.data"
|
||||
class="flex h-12 items-center justify-between gap-2 border-b px-3 py-2.5"
|
||||
>
|
||||
<component :is="lead.data._assignedTo?.length == 1 ? 'Button' : 'div'">
|
||||
<MultipleAvatar
|
||||
:avatars="lead.data._assignedTo"
|
||||
@click="showAssignmentModal = true"
|
||||
/>
|
||||
</component>
|
||||
<div class="flex items-center gap-2">
|
||||
<CustomActions
|
||||
v-if="lead.data._customActions"
|
||||
:actions="lead.data._customActions"
|
||||
/>
|
||||
<Button
|
||||
:label="__('Convert')"
|
||||
variant="solid"
|
||||
@click="showConvertToDealModal = true"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="lead?.data" class="flex h-full overflow-hidden">
|
||||
<Tabs
|
||||
v-model="tabIndex"
|
||||
v-slot="{ tab }"
|
||||
:tabs="tabs"
|
||||
tablistClass="!px-3"
|
||||
class="overflow-auto"
|
||||
>
|
||||
<div v-if="tab.name == 'Details'">
|
||||
<SLASection
|
||||
v-if="lead.data.sla_status"
|
||||
v-model="lead.data"
|
||||
@updateField="updateField"
|
||||
/>
|
||||
<div
|
||||
v-if="detailSections.length"
|
||||
class="flex flex-1 flex-col justify-between overflow-hidden"
|
||||
>
|
||||
<div class="flex flex-col overflow-y-auto">
|
||||
<div
|
||||
v-for="(section, i) in detailSections"
|
||||
:key="section.label"
|
||||
class="flex flex-col px-2 py-3 sm:p-3"
|
||||
:class="{ 'border-b': i !== detailSections.length - 1 }"
|
||||
>
|
||||
<Section :is-opened="section.opened" :label="section.label">
|
||||
<SectionFields
|
||||
:fields="section.fields"
|
||||
v-model="lead.data"
|
||||
@update="updateField"
|
||||
/>
|
||||
</Section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Activities
|
||||
v-else
|
||||
doctype="CRM Lead"
|
||||
:title="tab.name"
|
||||
:tabs="tabs"
|
||||
v-model:reload="reload"
|
||||
v-model:tabIndex="tabIndex"
|
||||
v-model="lead"
|
||||
/>
|
||||
</Tabs>
|
||||
</div>
|
||||
<AssignmentModal
|
||||
v-if="lead.data"
|
||||
:doc="lead.data"
|
||||
doctype="CRM Lead"
|
||||
v-model="showAssignmentModal"
|
||||
v-model:assignees="lead.data._assignedTo"
|
||||
/>
|
||||
<Dialog
|
||||
v-model="showConvertToDealModal"
|
||||
:options="{
|
||||
title: __('Convert to Deal'),
|
||||
size: 'xl',
|
||||
actions: [
|
||||
{
|
||||
label: __('Convert'),
|
||||
variant: 'solid',
|
||||
onClick: convertToDeal,
|
||||
},
|
||||
],
|
||||
}"
|
||||
>
|
||||
<template #body-content>
|
||||
<div class="mb-4 flex items-center gap-2 text-gray-600">
|
||||
<OrganizationsIcon class="h-4 w-4" />
|
||||
<label class="block text-base">{{ __('Organization') }}</label>
|
||||
</div>
|
||||
<div class="ml-6">
|
||||
<div class="flex items-center justify-between text-base">
|
||||
<div>{{ __('Choose Existing') }}</div>
|
||||
<Switch v-model="existingOrganizationChecked" />
|
||||
</div>
|
||||
<Link
|
||||
v-if="existingOrganizationChecked"
|
||||
class="form-control mt-2.5"
|
||||
variant="outline"
|
||||
size="md"
|
||||
:value="existingOrganization"
|
||||
doctype="CRM Organization"
|
||||
@change="(data) => (existingOrganization = data)"
|
||||
/>
|
||||
<div v-else class="mt-2.5 text-base">
|
||||
{{
|
||||
__(
|
||||
'New organization will be created based on the data in details section'
|
||||
)
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 mt-6 flex items-center gap-2 text-gray-600">
|
||||
<ContactsIcon class="h-4 w-4" />
|
||||
<label class="block text-base">{{ __('Contact') }}</label>
|
||||
</div>
|
||||
<div class="ml-6">
|
||||
<div class="flex items-center justify-between text-base">
|
||||
<div>{{ __('Choose Existing') }}</div>
|
||||
<Switch v-model="existingContactChecked" />
|
||||
</div>
|
||||
<Link
|
||||
v-if="existingContactChecked"
|
||||
class="form-control mt-2.5"
|
||||
variant="outline"
|
||||
size="md"
|
||||
:value="existingContact"
|
||||
doctype="Contact"
|
||||
@change="(data) => (existingContact = data)"
|
||||
/>
|
||||
<div v-else class="mt-2.5 text-base">
|
||||
{{ __("New contact will be created based on the person's details") }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import DetailsIcon from '@/components/Icons/DetailsIcon.vue'
|
||||
import ActivityIcon from '@/components/Icons/ActivityIcon.vue'
|
||||
import EmailIcon from '@/components/Icons/EmailIcon.vue'
|
||||
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 WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
|
||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||
import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
|
||||
import ContactsIcon from '@/components/Icons/ContactsIcon.vue'
|
||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
import Activities from '@/components/Activities.vue'
|
||||
import AssignmentModal from '@/components/Modals/AssignmentModal.vue'
|
||||
import MultipleAvatar from '@/components/MultipleAvatar.vue'
|
||||
import Link from '@/components/Controls/Link.vue'
|
||||
import Section from '@/components/Section.vue'
|
||||
import SectionFields from '@/components/SectionFields.vue'
|
||||
import SLASection from '@/components/SLASection.vue'
|
||||
import CustomActions from '@/components/CustomActions.vue'
|
||||
import { createToast, setupAssignees, setupCustomActions } from '@/utils'
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { contactsStore } from '@/stores/contacts'
|
||||
import { organizationsStore } from '@/stores/organizations'
|
||||
import { statusesStore } from '@/stores/statuses'
|
||||
import { whatsappEnabled, callEnabled, isMobileView } from '@/stores/settings'
|
||||
import {
|
||||
createResource,
|
||||
Dropdown,
|
||||
Tabs,
|
||||
Switch,
|
||||
Breadcrumbs,
|
||||
call,
|
||||
} from 'frappe-ui'
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
|
||||
const { $dialog } = globalStore()
|
||||
const { getContactByName, contacts } = contactsStore()
|
||||
const { organizations } = organizationsStore()
|
||||
const { statusOptions, getLeadStatus } = statusesStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const props = defineProps({
|
||||
leadId: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
})
|
||||
|
||||
const lead = createResource({
|
||||
url: 'crm.fcrm.doctype.crm_lead.api.get_lead',
|
||||
params: { name: props.leadId },
|
||||
cache: ['lead', props.leadId],
|
||||
onSuccess: (data) => {
|
||||
setupAssignees(data)
|
||||
setupCustomActions(data, {
|
||||
doc: data,
|
||||
$dialog,
|
||||
router,
|
||||
updateField,
|
||||
createToast,
|
||||
deleteDoc: deleteLead,
|
||||
call,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (lead.data) return
|
||||
lead.fetch()
|
||||
})
|
||||
|
||||
const reload = ref(false)
|
||||
const showAssignmentModal = ref(false)
|
||||
|
||||
function updateLead(fieldname, value, callback) {
|
||||
value = Array.isArray(fieldname) ? '' : value
|
||||
|
||||
if (!Array.isArray(fieldname) && validateRequired(fieldname, value)) return
|
||||
|
||||
createResource({
|
||||
url: 'frappe.client.set_value',
|
||||
params: {
|
||||
doctype: 'CRM Lead',
|
||||
name: props.leadId,
|
||||
fieldname,
|
||||
value,
|
||||
},
|
||||
auto: true,
|
||||
onSuccess: () => {
|
||||
lead.reload()
|
||||
reload.value = true
|
||||
createToast({
|
||||
title: __('Lead updated'),
|
||||
icon: 'check',
|
||||
iconClasses: 'text-green-600',
|
||||
})
|
||||
callback?.()
|
||||
},
|
||||
onError: (err) => {
|
||||
createToast({
|
||||
title: __('Error updating lead'),
|
||||
text: __(err.messages?.[0]),
|
||||
icon: 'x',
|
||||
iconClasses: 'text-red-600',
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function validateRequired(fieldname, value) {
|
||||
let meta = lead.data.all_fields || {}
|
||||
if (meta[fieldname]?.reqd && !value) {
|
||||
createToast({
|
||||
title: __('Error Updating Lead'),
|
||||
text: __('{0} is a required field', [meta[fieldname].label]),
|
||||
icon: 'x',
|
||||
iconClasses: 'text-red-600',
|
||||
})
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const breadcrumbs = computed(() => {
|
||||
let items = [{ label: __('Leads'), route: { name: 'Leads' } }]
|
||||
items.push({
|
||||
label: lead.data.lead_name || __('Untitled'),
|
||||
route: { name: 'Lead', params: { leadId: lead.data.name } },
|
||||
})
|
||||
return items
|
||||
})
|
||||
|
||||
const tabIndex = ref(0)
|
||||
|
||||
const tabs = computed(() => {
|
||||
let tabOptions = [
|
||||
{
|
||||
name: 'Details',
|
||||
label: __('Details'),
|
||||
icon: DetailsIcon,
|
||||
condition: () => isMobileView.value,
|
||||
},
|
||||
{
|
||||
name: 'Activity',
|
||||
label: __('Activity'),
|
||||
icon: ActivityIcon,
|
||||
},
|
||||
{
|
||||
name: 'Emails',
|
||||
label: __('Emails'),
|
||||
icon: EmailIcon,
|
||||
},
|
||||
{
|
||||
name: 'Comments',
|
||||
label: __('Comments'),
|
||||
icon: CommentIcon,
|
||||
},
|
||||
{
|
||||
name: 'Calls',
|
||||
label: __('Calls'),
|
||||
icon: PhoneIcon,
|
||||
condition: () => callEnabled.value,
|
||||
},
|
||||
{
|
||||
name: 'Tasks',
|
||||
label: __('Tasks'),
|
||||
icon: TaskIcon,
|
||||
},
|
||||
{
|
||||
name: 'Notes',
|
||||
label: __('Notes'),
|
||||
icon: NoteIcon,
|
||||
},
|
||||
{
|
||||
name: 'WhatsApp',
|
||||
label: __('WhatsApp'),
|
||||
icon: WhatsAppIcon,
|
||||
condition: () => whatsappEnabled.value,
|
||||
},
|
||||
]
|
||||
return tabOptions.filter((tab) => (tab.condition ? tab.condition() : true))
|
||||
})
|
||||
|
||||
watch(tabs, (value) => {
|
||||
if (value && route.params.tabName) {
|
||||
let index = value.findIndex(
|
||||
(tab) => tab.name.toLowerCase() === route.params.tabName.toLowerCase()
|
||||
)
|
||||
if (index !== -1) {
|
||||
tabIndex.value = index
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const detailSections = computed(() => {
|
||||
let data = lead.data
|
||||
if (!data) return []
|
||||
return data.doctype_fields
|
||||
})
|
||||
|
||||
function updateField(name, value, callback) {
|
||||
updateLead(name, value, () => {
|
||||
lead.data[name] = value
|
||||
callback?.()
|
||||
})
|
||||
}
|
||||
|
||||
async function deleteLead(name) {
|
||||
await call('frappe.client.delete', {
|
||||
doctype: 'CRM Lead',
|
||||
name,
|
||||
})
|
||||
router.push({ name: 'Leads' })
|
||||
}
|
||||
|
||||
// Convert to Deal
|
||||
const showConvertToDealModal = ref(false)
|
||||
const existingContactChecked = ref(false)
|
||||
const existingOrganizationChecked = ref(false)
|
||||
|
||||
const existingContact = ref('')
|
||||
const existingOrganization = ref('')
|
||||
|
||||
async function convertToDeal(updated) {
|
||||
let valueUpdated = false
|
||||
|
||||
if (existingContactChecked.value && !existingContact.value) {
|
||||
createToast({
|
||||
title: __('Error'),
|
||||
text: __('Please select an existing contact'),
|
||||
icon: 'x',
|
||||
iconClasses: 'text-red-600',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (existingOrganizationChecked.value && !existingOrganization.value) {
|
||||
createToast({
|
||||
title: __('Error'),
|
||||
text: __('Please select an existing organization'),
|
||||
icon: 'x',
|
||||
iconClasses: 'text-red-600',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (existingContactChecked.value && existingContact.value) {
|
||||
lead.data.salutation = getContactByName(existingContact.value).salutation
|
||||
lead.data.first_name = getContactByName(existingContact.value).first_name
|
||||
lead.data.last_name = getContactByName(existingContact.value).last_name
|
||||
lead.data.email_id = getContactByName(existingContact.value).email_id
|
||||
lead.data.mobile_no = getContactByName(existingContact.value).mobile_no
|
||||
existingContactChecked.value = false
|
||||
valueUpdated = true
|
||||
}
|
||||
|
||||
if (existingOrganizationChecked.value && existingOrganization.value) {
|
||||
lead.data.organization = existingOrganization.value
|
||||
existingOrganizationChecked.value = false
|
||||
valueUpdated = true
|
||||
}
|
||||
|
||||
if (valueUpdated) {
|
||||
updateLead(
|
||||
{
|
||||
salutation: lead.data.salutation,
|
||||
first_name: lead.data.first_name,
|
||||
last_name: lead.data.last_name,
|
||||
email_id: lead.data.email_id,
|
||||
mobile_no: lead.data.mobile_no,
|
||||
organization: lead.data.organization,
|
||||
},
|
||||
'',
|
||||
() => convertToDeal(true)
|
||||
)
|
||||
showConvertToDealModal.value = false
|
||||
} else {
|
||||
let deal = await call(
|
||||
'crm.fcrm.doctype.crm_lead.crm_lead.convert_to_deal',
|
||||
{
|
||||
lead: lead.data.name,
|
||||
}
|
||||
)
|
||||
if (deal) {
|
||||
if (updated) {
|
||||
await organizations.reload()
|
||||
await contacts.reload()
|
||||
}
|
||||
router.push({ name: 'Deal', params: { dealId: deal } })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
115
frontend/src/pages/MobileNotification.vue
Normal file
@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<LayoutHeader>
|
||||
<template #left-header>
|
||||
<Breadcrumbs
|
||||
:items="[
|
||||
{ label: __('Notifications'), route: { name: 'Notifications' } },
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #right-header>
|
||||
<Tooltip :text="__('Mark all as read')">
|
||||
<div>
|
||||
<Button
|
||||
:label="__('Mark all as read')"
|
||||
@click="() => notificationsStore().mark_as_read.reload()"
|
||||
>
|
||||
<template #prefix>
|
||||
<MarkAsDoneIcon class="h-4 w-4" />
|
||||
</template>
|
||||
</Button>
|
||||
</div>
|
||||
</Tooltip>
|
||||
</template>
|
||||
</LayoutHeader>
|
||||
<div class="flex flex-col overflow-hidden">
|
||||
<div
|
||||
v-if="notificationsStore().allNotifications?.length"
|
||||
class="divide-y overflow-y-auto text-base"
|
||||
>
|
||||
<RouterLink
|
||||
v-for="n in notificationsStore().allNotifications"
|
||||
:key="n.comment"
|
||||
:to="getRoute(n)"
|
||||
class="flex cursor-pointer items-start gap-3 px-2.5 py-3 hover:bg-gray-100"
|
||||
@click="mark_as_read(n.comment || n.notification_type_doc)"
|
||||
>
|
||||
<div class="mt-1 flex items-center gap-2.5">
|
||||
<div
|
||||
class="size-[5px] rounded-full"
|
||||
:class="[n.read ? 'bg-transparent' : 'bg-gray-900']"
|
||||
/>
|
||||
<WhatsAppIcon v-if="n.type == 'WhatsApp'" class="size-7" />
|
||||
<UserAvatar v-else :user="n.from_user.name" size="lg" />
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="n.notification_text" v-html="n.notification_text" />
|
||||
<div v-else class="mb-2 space-x-1 leading-5 text-gray-600">
|
||||
<span class="font-medium text-gray-900">
|
||||
{{ n.from_user.full_name }}
|
||||
</span>
|
||||
<span>
|
||||
{{ __('mentioned you in {0}', [n.reference_doctype]) }}
|
||||
</span>
|
||||
<span class="font-medium text-gray-900">
|
||||
{{ n.reference_name }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-sm text-gray-600">
|
||||
{{ __(timeAgo(n.creation)) }}
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</div>
|
||||
<div v-else class="flex flex-1 flex-col items-center justify-center gap-2">
|
||||
<NotificationsIcon class="h-20 w-20 text-gray-300" />
|
||||
<div class="text-lg font-medium text-gray-500">
|
||||
{{ __('No new notifications') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||
import WhatsAppIcon from '@/components/Icons/WhatsAppIcon.vue'
|
||||
import MarkAsDoneIcon from '@/components/Icons/MarkAsDoneIcon.vue'
|
||||
import NotificationsIcon from '@/components/Icons/NotificationsIcon.vue'
|
||||
import UserAvatar from '@/components/UserAvatar.vue'
|
||||
import { notificationsStore } from '@/stores/notifications'
|
||||
import { globalStore } from '@/stores/global'
|
||||
import { timeAgo } from '@/utils'
|
||||
import { Breadcrumbs, Tooltip } from 'frappe-ui'
|
||||
import { onMounted, onBeforeUnmount } from 'vue'
|
||||
|
||||
const { $socket } = globalStore()
|
||||
|
||||
function mark_as_read(doc) {
|
||||
notificationsStore().mark_doc_as_read(doc)
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
$socket.off('crm_notification')
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
$socket.on('crm_notification', () => {
|
||||
notificationsStore().notifications.reload()
|
||||
})
|
||||
})
|
||||
|
||||
function getRoute(notification) {
|
||||
let params = {
|
||||
leadId: notification.reference_name,
|
||||
}
|
||||
if (notification.route_name === 'Deal') {
|
||||
params = {
|
||||
dealId: notification.reference_name,
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: notification.route_name,
|
||||
params: params,
|
||||
hash: '#' + notification.comment || notification.notification_type_doc,
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -22,7 +22,7 @@
|
||||
<div class="flex-1 overflow-y-auto">
|
||||
<div
|
||||
v-if="notes.data?.data?.length"
|
||||
class="grid grid-cols-4 gap-4 px-5 pb-3"
|
||||
class="grid sm:grid-cols-4 grid-cols-1 gap-4 px-5 pb-3"
|
||||
>
|
||||
<div
|
||||
v-for="note in notes.data.data"
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
:validateFile="validateFile"
|
||||
>
|
||||
<template #default="{ openFileSelector, error }">
|
||||
<div class="flex items-center justify-start gap-6 p-5">
|
||||
<div class="flex items-start justify-start gap-6 p-5 sm:items-center">
|
||||
<div class="group relative h-24 w-24">
|
||||
<Avatar
|
||||
size="3xl"
|
||||
@ -53,11 +53,13 @@
|
||||
</div>
|
||||
</component>
|
||||
</div>
|
||||
<div class="flex flex-col justify-center gap-0.5">
|
||||
<div class="flex flex-col justify-center gap-2 sm:gap-0.5">
|
||||
<div class="text-3xl font-semibold text-gray-900">
|
||||
{{ organization.doc.name }}
|
||||
</div>
|
||||
<div class="flex items-center gap-2 text-base text-gray-700">
|
||||
<div
|
||||
class="flex flex-col flex-wrap gap-3 text-base text-gray-700 sm:flex-row sm:items-center sm:gap-2"
|
||||
>
|
||||
<div
|
||||
v-if="organization.doc.website"
|
||||
class="flex items-center gap-1.5"
|
||||
@ -67,7 +69,7 @@
|
||||
</div>
|
||||
<span
|
||||
v-if="organization.doc.website"
|
||||
class="text-3xl leading-[0] text-gray-600"
|
||||
class="hidden text-3xl leading-[0] text-gray-600 sm:flex"
|
||||
>
|
||||
·
|
||||
</span>
|
||||
@ -80,7 +82,7 @@
|
||||
</div>
|
||||
<span
|
||||
v-if="organization.doc.industry"
|
||||
class="text-3xl leading-[0] text-gray-600"
|
||||
class="hidden text-3xl leading-[0] text-gray-600 sm:flex"
|
||||
>
|
||||
·
|
||||
</span>
|
||||
@ -93,7 +95,7 @@
|
||||
</div>
|
||||
<span
|
||||
v-if="organization.doc.territory"
|
||||
class="text-3xl leading-[0] text-gray-600"
|
||||
class="hidden text-3xl leading-[0] text-gray-600 sm:flex"
|
||||
>
|
||||
·
|
||||
</span>
|
||||
@ -106,7 +108,7 @@
|
||||
</div>
|
||||
<span
|
||||
v-if="organization.doc.annual_revenue"
|
||||
class="text-3xl leading-[0] text-gray-600"
|
||||
class="hidden text-3xl leading-[0] text-gray-600 sm:flex"
|
||||
>
|
||||
·
|
||||
</span>
|
||||
@ -119,7 +121,7 @@
|
||||
"
|
||||
variant="ghost"
|
||||
:label="__('More')"
|
||||
class="-ml-1 cursor-pointer hover:text-gray-900"
|
||||
class="w-fit cursor-pointer hover:text-gray-900 sm:-ml-1"
|
||||
@click="
|
||||
() => {
|
||||
detailMode = true
|
||||
|
||||
@ -8,6 +8,11 @@ const routes = [
|
||||
redirect: { name: 'Leads' },
|
||||
name: 'Home',
|
||||
},
|
||||
{
|
||||
path: '/notifications',
|
||||
name: 'Notifications',
|
||||
component: () => import('@/pages/MobileNotification.vue'),
|
||||
},
|
||||
{
|
||||
path: '/leads',
|
||||
name: 'Leads',
|
||||
@ -17,7 +22,7 @@ const routes = [
|
||||
{
|
||||
path: '/leads/:leadId/:tabName?',
|
||||
name: 'Lead',
|
||||
component: () => import('@/pages/Lead.vue'),
|
||||
component: () => import(`@/pages/${handleMobileView('Lead')}.vue`),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
@ -29,7 +34,7 @@ const routes = [
|
||||
{
|
||||
path: '/deals/:dealId/:tabName?',
|
||||
name: 'Deal',
|
||||
component: () => import('@/pages/Deal.vue'),
|
||||
component: () => import(`@/pages/${handleMobileView('Deal')}.vue`),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
@ -101,6 +106,10 @@ const routes = [
|
||||
},
|
||||
]
|
||||
|
||||
const handleMobileView = (componentName) => {
|
||||
return window.innerWidth < 768 ? `Mobile${componentName}` : componentName
|
||||
}
|
||||
|
||||
const scrollBehavior = (to, from, savedPosition) => {
|
||||
if (to.name === from.name) {
|
||||
to.meta?.scrollPos && (to.meta.scrollPos.top = 0)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { createResource } from 'frappe-ui'
|
||||
import { ref } from 'vue'
|
||||
import { useScreenSize } from '@/composables'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
export const whatsappEnabled = ref(false)
|
||||
createResource({
|
||||
@ -19,3 +20,8 @@ createResource({
|
||||
callEnabled.value = Boolean(data)
|
||||
},
|
||||
})
|
||||
|
||||
export const mobileSidebarOpened = ref(false)
|
||||
|
||||
const screenSize = useScreenSize()
|
||||
export const isMobileView = computed(() => screenSize.width < 768)
|
||||
|
||||
@ -2,6 +2,7 @@ import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import path from 'path'
|
||||
import frappeui from 'frappe-ui/vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
@ -12,6 +13,45 @@ export default defineConfig({
|
||||
propsDestructure: true,
|
||||
},
|
||||
}),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
devOptions: {
|
||||
enabled: true,
|
||||
},
|
||||
manifest: {
|
||||
display: 'standalone',
|
||||
name: 'Frappe CRM',
|
||||
short_name: 'Frappe CRM',
|
||||
start_url: "/crm",
|
||||
description: 'Modern & 100% Open-source CRM tool to supercharge your sales operations',
|
||||
icons: [
|
||||
{
|
||||
src: '/assets/crm/manifest/manifest-icon-192.maskable.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png',
|
||||
purpose: 'any',
|
||||
},
|
||||
{
|
||||
src: '/assets/crm/manifest/manifest-icon-192.maskable.png',
|
||||
sizes: '192x192',
|
||||
type: 'image/png',
|
||||
purpose: 'maskable',
|
||||
},
|
||||
{
|
||||
src: '/assets/crm/manifest/manifest-icon-512.maskable.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
purpose: 'any',
|
||||
},
|
||||
{
|
||||
src: '/assets/crm/manifest/manifest-icon-512.maskable.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
purpose: 'maskable',
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||