Skip to content

Commit

Permalink
Merge pull request #16 from shariquerik/frappeui-tabs-component
Browse files Browse the repository at this point in the history
  • Loading branch information
shariquerik committed Oct 2, 2023
2 parents afa7f61 + 2772ced commit 35b0bf9
Show file tree
Hide file tree
Showing 19 changed files with 734 additions and 9,200 deletions.
8 changes: 1 addition & 7 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ node_modules
.DS_Store
dist
dist-ssr
*.local
*.pyc
*.egg-info
*.swp
tags
crm/public/frontend
__pycache__
*.local
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@vueuse/integrations": "^10.3.0",
"autoprefixer": "^10.4.14",
"feather-icons": "^4.28.0",
"frappe-ui": "^0.1.5",
"frappe-ui": "^0.1.6",
"pinia": "^2.0.33",
"postcss": "^8.4.5",
"socket.io-client": "^4.7.2",
Expand Down
27 changes: 0 additions & 27 deletions frontend/src/components/Breadcrumbs.vue

This file was deleted.

16 changes: 1 addition & 15 deletions frontend/src/components/NewDeal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import UserAvatar from '@/components/UserAvatar.vue'
import { usersStore } from '@/stores/users'
import { dealStatuses, statusDropdownOptions } from '@/utils'
import { dealStatuses, statusDropdownOptions, activeAgents } from '@/utils'
import {
FormControl,
Button,
Expand Down Expand Up @@ -153,18 +153,4 @@ const allFields = [
],
},
]
const activeAgents = computed(() => {
const nonAgents = ['Administrator', 'Guest']
return users.data
.filter((user) => !nonAgents.includes(user.name))
.sort((a, b) => a.full_name - b.full_name)
.map((user) => {
return {
label: user.full_name,
value: user.email,
...user,
}
})
})
</script>
25 changes: 6 additions & 19 deletions frontend/src/components/NewLead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div v-for="section in allFields" :key="section.section">
<div class="grid grid-cols-3 gap-4">
<div v-for="field in section.fields" :key="field.name">
<div class="text-gray-600 text-sm mb-2">{{ field.label }}</div>
<div class="mb-2 text-sm text-gray-600">{{ field.label }}</div>
<FormControl
v-if="field.type === 'select'"
type="select"
Expand Down Expand Up @@ -41,10 +41,12 @@
<template #default="{ open }">
<Button
:label="newLead[field.name]"
class="justify-between w-full"
class="w-full justify-between"
>
<template #prefix>
<IndicatorIcon :class="leadStatuses[newLead[field.name]].color" />
<IndicatorIcon
:class="leadStatuses[newLead[field.name]].color"
/>
</template>
<template #default>{{ newLead[field.name] }}</template>
<template #suffix>
Expand All @@ -67,7 +69,7 @@
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
import UserAvatar from '@/components/UserAvatar.vue'
import { usersStore } from '@/stores/users'
import { leadStatuses, statusDropdownOptions } from '@/utils'
import { leadStatuses, statusDropdownOptions, activeAgents } from '@/utils'
import {
FormControl,
Button,
Expand Down Expand Up @@ -153,19 +155,4 @@ const allFields = [
],
},
]
const activeAgents = computed(() => {
const nonAgents = ['Administrator', 'Guest']
return users.data
.filter((user) => !nonAgents.includes(user.name))
.sort((a, b) => a.full_name - b.full_name)
.map((user) => {
return {
label: user.full_name,
value: user.email,
...user,
}
})
})
</script>
29 changes: 16 additions & 13 deletions frontend/src/pages/CallLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
</template>
</LayoutHeader>
<div class="border-b"></div>
<div v-if="callLog.data" class="p-6 max-w-lg">
<div v-if="callLog.data" class="max-w-lg p-6">
<div class="pb-3 text-base font-medium">Call details</div>
<div class="flex flex-col gap-4 border rounded-lg p-4 mb-3 shadow-sm">
<div class="mb-3 flex flex-col gap-4 rounded-lg border p-4 shadow-sm">
<div class="flex items-center justify-between">
<div class="flex items-center gap-2">
<FeatherIcon
Expand All @@ -26,7 +26,7 @@
? 'phone-incoming'
: 'phone-outgoing'
"
class="w-4 h-4 text-gray-600"
class="h-4 w-4 text-gray-600"
/>
<div class="font-medium">
{{ callLog.data.type == 'Incoming' ? 'Inbound' : 'Outbound' }} call
Expand All @@ -48,21 +48,21 @@
:label="callLog.data.caller.label"
size="xl"
/>
<div class="flex flex-col gap-1 ml-1">
<div class="ml-1 flex flex-col gap-1">
<div class="text-base font-medium">
{{ callLog.data.caller.label }}
</div>
<div class="text-xs text-gray-600">
{{ callLog.data.from }}
</div>
</div>
<FeatherIcon name="arrow-right" class="w-5 h-5 text-gray-600 mx-2" />
<FeatherIcon name="arrow-right" class="mx-2 h-5 w-5 text-gray-600" />
<Avatar
:image="callLog.data.receiver.image"
:label="callLog.data.receiver.label"
size="xl"
/>
<div class="flex flex-col gap-1 ml-1">
<div class="ml-1 flex flex-col gap-1">
<div class="text-base font-medium">
{{ callLog.data.receiver.label }}
</div>
Expand All @@ -74,13 +74,13 @@
</div>
<div class="flex items-center justify-between">
<div class="flex items-center gap-1">
<DurationIcon class="w-4 h-4 text-gray-600" />
<DurationIcon class="h-4 w-4 text-gray-600" />
<div class="text-sm text-gray-600">Duration</div>
<div class="text-sm">{{ callLog.data.duration }}</div>
</div>
<div>
<Tooltip
class="text-gray-600 text-sm"
class="text-sm text-gray-600"
:text="dateFormat(callLog.data.creation, dateTooltipFormat)"
>
{{ timeAgo(callLog.data.creation) }}
Expand All @@ -91,7 +91,7 @@

