1
0
forked from test/crm

fix: only show edit button to sales manager

This commit is contained in:
Shariq Ansari 2024-07-02 14:27:24 +05:30
parent 31e4f2cf93
commit 595e48ba35
6 changed files with 30 additions and 6 deletions

View File

@ -10,6 +10,7 @@
</div>
<div class="flex items-center gap-1">
<Button
v-if="isManager() || detailMode"
variant="ghost"
class="w-7"
@click="detailMode ? (detailMode = false) : openQuickEntryModal()"
@ -90,6 +91,7 @@ import AddressIcon from '@/components/Icons/AddressIcon.vue'
import CertificateIcon from '@/components/Icons/CertificateIcon.vue'
import EditIcon from '@/components/Icons/EditIcon.vue'
import Dropdown from '@/components/frappe-ui/Dropdown.vue'
import { usersStore } from '@/stores/users'
import { call, createResource } from 'frappe-ui'
import { ref, nextTick, watch, computed } from 'vue'
import { createToast } from '@/utils'
@ -110,6 +112,8 @@ const props = defineProps({
},
})
const { isManager } = usersStore()
const router = useRouter()
const show = defineModel()

View File

@ -9,7 +9,12 @@
</h3>
</div>
<div class="flex items-center gap-1">
<Button variant="ghost" class="w-7" @click="openQuickEntryModal">
<Button
v-if="isManager()"
variant="ghost"
class="w-7"
@click="openQuickEntryModal"
>
<EditIcon class="h-4 w-4" />
</Button>
<Button variant="ghost" class="w-7" @click="show = false">
@ -64,7 +69,7 @@ const props = defineProps({
defaults: Object,
})
const { getUser } = usersStore()
const { getUser, isManager } = usersStore()
const { getDealStatus, statusOptions } = statusesStore()
const show = defineModel()

View File

@ -9,7 +9,12 @@
</h3>
</div>
<div class="flex items-center gap-1">
<Button variant="ghost" class="w-7" @click="openQuickEntryModal">
<Button
v-if="isManager()"
variant="ghost"
class="w-7"
@click="openQuickEntryModal"
>
<EditIcon class="h-4 w-4" />
</Button>
<Button variant="ghost" class="w-7" @click="show = false">
@ -49,7 +54,7 @@ const props = defineProps({
defaults: Object,
})
const { getUser } = usersStore()
const { getUser, isManager } = usersStore()
const { getLeadStatus, statusOptions } = statusesStore()
const show = defineModel()

View File

@ -10,6 +10,7 @@
</div>
<div class="flex items-center gap-1">
<Button
v-if="isManager() || detailMode"
variant="ghost"
class="w-7"
@click="detailMode ? (detailMode = false) : openQuickEntryModal()"
@ -64,6 +65,7 @@ import MoneyIcon from '@/components/Icons/MoneyIcon.vue'
import WebsiteIcon from '@/components/Icons/WebsiteIcon.vue'
import OrganizationsIcon from '@/components/Icons/OrganizationsIcon.vue'
import TerritoryIcon from '@/components/Icons/TerritoryIcon.vue'
import { usersStore } from '@/stores/users'
import { formatNumberIntoCurrency } from '@/utils'
import { call, FeatherIcon, createResource } from 'frappe-ui'
import { ref, nextTick, watch, computed, h } from 'vue'
@ -80,6 +82,8 @@ const props = defineProps({
},
})
const { isManager } = usersStore()
const router = useRouter()
const show = defineModel()
const organization = defineModel('organization')

View File

@ -147,7 +147,9 @@
</Link>
</div>
<Button
v-else-if="(!section.contacts && i == 1) || i == 0"
v-else-if="
((!section.contacts && i == 1) || i == 0) && isManager()
"
variant="ghost"
class="w-7 mr-2"
@click="showSidePanelModal = true"
@ -336,6 +338,7 @@ import {
import { globalStore } from '@/stores/global'
import { organizationsStore } from '@/stores/organizations'
import { statusesStore } from '@/stores/statuses'
import { usersStore } from '@/stores/users'
import { whatsappEnabled, callEnabled } from '@/composables/settings'
import {
createResource,
@ -352,6 +355,7 @@ import { useRouter } from 'vue-router'
const { $dialog, makeCall } = globalStore()
const { organizations, getOrganization } = organizationsStore()
const { statusOptions, getDealStatus } = statusesStore()
const { isManager } = usersStore()
const router = useRouter()
const props = defineProps({

View File

@ -178,7 +178,7 @@
v-model="lead.data"
@update="updateField"
/>
<template v-if="i == 0" #actions>
<template v-if="i == 0 && isManager()" #actions>
<Button
variant="ghost"
class="w-7 mr-2"
@ -305,6 +305,7 @@ import { globalStore } from '@/stores/global'
import { contactsStore } from '@/stores/contacts'
import { organizationsStore } from '@/stores/organizations'
import { statusesStore } from '@/stores/statuses'
import { usersStore } from '@/stores/users'
import { whatsappEnabled, callEnabled } from '@/composables/settings'
import {
createResource,
@ -324,6 +325,7 @@ const { $dialog, makeCall } = globalStore()
const { getContactByName, contacts } = contactsStore()
const { organizations } = organizationsStore()
const { statusOptions, getLeadStatus } = statusesStore()
const { isManager } = usersStore()
const route = useRoute()
const router = useRouter()