refactor: changed split view or organization to listview
This commit is contained in:
parent
1caaa89278
commit
baf660be28
71
frontend/src/components/ListViews/OrganizationsListView.vue
Normal file
71
frontend/src/components/ListViews/OrganizationsListView.vue
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<template>
|
||||||
|
<ListView
|
||||||
|
:columns="columns"
|
||||||
|
:rows="rows"
|
||||||
|
:options="{
|
||||||
|
getRowRoute: (row) => ({
|
||||||
|
name: 'Organization',
|
||||||
|
params: { organizationId: row.name },
|
||||||
|
}),
|
||||||
|
selectable: options.selectable,
|
||||||
|
}"
|
||||||
|
row-key="name"
|
||||||
|
>
|
||||||
|
<ListHeader class="mx-5" />
|
||||||
|
<ListRows>
|
||||||
|
<ListRow
|
||||||
|
class="mx-5"
|
||||||
|
v-for="row in rows"
|
||||||
|
:key="row.name"
|
||||||
|
v-slot="{ column, item }"
|
||||||
|
:row="row"
|
||||||
|
>
|
||||||
|
<ListRowItem :item="item">
|
||||||
|
<template #prefix>
|
||||||
|
<div v-if="column.key === 'organization'">
|
||||||
|
<Avatar
|
||||||
|
v-if="item.label"
|
||||||
|
class="flex items-center"
|
||||||
|
:image="item.logo"
|
||||||
|
:label="item.label"
|
||||||
|
size="sm"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<div v-if="column.key === 'modified'" class="truncate text-base">
|
||||||
|
{{ item.timeAgo }}
|
||||||
|
</div>
|
||||||
|
</ListRowItem>
|
||||||
|
</ListRow>
|
||||||
|
</ListRows>
|
||||||
|
<ListSelectBanner />
|
||||||
|
</ListView>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
Avatar,
|
||||||
|
ListView,
|
||||||
|
ListHeader,
|
||||||
|
ListRows,
|
||||||
|
ListRow,
|
||||||
|
ListSelectBanner,
|
||||||
|
ListRowItem,
|
||||||
|
} from 'frappe-ui'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
rows: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
columns: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
selectable: true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@ -1,11 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-1 flex-col overflow-hidden">
|
<LayoutHeader v-if="organization">
|
||||||
<div class="flex gap-6 p-5">
|
<template #left-header>
|
||||||
<FileUploader
|
<Breadcrumbs :items="breadcrumbs" />
|
||||||
@success="changeOrganizationImage"
|
</template>
|
||||||
:validateFile="validateFile"
|
</LayoutHeader>
|
||||||
>
|
<div v-if="organization" class="flex flex-1 flex-col overflow-hidden">
|
||||||
<template #default="{ openFileSelector, error }">
|
<FileUploader
|
||||||
|
@success="changeOrganizationImage"
|
||||||
|
:validateFile="validateFile"
|
||||||
|
>
|
||||||
|
<template #default="{ openFileSelector, error }">
|
||||||
|
<div class="flex items-center justify-start gap-6 p-5">
|
||||||
<div class="group relative h-24 w-24">
|
<div class="group relative h-24 w-24">
|
||||||
<Avatar
|
<Avatar
|
||||||
size="3xl"
|
size="3xl"
|
||||||
@ -47,63 +52,90 @@
|
|||||||
<CameraIcon class="h-6 w-6 cursor-pointer text-white" />
|
<CameraIcon class="h-6 w-6 cursor-pointer text-white" />
|
||||||
</div>
|
</div>
|
||||||
</component>
|
</component>
|
||||||
<ErrorMessage class="mt-2" :message="error" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
<div class="flex flex-col justify-center gap-0.5">
|
||||||
</FileUploader>
|
<div class="text-3xl font-semibold text-gray-900">
|
||||||
<div class="flex flex-col justify-center gap-2">
|
{{ organization.name }}
|
||||||
<div class="text-3xl font-semibold text-gray-900">
|
</div>
|
||||||
{{ organization.name }}
|
<div class="flex items-center gap-2 text-base text-gray-700">
|
||||||
</div>
|
<div
|
||||||
<div class="flex items-center gap-2 text-base text-gray-700">
|
v-if="organization.website"
|
||||||
<div v-if="organization.website" class="flex items-center gap-1.5">
|
class="flex items-center gap-1.5"
|
||||||
<WebsiteIcon class="h-4 w-4" />
|
>
|
||||||
<span class="">{{ website(organization.website) }}</span>
|
<WebsiteIcon class="h-4 w-4" />
|
||||||
</div>
|
<span class="">{{ website(organization.website) }}</span>
|
||||||
<span
|
</div>
|
||||||
v-if="organization.industry && organization.website"
|
<span
|
||||||
class="text-3xl leading-[0] text-gray-600"
|
v-if="organization.industry && organization.website"
|
||||||
>
|
class="text-3xl leading-[0] text-gray-600"
|
||||||
·
|
>
|
||||||
</span>
|
·
|
||||||
<div v-if="organization.industry" class="flex items-center gap-1.5">
|
</span>
|
||||||
<FeatherIcon name="briefcase" class="h-4 w-4" />
|
<div
|
||||||
<span class="">{{ organization.industry }}</span>
|
v-if="organization.industry"
|
||||||
</div>
|
class="flex items-center gap-1.5"
|
||||||
<span
|
>
|
||||||
v-if="
|
<FeatherIcon name="briefcase" class="h-4 w-4" />
|
||||||
(organization.website || organization.industry) &&
|
<span class="">{{ organization.industry }}</span>
|
||||||
organization.annual_revenue
|
</div>
|
||||||
"
|
<span
|
||||||
class="text-3xl leading-[0] text-gray-600"
|
v-if="
|
||||||
>
|
(organization.website || organization.industry) &&
|
||||||
·
|
organization.annual_revenue
|
||||||
</span>
|
"
|
||||||
<div
|
class="text-3xl leading-[0] text-gray-600"
|
||||||
v-if="organization.annual_revenue"
|
>
|
||||||
class="flex items-center gap-1.5"
|
·
|
||||||
>
|
</span>
|
||||||
<FeatherIcon name="dollar-sign" class="h-4 w-4" />
|
<div
|
||||||
<span class="">{{ organization.annual_revenue }}</span>
|
v-if="organization.annual_revenue"
|
||||||
</div>
|
class="flex items-center gap-1.5"
|
||||||
</div>
|
>
|
||||||
<div class="mt-1 flex gap-2">
|
<FeatherIcon name="dollar-sign" class="h-4 w-4" />
|
||||||
<Button label="Edit" size="sm" @click="showOrganizationModal = true">
|
<span class="">{{ organization.annual_revenue }}</span>
|
||||||
<template #prefix>
|
</div>
|
||||||
<EditIcon class="h-4 w-4" />
|
<span
|
||||||
</template>
|
v-if="
|
||||||
</Button>
|
organization.website ||
|
||||||
<Button
|
organization.industry ||
|
||||||
label="Delete"
|
organization.annual_revenue
|
||||||
theme="red"
|
"
|
||||||
size="sm"
|
class="text-3xl leading-[0] text-gray-600"
|
||||||
@click="deleteOrganization"
|
>
|
||||||
>
|
·
|
||||||
<template #prefix>
|
</span>
|
||||||
<FeatherIcon name="trash-2" class="h-4 w-4" />
|
<Button
|
||||||
</template>
|
v-if="
|
||||||
</Button>
|
organization.website ||
|
||||||
<!-- <Button label="Add lead" size="sm">
|
organization.industry ||
|
||||||
|
organization.annual_revenue
|
||||||
|
"
|
||||||
|
variant="ghost"
|
||||||
|
label="More"
|
||||||
|
class="-ml-1 cursor-pointer hover:text-gray-900"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2 flex gap-1.5">
|
||||||
|
<Button
|
||||||
|
label="Edit"
|
||||||
|
size="sm"
|
||||||
|
@click="showOrganizationModal = true"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<EditIcon class="h-4 w-4" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
label="Delete"
|
||||||
|
theme="red"
|
||||||
|
size="sm"
|
||||||
|
@click="deleteOrganization"
|
||||||
|
>
|
||||||
|
<template #prefix>
|
||||||
|
<FeatherIcon name="trash-2" class="h-4 w-4" />
|
||||||
|
</template>
|
||||||
|
</Button>
|
||||||
|
<!-- <Button label="Add lead" size="sm">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<FeatherIcon name="plus" class="h-4 w-4" />
|
<FeatherIcon name="plus" class="h-4 w-4" />
|
||||||
</template>
|
</template>
|
||||||
@ -113,9 +145,12 @@
|
|||||||
<FeatherIcon name="plus" class="h-4 w-4" />
|
<FeatherIcon name="plus" class="h-4 w-4" />
|
||||||
</template>
|
</template>
|
||||||
</Button> -->
|
</Button> -->
|
||||||
|
</div>
|
||||||
|
<ErrorMessage class="mt-2" :message="error" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
</FileUploader>
|
||||||
<Tabs v-model="tabIndex" :tabs="tabs">
|
<Tabs v-model="tabIndex" :tabs="tabs">
|
||||||
<template #tab="{ tab, selected }">
|
<template #tab="{ tab, selected }">
|
||||||
<button
|
<button
|
||||||
@ -180,6 +215,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
|
Breadcrumbs,
|
||||||
FeatherIcon,
|
FeatherIcon,
|
||||||
Avatar,
|
Avatar,
|
||||||
FileUploader,
|
FileUploader,
|
||||||
@ -190,14 +226,13 @@ import {
|
|||||||
call,
|
call,
|
||||||
createListResource,
|
createListResource,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import LeadsListView from '@/components/ListViews/LeadsListView.vue'
|
import LeadsListView from '@/components/ListViews/LeadsListView.vue'
|
||||||
import DealsListView from '@/components/ListViews/DealsListView.vue'
|
import DealsListView from '@/components/ListViews/DealsListView.vue'
|
||||||
import ContactsListView from '@/components/ListViews/ContactsListView.vue'
|
import ContactsListView from '@/components/ListViews/ContactsListView.vue'
|
||||||
import WebsiteIcon from '@/components/Icons/WebsiteIcon.vue'
|
import WebsiteIcon from '@/components/Icons/WebsiteIcon.vue'
|
||||||
import EmailIcon from '@/components/Icons/EmailIcon.vue'
|
|
||||||
import EditIcon from '@/components/Icons/EditIcon.vue'
|
import EditIcon from '@/components/Icons/EditIcon.vue'
|
||||||
import PhoneIcon from '@/components/Icons/PhoneIcon.vue'
|
|
||||||
import CameraIcon from '@/components/Icons/CameraIcon.vue'
|
import CameraIcon from '@/components/Icons/CameraIcon.vue'
|
||||||
import LeadsIcon from '@/components/Icons/LeadsIcon.vue'
|
import LeadsIcon from '@/components/Icons/LeadsIcon.vue'
|
||||||
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
import DealsIcon from '@/components/Icons/DealsIcon.vue'
|
||||||
@ -212,18 +247,32 @@ import {
|
|||||||
formatNumberIntoCurrency,
|
formatNumberIntoCurrency,
|
||||||
} from '@/utils'
|
} from '@/utils'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { h, computed, ref, watch, onMounted } from 'vue'
|
import { h, computed, ref } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
organization: {
|
organizationId: {
|
||||||
type: Object,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const { organizations } = organizationsStore()
|
const { organizations, getOrganization } = organizationsStore()
|
||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
|
|
||||||
|
const organization = computed(() => getOrganization(props.organizationId))
|
||||||
|
|
||||||
|
const breadcrumbs = computed(() => {
|
||||||
|
let items = [{ label: 'Organizations', route: { name: 'Organizations' } }]
|
||||||
|
items.push({
|
||||||
|
label: props.organizationId,
|
||||||
|
route: {
|
||||||
|
name: 'Organization',
|
||||||
|
params: { organizationId: props.organizationId },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return items
|
||||||
|
})
|
||||||
|
|
||||||
function validateFile(file) {
|
function validateFile(file) {
|
||||||
let extn = file.name.split('.').pop().toLowerCase()
|
let extn = file.name.split('.').pop().toLowerCase()
|
||||||
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
|
if (!['png', 'jpg', 'jpeg'].includes(extn)) {
|
||||||
@ -234,7 +283,7 @@ function validateFile(file) {
|
|||||||
async function changeOrganizationImage(file) {
|
async function changeOrganizationImage(file) {
|
||||||
await call('frappe.client.set_value', {
|
await call('frappe.client.set_value', {
|
||||||
doctype: 'CRM Organization',
|
doctype: 'CRM Organization',
|
||||||
name: props.organization.name,
|
name: props.organizationId,
|
||||||
fieldname: 'organization_logo',
|
fieldname: 'organization_logo',
|
||||||
value: file?.file_url || '',
|
value: file?.file_url || '',
|
||||||
})
|
})
|
||||||
@ -253,7 +302,7 @@ async function deleteOrganization() {
|
|||||||
async onClick({ close }) {
|
async onClick({ close }) {
|
||||||
await call('frappe.client.delete', {
|
await call('frappe.client.delete', {
|
||||||
doctype: 'CRM Organization',
|
doctype: 'CRM Organization',
|
||||||
name: props.organization.name,
|
name: props.organizationId,
|
||||||
})
|
})
|
||||||
organizations.reload()
|
organizations.reload()
|
||||||
close()
|
close()
|
||||||
@ -291,7 +340,7 @@ const { getUser } = usersStore()
|
|||||||
const leads = createListResource({
|
const leads = createListResource({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
doctype: 'CRM Lead',
|
doctype: 'CRM Lead',
|
||||||
cache: ['leads', props.organization.name],
|
cache: ['leads', props.organizationId],
|
||||||
fields: [
|
fields: [
|
||||||
'name',
|
'name',
|
||||||
'first_name',
|
'first_name',
|
||||||
@ -305,7 +354,7 @@ const leads = createListResource({
|
|||||||
'modified',
|
'modified',
|
||||||
],
|
],
|
||||||
filters: {
|
filters: {
|
||||||
organization: props.organization.name,
|
organization: props.organizationId,
|
||||||
converted: 0,
|
converted: 0,
|
||||||
},
|
},
|
||||||
orderBy: 'modified desc',
|
orderBy: 'modified desc',
|
||||||
@ -316,7 +365,7 @@ const leads = createListResource({
|
|||||||
const deals = createListResource({
|
const deals = createListResource({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
doctype: 'CRM Deal',
|
doctype: 'CRM Deal',
|
||||||
cache: ['deals', props.organization.name],
|
cache: ['deals', props.organizationId],
|
||||||
fields: [
|
fields: [
|
||||||
'name',
|
'name',
|
||||||
'organization',
|
'organization',
|
||||||
@ -328,7 +377,7 @@ const deals = createListResource({
|
|||||||
'modified',
|
'modified',
|
||||||
],
|
],
|
||||||
filters: {
|
filters: {
|
||||||
organization: props.organization.name,
|
organization: props.organizationId,
|
||||||
},
|
},
|
||||||
orderBy: 'modified desc',
|
orderBy: 'modified desc',
|
||||||
pageLength: 20,
|
pageLength: 20,
|
||||||
@ -338,7 +387,7 @@ const deals = createListResource({
|
|||||||
const contacts = createListResource({
|
const contacts = createListResource({
|
||||||
type: 'list',
|
type: 'list',
|
||||||
doctype: 'Contact',
|
doctype: 'Contact',
|
||||||
cache: ['contacts', props.organization.name],
|
cache: ['contacts', props.organizationId],
|
||||||
fields: [
|
fields: [
|
||||||
'name',
|
'name',
|
||||||
'full_name',
|
'full_name',
|
||||||
@ -349,7 +398,7 @@ const contacts = createListResource({
|
|||||||
'modified',
|
'modified',
|
||||||
],
|
],
|
||||||
filters: {
|
filters: {
|
||||||
company_name: props.organization.name,
|
company_name: props.organizationId,
|
||||||
},
|
},
|
||||||
orderBy: 'modified desc',
|
orderBy: 'modified desc',
|
||||||
pageLength: 20,
|
pageLength: 20,
|
||||||
@ -566,11 +615,4 @@ function reload(val) {
|
|||||||
deals.reload()
|
deals.reload()
|
||||||
contacts.reload()
|
contacts.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.organization.name,
|
|
||||||
(val) => val && reload(val)
|
|
||||||
)
|
|
||||||
|
|
||||||
onMounted(() => reload(props.organization.name))
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -10,56 +10,34 @@
|
|||||||
@click="showOrganizationModal = true"
|
@click="showOrganizationModal = true"
|
||||||
>
|
>
|
||||||
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
|
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
|
||||||
Create organization
|
|
||||||
</Button>
|
</Button>
|
||||||
</template>
|
</template>
|
||||||
</LayoutHeader>
|
</LayoutHeader>
|
||||||
<div class="flex h-full overflow-hidden">
|
<div class="flex items-center justify-between px-5 pb-4 pt-3">
|
||||||
<div class="flex shrink-0 flex-col overflow-y-auto border-r">
|
<div class="flex items-center gap-2">
|
||||||
<router-link
|
<Dropdown :options="viewsDropdownOptions">
|
||||||
:to="{
|
<template #default="{ open }">
|
||||||
name: 'Organization',
|
<Button :label="currentView.label">
|
||||||
params: { organizationId: organization.name },
|
<template #prefix>
|
||||||
}"
|
<FeatherIcon :name="currentView.icon" class="h-4" />
|
||||||
v-for="(organization, i) in organizations.data"
|
</template>
|
||||||
:key="i"
|
<template #suffix>
|
||||||
:class="[
|
<FeatherIcon
|
||||||
currentOrganization?.name === organization.name
|
:name="open ? 'chevron-up' : 'chevron-down'"
|
||||||
? 'bg-gray-50 hover:bg-gray-100'
|
class="h-4 text-gray-600"
|
||||||
: 'hover:bg-gray-50',
|
/>
|
||||||
]"
|
</template>
|
||||||
>
|
</Button>
|
||||||
<div class="flex w-[352px] items-center gap-3 border-b px-5 py-4">
|
</template>
|
||||||
<Avatar
|
</Dropdown>
|
||||||
:image="organization.organization_logo"
|
|
||||||
:label="organization.name"
|
|
||||||
size="xl"
|
|
||||||
/>
|
|
||||||
<div class="flex flex-col items-start gap-1">
|
|
||||||
<span class="text-base font-medium text-gray-900">
|
|
||||||
{{ organization.name }}
|
|
||||||
</span>
|
|
||||||
<span class="text-sm text-gray-700">{{
|
|
||||||
website(organization.website)
|
|
||||||
}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</router-link>
|
|
||||||
</div>
|
</div>
|
||||||
<router-view
|
<div class="flex items-center gap-2">
|
||||||
v-if="currentOrganization"
|
<Filter doctype="CRM Organization" />
|
||||||
:organization="currentOrganization"
|
<SortBy doctype="CRM Organization" />
|
||||||
/>
|
<Button icon="more-horizontal" />
|
||||||
<div
|
|
||||||
v-else
|
|
||||||
class="grid h-full flex-1 place-items-center text-xl font-medium text-gray-500"
|
|
||||||
>
|
|
||||||
<div class="flex flex-col items-center justify-center space-y-2">
|
|
||||||
<OrganizationsIcon class="h-10 w-10" />
|
|
||||||
<div>No organization selected</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<OrganizationsListView :rows="rows" :columns="columns" />
|
||||||
<OrganizationModal
|
<OrganizationModal
|
||||||
v-model="showOrganizationModal"
|
v-model="showOrganizationModal"
|
||||||
v-model:reloadOrganizations="organizations"
|
v-model:reloadOrganizations="organizations"
|
||||||
@ -69,19 +47,26 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import LayoutHeader from '@/components/LayoutHeader.vue'
|
import LayoutHeader from '@/components/LayoutHeader.vue'
|
||||||
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
import OrganizationModal from '@/components/Modals/OrganizationModal.vue'
|
||||||
import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
|
import OrganizationsListView from '@/components/ListViews/OrganizationsListView.vue'
|
||||||
import { FeatherIcon, Breadcrumbs, Avatar } from 'frappe-ui'
|
import SortBy from '@/components/SortBy.vue'
|
||||||
|
import Filter from '@/components/Filter.vue'
|
||||||
|
import { FeatherIcon, Breadcrumbs, Dropdown } from 'frappe-ui'
|
||||||
import { organizationsStore } from '@/stores/organizations.js'
|
import { organizationsStore } from '@/stores/organizations.js'
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { dateFormat, dateTooltipFormat, timeAgo, formatNumberIntoCurrency } from '@/utils'
|
||||||
|
import { ref, computed } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
|
||||||
const { organizations } = organizationsStore()
|
const { organizations } = organizationsStore()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const showOrganizationModal = ref(false)
|
const showOrganizationModal = ref(false)
|
||||||
|
|
||||||
const currentOrganization = computed(() => {
|
const currentOrganization = computed(() => {
|
||||||
return organizations.data.find(
|
return organizations.data.find(
|
||||||
(organization) => organization.name === route.params.organizationId
|
(organization) => organization.name === route.params.organizationId
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const breadcrumbs = computed(() => {
|
const breadcrumbs = computed(() => {
|
||||||
let items = [{ label: 'Organizations', route: { name: 'Organizations' } }]
|
let items = [{ label: 'Organizations', route: { name: 'Organizations' } }]
|
||||||
if (!currentOrganization.value) return items
|
if (!currentOrganization.value) return items
|
||||||
@ -94,13 +79,102 @@ const breadcrumbs = computed(() => {
|
|||||||
})
|
})
|
||||||
return items
|
return items
|
||||||
})
|
})
|
||||||
onMounted(() => {
|
|
||||||
const el = document.querySelector('.router-link-active')
|
const currentView = ref({
|
||||||
if (el)
|
label: 'List',
|
||||||
setTimeout(() => {
|
icon: 'list',
|
||||||
el.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const viewsDropdownOptions = [
|
||||||
|
{
|
||||||
|
label: 'List',
|
||||||
|
icon: 'list',
|
||||||
|
onClick() {
|
||||||
|
currentView.value = {
|
||||||
|
label: 'List',
|
||||||
|
icon: 'list',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Table',
|
||||||
|
icon: 'grid',
|
||||||
|
onClick() {
|
||||||
|
currentView.value = {
|
||||||
|
label: 'Table',
|
||||||
|
icon: 'grid',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Calender',
|
||||||
|
icon: 'calendar',
|
||||||
|
onClick() {
|
||||||
|
currentView.value = {
|
||||||
|
label: 'Calender',
|
||||||
|
icon: 'calendar',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Board',
|
||||||
|
icon: 'columns',
|
||||||
|
onClick() {
|
||||||
|
currentView.value = {
|
||||||
|
label: 'Board',
|
||||||
|
icon: 'columns',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const rows = computed(() => {
|
||||||
|
return organizations.data.map((organization) => {
|
||||||
|
return {
|
||||||
|
name: organization.name,
|
||||||
|
organization: {
|
||||||
|
label: organization.organization_name,
|
||||||
|
logo: organization.organization_logo,
|
||||||
|
},
|
||||||
|
website: website(organization.website),
|
||||||
|
industry: organization.industry,
|
||||||
|
annual_revenue: formatNumberIntoCurrency(organization.annual_revenue),
|
||||||
|
modified: {
|
||||||
|
label: dateFormat(organization.modified, dateTooltipFormat),
|
||||||
|
timeAgo: timeAgo(organization.modified),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
label: 'Organization',
|
||||||
|
key: 'organization',
|
||||||
|
width: '16rem',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Website',
|
||||||
|
key: 'website',
|
||||||
|
width: '14rem',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Industry',
|
||||||
|
key: 'industry',
|
||||||
|
width: '14rem',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Annual Revenue',
|
||||||
|
key: 'annual_revenue',
|
||||||
|
width: '14rem',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Last modified',
|
||||||
|
key: 'modified',
|
||||||
|
width: '8rem',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
function website(url) {
|
function website(url) {
|
||||||
return url && url.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '')
|
return url && url.replace(/^(?:https?:\/\/)?(?:www\.)?/i, '')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,14 +49,12 @@ const routes = [
|
|||||||
path: '/organizations',
|
path: '/organizations',
|
||||||
name: 'Organizations',
|
name: 'Organizations',
|
||||||
component: () => import('@/pages/Organizations.vue'),
|
component: () => import('@/pages/Organizations.vue'),
|
||||||
children: [
|
},
|
||||||
{
|
{
|
||||||
path: '/organizations/:organizationId?',
|
path: '/organizations/:organizationId',
|
||||||
name: 'Organization',
|
name: 'Organization',
|
||||||
component: () => import('@/pages/Organization.vue'),
|
component: () => import('@/pages/Organization.vue'),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/call-logs',
|
path: '/call-logs',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user