<div v-if="callLog.data.recording_url" class="mt-6">
<div class="mb-3 text-base font-medium">Call recording</div>
<div class="flex items-center justify-between border rounded shadow-sm">
<div class="flex items-center justify-between rounded border shadow-sm">
<audio
class="audio-control"
controls
Expand All @@ -103,10 +103,10 @@
<div v-if="callLog.data.note" class="mt-6">
<div class="mb-3 text-base font-medium">Call note</div>
<div
class="flex flex-col gap-3 border rounded p-4 shadow-sm cursor-pointer h-56"
class="flex h-56 cursor-pointer flex-col gap-3 rounded border p-4 shadow-sm"
@click="showNoteModal = true"
>
<div class="text-lg font-medium truncate">
<div class="truncate text-lg font-medium">
{{ callLog.data.note_doc.title }}
</div>
<TextEditor
Expand Down Expand Up @@ -141,7 +141,6 @@

<script setup>
import LayoutHeader from '@/components/LayoutHeader.vue'
import Breadcrumbs from '@/components/Breadcrumbs.vue'
import DurationIcon from '@/components/Icons/DurationIcon.vue'
import NoteModal from '@/components/NoteModal.vue'
import { dateFormat, timeAgo, dateTooltipFormat } from '@/utils'
Expand All @@ -153,6 +152,7 @@ import {
Tooltip,
Badge,
createResource,
Breadcrumbs,
} from 'frappe-ui'
import { usersStore } from '@/stores/users'
import { contactsStore } from '@/stores/contacts'
Expand Down Expand Up @@ -232,7 +232,10 @@ function createLead() {
const breadcrumbs = computed(() => [
{ label: 'Call Logs', route: { name: 'Call Logs' } },
{ label: callLog.data?.caller.label },
{
label: callLog.data?.caller.label,
route: { name: 'Call Log', params: { callLogId: props.callLogId } },
},
])
</script>
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/pages/CallLogs.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<LayoutHeader>
<template #left-header>
<Breadcrumbs :items="[{ label: list.title }]" />
<Breadcrumbs :items="breadcrumbs" />
</template>
</LayoutHeader>
<div class="flex justify-between items-center px-5 pt-3 pb-4">
<div class="flex items-center justify-between px-5 pb-4 pt-3">
<div class="flex items-center gap-2">
<Button label="Sort">
<template #prefix><SortIcon class="h-4" /></template>
Expand All @@ -23,13 +23,12 @@
<script setup>
import ListView from '@/components/ListView.vue'
import LayoutHeader from '@/components/LayoutHeader.vue'
import Breadcrumbs from '@/components/Breadcrumbs.vue'
import SortIcon from '@/components/Icons/SortIcon.vue'
import FilterIcon from '@/components/Icons/FilterIcon.vue'
import { secondsToDuration } from '@/utils'
import { usersStore } from '@/stores/users'
import { contactsStore } from '@/stores/contacts'
import { Button, createListResource } from 'frappe-ui'
import { Button, createListResource, Breadcrumbs } from 'frappe-ui'
import { computed } from 'vue'
const { getUser } = usersStore()
Expand All @@ -41,6 +40,8 @@ const list = {
singular_label: 'Call Log',
}
const breadcrumbs = [{ label: list.title, route: { name: 'Call Logs' } }]
const callLogs = createListResource({
type: 'list',
doctype: 'CRM Call Log',
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/pages/Contacts.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<LayoutHeader>
<template #left-header>
<Breadcrumbs :items="[{ label: list.title }]" />
<Breadcrumbs :items="breadcrumbs" />
</template>
<template #right-header>
<Button variant="solid" label="Create">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button>
</template>
</LayoutHeader>
<div class="flex justify-between items-center px-5 pt-3 pb-4">
<div class="flex items-center justify-between px-5 pb-4 pt-3">
<div class="flex items-center gap-2">
<Dropdown :options="viewsDropdownOptions">
<template #default="{ open }">
Expand Down Expand Up @@ -42,10 +42,9 @@
<script setup>
import ListView from '@/components/ListView.vue'
import LayoutHeader from '@/components/LayoutHeader.vue'
import Breadcrumbs from '@/components/Breadcrumbs.vue'
import SortIcon from '@/components/Icons/SortIcon.vue'
import FilterIcon from '@/components/Icons/FilterIcon.vue'
import { FeatherIcon, Button, Dropdown } from 'frappe-ui'
import { FeatherIcon, Button, Dropdown, Breadcrumbs } from 'frappe-ui'
import { ref, computed } from 'vue'
import { contactsStore } from '@/stores/contacts.js'
Expand All @@ -57,6 +56,8 @@ const list = {
singular_label: 'Contact',
}
const breadcrumbs = [{ label: list.title, route: { name: 'Contacts' } }]
const columns = [
{
label: 'Full name',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/pages/Dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<template>
<LayoutHeader>
<template #left-header>
<Breadcrumbs :items="[{ label: title }]" />
<Breadcrumbs :items="breadcrumbs" />
</template>
</LayoutHeader>
</template>

<script setup>
import LayoutHeader from '@/components/LayoutHeader.vue'
import Breadcrumbs from '@/components/Breadcrumbs.vue'
import { Breadcrumbs } from 'frappe-ui'
let title = 'Dashboard'
const breadcrumbs = [{ label: title, route: { name: 'Dashboard' } }]
</script>
Loading

0 comments on commit 35b0bf9

Please sign in to comment.