fix: renamed invite members to invite agent

This commit is contained in:
Shariq Ansari 2025-05-21 15:40:37 +05:30
parent 346849631e
commit 5c7f835e4c
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']
InboxIcon: typeof import('./src/components/Icons/InboxIcon.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']
InviteMemberPage: typeof import('./src/components/Settings/InviteMemberPage.vue')['default']
KanbanIcon: typeof import('./src/components/Icons/KanbanIcon.vue')['default']
KanbanSettings: typeof import('./src/components/Kanban/KanbanSettings.vue')['default']
KanbanView: typeof import('./src/components/Kanban/KanbanView.vue')['default']

View File

@ -351,7 +351,7 @@ const steps = reactive([
onClick: () => {
minimize.value = true
showSettings.value = true
activeSettingsPage.value = 'Invite Members'
activeSettingsPage.value = 'Invite Agent'
},
condition: () => isManager(),
},
@ -529,7 +529,7 @@ const articles = ref([
{ name: 'profile', title: __('Profile') },
{ name: 'custom-branding', title: __('Custom branding') },
{ 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
:options="getDropdownOptions(agent)"
:button="{
label: __(getUserRole(agent.name)),
label: roleMap[getUserRole(agent.name)],
iconRight: 'chevron-down',
variant: 'ghost',
}"
@ -102,27 +102,32 @@ const agents = createListResource({
orderBy: 'creation desc',
})
function getDropdownOptions(user) {
const agentRole = getUserRole(user.name)
const roleMap = {
'Sales Manager': __('Manager Access'),
'Sales User': __('Regular Access'),
}
function getDropdownOptions(agent) {
const agentRole = getUserRole(agent.name)
return [
{
label: 'Sales Manager',
label: __('Manager Access'),
component: (props) =>
RoleOption({
role: 'Sales Manager',
role: __('Manager Access'),
active: props.active,
selected: agentRole === 'Sales Manager',
onClick: () => updateRole(user.name, 'Sales Manager'),
onClick: () => updateRole(agent, 'Sales Manager'),
}),
},
{
label: 'Sales Agent',
label: __('Regular Access'),
component: (props) =>
RoleOption({
role: 'Sales Agent',
role: __('Regular Access'),
active: props.active,
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) {
const currentRole = getUserRole(agent)
const currentRole = getUserRole(agent.name)
if (currentRole === newRole) return
call('crm.fcrm.doctype.crm_agent.crm_agent.update_agent_role', {
user: agent,
user: agent.name,
new_role: newRole,
}).then(() => {
toast.success(__('{0} role updated to {1}', [agent, newRole]))
toast.success(
__('{0} has been granted {1}', [agent.agent_name, roleMap[newRole]]),
)
users.reload()
agents.reload()
})

View File

@ -109,7 +109,7 @@ const error = ref(null)
const description = computed(() => {
return {
'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':
'Can work with leads and deals and create private views (reports).',
}[role.value]

View File

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