From 42f5cf193fdcedf7673ca0f3b514f5d3eeed6769 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 28 Dec 2023 18:00:34 +0530 Subject: [PATCH] fix: added dialog in globalStore to use in script setup --- frontend/src/pages/Contact.vue | 3 +++ frontend/src/pages/Deal.vue | 2 ++ frontend/src/pages/Lead.vue | 2 ++ frontend/src/pages/Organization.vue | 2 ++ frontend/src/stores/global.js | 11 +++++++++++ 5 files changed, 20 insertions(+) create mode 100644 frontend/src/stores/global.js diff --git a/frontend/src/pages/Contact.vue b/frontend/src/pages/Contact.vue index 534d189f..b43e083e 100644 --- a/frontend/src/pages/Contact.vue +++ b/frontend/src/pages/Contact.vue @@ -229,6 +229,7 @@ import { timeAgo, formatNumberIntoCurrency, } from '@/utils' +import { globalStore } from '@/stores/global.js' import { usersStore } from '@/stores/users.js' import { contactsStore } from '@/stores/contacts.js' import { organizationsStore } from '@/stores/organizations.js' @@ -236,6 +237,8 @@ import { statusesStore } from '@/stores/statuses' import { ref, computed, h } from 'vue' import { useRouter } from 'vue-router' +const { $dialog } = globalStore() + const { getContactByName, contacts } = contactsStore() const { getUser } = usersStore() const { getOrganization } = organizationsStore() diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index 3a1602ff..439b7c1e 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -294,6 +294,7 @@ import { setupAssignees, setupCustomActions, } from '@/utils' +import { globalStore } from '@/stores/global' import { contactsStore } from '@/stores/contacts' import { organizationsStore } from '@/stores/organizations' import { statusesStore } from '@/stores/statuses' @@ -311,6 +312,7 @@ import { import { ref, computed, h } from 'vue' import { useRouter } from 'vue-router' +const { $dialog } = globalStore() const { getContactByName, contacts } = contactsStore() const { organizations, getOrganization } = organizationsStore() const { statusOptions, getDealStatus } = statusesStore() diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue index 819048cb..99675a69 100644 --- a/frontend/src/pages/Lead.vue +++ b/frontend/src/pages/Lead.vue @@ -200,6 +200,7 @@ import { setupAssignees, setupCustomActions, } from '@/utils' +import { globalStore } from '@/stores/global' import { contactsStore } from '@/stores/contacts' import { organizationsStore } from '@/stores/organizations' import { statusesStore } from '@/stores/statuses' @@ -218,6 +219,7 @@ import { import { ref, computed } from 'vue' import { useRouter } from 'vue-router' +const { $dialog } = globalStore() const { contacts } = contactsStore() const { organizations, getOrganization } = organizationsStore() const { statusOptions, getLeadStatus } = statusesStore() diff --git a/frontend/src/pages/Organization.vue b/frontend/src/pages/Organization.vue index bfd8a3a9..a9dd3208 100644 --- a/frontend/src/pages/Organization.vue +++ b/frontend/src/pages/Organization.vue @@ -248,6 +248,7 @@ import CameraIcon from '@/components/Icons/CameraIcon.vue' import LeadsIcon from '@/components/Icons/LeadsIcon.vue' import DealsIcon from '@/components/Icons/DealsIcon.vue' import ContactsIcon from '@/components/Icons/ContactsIcon.vue' +import { globalStore } from '@/stores/global' import { usersStore } from '@/stores/users' import { organizationsStore } from '@/stores/organizations.js' import { statusesStore } from '@/stores/statuses' @@ -267,6 +268,7 @@ const props = defineProps({ }, }) +const { $dialog } = globalStore() const { organizations, getOrganization } = organizationsStore() const { getLeadStatus, getDealStatus } = statusesStore() const showOrganizationModal = ref(false) diff --git a/frontend/src/stores/global.js b/frontend/src/stores/global.js new file mode 100644 index 00000000..65394d21 --- /dev/null +++ b/frontend/src/stores/global.js @@ -0,0 +1,11 @@ +import { defineStore } from 'pinia' +import { getCurrentInstance } from 'vue' + +export const globalStore = defineStore('crm-global', () => { + const app = getCurrentInstance() + const { $dialog } = app.appContext.config.globalProperties + + return { + $dialog, + } +})