diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index c4627bde6..e57ac97c4 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -529,6 +529,11 @@ "INBOX_AGENTS_SUB_TEXT": "Add or remove agents from this inbox", "AGENT_ASSIGNMENT": "Conversation Assignment", "AGENT_ASSIGNMENT_SUB_TEXT": "Update conversation assignment settings", + "VOICE_CALL_ROUTING": "Call Routing", + "VOICE_CALL_ROUTING_SUB_TEXT": "Configure how calls are handled when agents are unavailable", + "PERSONAL_PHONE_ROUTING": "Enable routing to personal phone", + "PERSONAL_PHONE_ROUTING_SUB_TEXT": "When an agent is not online in Chatwoot, route incoming calls to their personal phone number", + "AGENT_PHONE_SETTINGS_INFO": "Each agent can configure their personal phone number in their profile settings page", "UPDATE": "Update", "ENABLE_EMAIL_COLLECT_BOX": "Enable email collect box", "ENABLE_EMAIL_COLLECT_BOX_SUB_TEXT": "Enable or disable email collect box on new conversation", diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CollaboratorsPage.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CollaboratorsPage.vue index 8f72894c2..d94ee82bf 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CollaboratorsPage.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/settingsPage/CollaboratorsPage.vue @@ -29,6 +29,8 @@ export default { isAgentListUpdating: false, enableAutoAssignment: false, maxAssignmentLimit: null, + enablePersonalPhoneRouting: false, + isVoiceRoutingUpdating: false, }; }, computed: { @@ -57,6 +59,8 @@ export default { this.enableAutoAssignment = this.inbox.enable_auto_assignment; this.maxAssignmentLimit = this.inbox?.auto_assignment_config?.max_assignment_limit || null; + // Set the default for voice routing if available + this.enablePersonalPhoneRouting = this.inbox?.provider_config?.enable_personal_phone_routing || false; this.fetchAttachedAgents(); }, async fetchAttachedAgents() { @@ -105,6 +109,32 @@ export default { useAlert(this.$t('INBOX_MGMT.EDIT.API.SUCCESS_MESSAGE')); } }, + + async updateVoiceRouting() { + this.isVoiceRoutingUpdating = true; + try { + // In a real implementation, this would update the voice routing settings + // For now, just simulate API call success + await new Promise(resolve => setTimeout(resolve, 500)); + + // Here's how a real implementation might look: + // const payload = { + // id: this.inbox.id, + // formData: false, + // provider_config: { + // ...this.inbox.provider_config, + // enable_personal_phone_routing: this.enablePersonalPhoneRouting, + // }, + // }; + // await this.$store.dispatch('inboxes/updateInbox', payload); + + useAlert(this.$t('INBOX_MGMT.EDIT.API.SUCCESS_MESSAGE')); + } catch (error) { + useAlert(this.$t('INBOX_MGMT.EDIT.API.ERROR_MESSAGE')); + } finally { + this.isVoiceRoutingUpdating = false; + } + }, }, validations: { selectedAgents: { @@ -194,6 +224,41 @@ export default { /> + + + + +
+

+ {{ $t('INBOX_MGMT.SETTINGS_POPUP.AGENT_PHONE_SETTINGS_INFO') }} +

+ + +
+
@@ -205,4 +270,9 @@ export default { padding-top: var(--space-slab); padding-bottom: var(--space-slab); } + +.agent-phone-container { + padding-top: var(--space-slab); + padding-bottom: var(--space-slab); +}