fix: renamed invite members to invite agent

(cherry picked from commit 5c7f835e4c2d6400302c3466ab0b8c9d655bf274)
This commit is contained in:
Shariq Ansari 2025-05-21 15:40:37 +05:30 committed by Mergify
parent f7344cde43
commit dd4f5c6f80
5 changed files with 26 additions and 19 deletions

View File

@ -136,8 +136,8 @@ declare module 'vue' {
InboundCallIcon: typeof import('./src/components/Icons/InboundCallIcon.vue')['default'] InboundCallIcon: typeof import('./src/components/Icons/InboundCallIcon.vue')['default']
InboxIcon: typeof import('./src/components/Icons/InboxIcon.vue')['default'] InboxIcon: typeof import('./src/components/Icons/InboxIcon.vue')['default']
IndicatorIcon: typeof import('./src/components/Icons/IndicatorIcon.vue')['default'] IndicatorIcon: typeof import('./src/components/Icons/IndicatorIcon.vue')['default']
InviteAgentPage: typeof import('./src/components/Settings/InviteAgentPage.vue')['default']
InviteIcon: typeof import('./src/components/Icons/InviteIcon.vue')['default'] InviteIcon: typeof import('./src/components/Icons/InviteIcon.vue')['default']
InviteMemberPage: typeof import('./src/components/Settings/InviteMemberPage.vue')['default']
KanbanIcon: typeof import('./src/components/Icons/KanbanIcon.vue')['default'] KanbanIcon: typeof import('./src/components/Icons/KanbanIcon.vue')['default']
KanbanSettings: typeof import('./src/components/Kanban/KanbanSettings.vue')['default'] KanbanSettings: typeof import('./src/components/Kanban/KanbanSettings.vue')['default']
KanbanView: typeof import('./src/components/Kanban/KanbanView.vue')['default'] KanbanView: typeof import('./src/components/Kanban/KanbanView.vue')['default']

View File

@ -351,7 +351,7 @@ const steps = reactive([
onClick: () => { onClick: () => {
minimize.value = true minimize.value = true
showSettings.value = true showSettings.value = true
activeSettingsPage.value = 'Invite Members' activeSettingsPage.value = 'Invite Agent'
}, },
condition: () => isManager(), condition: () => isManager(),
}, },
@ -529,7 +529,7 @@ const articles = ref([
{ name: 'profile', title: __('Profile') }, { name: 'profile', title: __('Profile') },
{ name: 'custom-branding', title: __('Custom branding') }, { name: 'custom-branding', title: __('Custom branding') },
{ name: 'home-actions', title: __('Home actions') }, { name: 'home-actions', title: __('Home actions') },
{ name: 'invite-members', title: __('Invite members') }, { name: 'invite-agent', title: __('Invite agent') },
], ],
}, },
{ {

View File

@ -61,7 +61,7 @@
<Dropdown <Dropdown
:options="getDropdownOptions(agent)" :options="getDropdownOptions(agent)"
:button="{ :button="{
label: __(getUserRole(agent.name)), label: roleMap[getUserRole(agent.name)],
iconRight: 'chevron-down', iconRight: 'chevron-down',
variant: 'ghost', variant: 'ghost',
}" }"
@ -102,27 +102,32 @@ const agents = createListResource({
orderBy: 'creation desc', orderBy: 'creation desc',
}) })
function getDropdownOptions(user) { const roleMap = {
const agentRole = getUserRole(user.name) 'Sales Manager': __('Manager Access'),
'Sales User': __('Regular Access'),
}
function getDropdownOptions(agent) {
const agentRole = getUserRole(agent.name)
return [ return [
{ {
label: 'Sales Manager', label: __('Manager Access'),
component: (props) => component: (props) =>
RoleOption({ RoleOption({
role: 'Sales Manager', role: __('Manager Access'),
active: props.active, active: props.active,
selected: agentRole === 'Sales Manager', selected: agentRole === 'Sales Manager',
onClick: () => updateRole(user.name, 'Sales Manager'), onClick: () => updateRole(agent, 'Sales Manager'),
}), }),
}, },
{ {
label: 'Sales Agent', label: __('Regular Access'),
component: (props) => component: (props) =>
RoleOption({ RoleOption({
role: 'Sales Agent', role: __('Regular Access'),
active: props.active, active: props.active,
selected: agentRole === 'Sales User', selected: agentRole === 'Sales User',
onClick: () => updateRole(user.name, 'Sales User'), onClick: () => updateRole(agent, 'Sales User'),
}), }),
}, },
] ]
@ -151,14 +156,16 @@ function RoleOption({ active, role, onClick, selected }) {
} }
function updateRole(agent, newRole) { function updateRole(agent, newRole) {
const currentRole = getUserRole(agent) const currentRole = getUserRole(agent.name)
if (currentRole === newRole) return if (currentRole === newRole) return
call('crm.fcrm.doctype.crm_agent.crm_agent.update_agent_role', { call('crm.fcrm.doctype.crm_agent.crm_agent.update_agent_role', {
user: agent, user: agent.name,
new_role: newRole, new_role: newRole,
}).then(() => { }).then(() => {
toast.success(__('{0} role updated to {1}', [agent, newRole])) toast.success(
__('{0} has been granted {1}', [agent.agent_name, roleMap[newRole]]),
)
users.reload() users.reload()
agents.reload() agents.reload()
}) })

View File

@ -109,7 +109,7 @@ const error = ref(null)
const description = computed(() => { const description = computed(() => {
return { return {
'Sales Manager': 'Sales Manager':
'Can manage and invite new members, and create public & private views (reports).', 'Can manage and invite new agents, and create public & private views (reports).',
'Sales User': 'Sales User':
'Can work with leads and deals and create private views (reports).', 'Can work with leads and deals and create private views (reports).',
}[role.value] }[role.value]

View File

@ -48,7 +48,7 @@ import InviteIcon from '@/components/Icons/InviteIcon.vue'
import Email2Icon from '@/components/Icons/Email2Icon.vue' import Email2Icon from '@/components/Icons/Email2Icon.vue'
import Agents from '@/components/Settings/Agents.vue' import Agents from '@/components/Settings/Agents.vue'
import GeneralSettings from '@/components/Settings/GeneralSettings.vue' import GeneralSettings from '@/components/Settings/GeneralSettings.vue'
import InviteMemberPage from '@/components/Settings/InviteMemberPage.vue' import InviteAgentPage from '@/components/Settings/InviteAgentPage.vue'
import ProfileSettings from '@/components/Settings/ProfileSettings.vue' import ProfileSettings from '@/components/Settings/ProfileSettings.vue'
import WhatsAppSettings from '@/components/Settings/WhatsAppSettings.vue' import WhatsAppSettings from '@/components/Settings/WhatsAppSettings.vue'
import ERPNextSettings from '@/components/Settings/ERPNextSettings.vue' import ERPNextSettings from '@/components/Settings/ERPNextSettings.vue'
@ -96,9 +96,9 @@ const tabs = computed(() => {
condition: () => isManager(), condition: () => isManager(),
}, },
{ {
label: __('Invite Members'), label: __('Invite Agent'),
icon: InviteIcon, icon: InviteIcon,
component: markRaw(InviteMemberPage), component: markRaw(InviteAgentPage),
condition: () => isManager(), condition: () => isManager(),
}, },
{ {