diff --git a/web/portal/user/src/entities/Voicemail/Form.tsx b/web/portal/user/src/entities/Voicemail/Form.tsx new file mode 100644 index 00000000000..f2b515a567d --- /dev/null +++ b/web/portal/user/src/entities/Voicemail/Form.tsx @@ -0,0 +1,27 @@ +import { + EntityFormProps, + FieldsetGroups, + Form as DefaultEntityForm, +} from '@irontec/ivoz-ui/entities/DefaultEntityBehavior'; +import _ from '@irontec/ivoz-ui/services/translations/translate'; + +const Form = (props: EntityFormProps): JSX.Element => { + const groups: Array = [ + { + legend: _('Basic Configuration'), + fields: ['enabled', 'name'], + }, + { + legend: _('Notification configuration'), + fields: ['sendMail', 'email', 'attachSound'], + }, + { + legend: _('Customization'), + fields: ['locution'], + }, + ]; + + return ; +}; + +export default Form; diff --git a/web/portal/user/src/entities/Voicemail/Voicemail.tsx b/web/portal/user/src/entities/Voicemail/Voicemail.tsx index be21ac6be29..0be451bc171 100644 --- a/web/portal/user/src/entities/Voicemail/Voicemail.tsx +++ b/web/portal/user/src/entities/Voicemail/Voicemail.tsx @@ -1,25 +1,110 @@ -import { EntityValues } from '@irontec/ivoz-ui'; -import defaultEntityBehavior from '@irontec/ivoz-ui/entities/DefaultEntityBehavior'; -import EntityInterface from '@irontec/ivoz-ui/entities/EntityInterface'; +import { isEntityItem } from '@irontec/ivoz-ui'; +import DeleteRowButton from '@irontec/ivoz-ui/components/List/Content/CTA/DeleteRowButton'; +import defaultEntityBehavior, { + ChildDecorator as DefaultChildDecorator, +} from '@irontec/ivoz-ui/entities/DefaultEntityBehavior'; +import EntityInterface, { + ChildDecoratorType, +} from '@irontec/ivoz-ui/entities/EntityInterface'; import _ from '@irontec/ivoz-ui/services/translations/translate'; -import AccountTreeIcon from '@mui/icons-material/AccountTree'; +import MailIcon from '@mui/icons-material/Mail'; -const VoiceMail: EntityInterface = { +import { + VoicemailProperties, + VoicemailPropertyList, +} from './VoicemailProperties'; + +const properties: VoicemailProperties = { + enabled: { + label: _('Enabled'), + enum: { + '0': _('No'), + '1': _('Yes'), + }, + default: '1', + }, + name: { + label: _('Name'), + required: true, + }, + sendMail: { + label: _('Voicemail send mail'), + enum: { + '0': _('No'), + '1': _('Yes'), + }, + default: '1', + visualToggle: { + '0': { + show: [], + hide: ['attachSound', 'email'], + }, + '1': { + show: ['attachSound', 'email'], + hide: [], + }, + }, + }, + email: { + label: _('Email'), + required: true, + }, + attachSound: { + label: _('Voicemail attach sound'), + enum: { + '0': _('No'), + '1': _('Yes'), + }, + default: '1', + }, +}; + +const columns = ['enabled', 'name', 'email']; + +export const ChildDecorator: ChildDecoratorType = (props) => { + const { routeMapItem, row, entityService } = props; + + if ( + isEntityItem(routeMapItem) && + routeMapItem.entity.iden === voicemail.iden + ) { + const isDeletePath = routeMapItem.route === `${voicemail.path}/:id`; + + if (isDeletePath) { + return ( + + ); + } + } + + return DefaultChildDecorator(props); +}; + +const voicemail: EntityInterface = { ...defaultEntityBehavior, - icon: AccountTreeIcon, + icon: MailIcon, iden: 'Voicemail', title: _('Voicemail', { count: 2 }), - path: '/my/company_voicemails', + path: '/my/voicemails', + acl: { ...defaultEntityBehavior.acl, - iden: 'Voicemail', + iden: 'Voicemails', }, - selectOptions: async () => { - const module = await import('./SelectOptions'); + toStr: (row: VoicemailPropertyList) => `${row.name as string}`, + properties, + columns, + defaultOrderBy: '', + ChildDecorator, + Form: async () => { + const module = await import('./Form'); return module.default; }, - toStr: (row: EntityValues) => row.name as string, }; -export default VoiceMail; +export default voicemail; diff --git a/web/portal/user/src/entities/Voicemail/VoicemailProperties.tsx b/web/portal/user/src/entities/Voicemail/VoicemailProperties.tsx new file mode 100644 index 00000000000..dd297c9e7b2 --- /dev/null +++ b/web/portal/user/src/entities/Voicemail/VoicemailProperties.tsx @@ -0,0 +1,21 @@ +import { PropertySpec } from '@irontec/ivoz-ui/services/api/ParsedApiSpecInterface'; +import { + EntityValue, + EntityValues, +} from '@irontec/ivoz-ui/services/entity/EntityService'; + +export type VoicemailPropertyList = { + id?: T; + enabled?: T; + user?: T; + name?: T; + email?: T; + sendMail?: T; + attachSound?: T; + voicemail?: T; +}; + +export type VoicemailProperties = VoicemailPropertyList>; +export type VoicemailPropertiesList = Array< + VoicemailPropertyList +>; diff --git a/web/portal/user/src/router/EntityMap.tsx b/web/portal/user/src/router/EntityMap.tsx index 502021ec860..41d89351f73 100644 --- a/web/portal/user/src/router/EntityMap.tsx +++ b/web/portal/user/src/router/EntityMap.tsx @@ -18,6 +18,16 @@ const getEntityMap = (): RouteMap => { { entity: entities.CallForwardSetting, }, + { + entity: entities.Voicemail, + children: [ + { + entity: entities.VoicemailMessage, + filterBy: 'voicemail', + }, + ], + divider: true, + }, { entity: { ...entities.UsersCdr, @@ -26,10 +36,6 @@ const getEntityMap = (): RouteMap => { detail: false, }, }, - divider: true, - }, - { - entity: entities.VoicemailMessage, }, ]; diff --git a/web/portal/user/src/translations/ca.json b/web/portal/user/src/translations/ca.json index 371e4a35b66..4bf6ca5917c 100644 --- a/web/portal/user/src/translations/ca.json +++ b/web/portal/user/src/translations/ca.json @@ -4,6 +4,7 @@ "Active call_other": "Trucades actives", "Answered": "Contestada", "Basic Information": "Informació bàsica", + "Basic Configuration": "Configuració bàsica", "Boss / Assistant": "Assistent vinculat", "Both": "Ambdós", "Busy": "Ocupat", @@ -22,6 +23,7 @@ "Country_many": "Països", "Country_one": "País", "Country_other": "Països", + "Customization": "Personalitzat", "Date": "Data", "Direction": "Direcció", "Disposition": "Disposició", @@ -56,8 +58,10 @@ "My Account": "El meu compte", "My Preferences": "Els meus ajustaments", "Name": "Nom", + "No": "No", "No answer": "No resposta", "No answer timeout": "Sense temps d'espera de resposta", + "Notification configuration": "Configuració de la notificació", "Number": "Número", "Number country": "País", "Number value": "Valor", @@ -73,9 +77,9 @@ "Profile_many": "Perfiles", "Profile_one": "Perfil", "Profile_other": "Perfiles", - "Recording_many": "Recordings", - "Recording_one": "Recording", - "Recording_other": "Recordings", + "Recording_many": "Enregistraments", + "Recording_one": "Gravació", + "Recording_other": "Enregistraments", "Repeat password": "Repeteix contrasenya", "Start Time": "Hora inicio", "Status": "Estat", @@ -93,8 +97,11 @@ "Voicemail Message_many": "Missatges de bústia de veu", "Voicemail Message_one": "Missatge de bústia de veu", "Voicemail Message_other": "Missatges de bústia de veu", + "Voicemail attach sound": "Adjunta àudio bústia de veu", + "Voicemail send mail": "Envia notificació per correu de la bústia de veu", "Voicemail_many": "Bústies de veu", "Voicemail_one": "Bústia de veu", "Voicemail_other": "Bústies de veu", - "Welcome to
Ivoz Provider vPBX user portal": "Benvingut a
Portal d'usuari del proveïdor d'Ivoz VPBX" + "Welcome to
Ivoz Provider vPBX user portal": "Benvingut a
Portal d'usuari del proveïdor d'Ivoz VPBX", + "Yes": "Sí" } diff --git a/web/portal/user/src/translations/en.json b/web/portal/user/src/translations/en.json index db5adbe3438..522459db37f 100644 --- a/web/portal/user/src/translations/en.json +++ b/web/portal/user/src/translations/en.json @@ -3,6 +3,7 @@ "Active call_other": "Active Calls", "Answered": "Answered", "Basic Information": "Basic Information", + "Basic Configuration": "Basic Configuration", "Boss / Assistant": "Boss / Assistant", "Both": "Both", "Busy": "Busy", @@ -18,6 +19,7 @@ "Change Password": "Change Password", "Country_one": "Country", "Country_other": "Countries", + "Customization": "Customization", "Date": "Date", "Direction": "Direction", "Disposition": "Disposition", @@ -50,8 +52,10 @@ "My Account": "My Account", "My Preferences": "My Preferences", "Name": "Name", + "No": "No", "No answer": "No answer", "No answer timeout": "No answer timeout", + "Notification configuration": "Notification configuration", "Number": "Number", "Number country": "Number country", "Number value": "Number value", @@ -82,7 +86,10 @@ "User not registered": "User not registered", "Voicemail Message_one": "Voicemail Message", "Voicemail Message_other": "Voicemail Messages", + "Voicemail attach sound": "Voicemail attach sound", + "Voicemail send mail": "Voicemail send mail", "Voicemail_one": "Voicemail", "Voicemail_other": "Voicemails", - "Welcome to
Ivoz Provider vPBX user portal": "Bienvenido al
Portal de usuario de IvozProvider" + "Welcome to
Ivoz Provider vPBX user portal": "Bienvenido al
Portal de usuario de IvozProvider", + "Yes": "Yes" } diff --git a/web/portal/user/src/translations/es.json b/web/portal/user/src/translations/es.json index 1839a492b9a..d359c742ebf 100644 --- a/web/portal/user/src/translations/es.json +++ b/web/portal/user/src/translations/es.json @@ -4,6 +4,7 @@ "Active call_other": "Llamada activa", "Answered": "Establecida", "Basic Information": "Información Básica", + "Basic Configuration": "Configuración Básica", "Boss / Assistant": "Jefe / Asistente", "Both": "Ambos", "Busy": "Ocupado", @@ -22,6 +23,7 @@ "Country_many": "Países", "Country_one": "País", "Country_other": "Países", + "Customization": "Customizaciones", "Date": "Fecha", "Direction": "Dirección", "Disposition": "Disposición", @@ -56,8 +58,10 @@ "My Account": "Mi cuenta", "My Preferences": "Mis preferencias", "Name": "Nombre", + "No": "No", "No answer": "No contesta", "No answer timeout": "Timeout no contesta", + "Notification configuration": "Configuración de notificaciones", "Number": "Número", "Number country": "País", "Number value": "Número", @@ -93,8 +97,11 @@ "Voicemail Message_many": "Mensajes de Buzón de voz", "Voicemail Message_one": "Mensaje de Buzón de voz", "Voicemail Message_other": "Mensajes de Buzón de voz", + "Voicemail attach sound": "Adjuntar audio del mensaje", + "Voicemail send mail": "Notificar por email", "Voicemail_many": "Buzones de voz", - "Voicemail_one": "Buzones de voz", + "Voicemail_one": "Buzón de voz", "Voicemail_other": "Buzones de voz", - "Welcome to
Ivoz Provider vPBX user portal": "Bienvenido al
Portal de usuario de Ivoz Provider" + "Welcome to
Ivoz Provider vPBX user portal": "Bienvenido al
Portal de usuario de Ivoz Provider", + "Yes": "Sí" } diff --git a/web/portal/user/src/translations/it.json b/web/portal/user/src/translations/it.json index 2d3e5176429..01ff57b7907 100644 --- a/web/portal/user/src/translations/it.json +++ b/web/portal/user/src/translations/it.json @@ -3,7 +3,8 @@ "Active call_one": "Chiamata attiva (uno)", "Active call_other": "Chiamate attive (altro)", "Answered": "Risposto", - "Basic Information": "Basic Información", + "Basic Information": "Basic Information", + "Basic Configuration": "Configurazione di base", "Boss / Assistant": "Assigned asistant", "Both": "Entrambi", "Busy": "Occupato", @@ -22,6 +23,7 @@ "Country_many": "Paesi", "Country_one": "Paese", "Country_other": "Paesi", + "Customization": "Personalizzato", "Date": "Data", "Direction": "Direzione", "Disposition": "Disposizione", @@ -56,8 +58,10 @@ "My Account": "My Account", "My Preferences": "My Preferences", "Name": "Nome", + "No": "No", "No answer": "No answer", "No answer timeout": "Timeout Senza Risposta", + "Notification configuration": "Configurazione delle notifiche", "Number": "Numero", "Number country": "Number country", "Number value": "Number value", @@ -73,9 +77,9 @@ "Profile_many": "Profile", "Profile_one": "Profile", "Profile_other": "Profiles", - "Recording_many": "Directorio", - "Recording_one": "Directorio", - "Recording_other": "Directorio", + "Recording_many": "registrazioni", + "Recording_one": "registrazione", + "Recording_other": "registrazioni", "Repeat password": "Repeat password", "Start Time": "Start Time", "Status": "Status", @@ -93,8 +97,11 @@ "Voicemail Message_many": "Voicemail Messages", "Voicemail Message_one": "Voicemail Message", "Voicemail Message_other": "Voicemail Messages", + "Voicemail attach sound": "Suono collegata alla Voicemail", + "Voicemail send mail": "Voicemail invia posta", "Voicemail_many": "Voicemails", "Voicemail_one": "Voicemail", "Voicemail_other": "Voicemails", - "Welcome to
Ivoz Provider vPBX user portal": "Benvenuto nel portale utente Ivoz Provider vPBX" + "Welcome to
Ivoz Provider vPBX user portal": "Benvenuto nel portale utente Ivoz Provider vPBX", + "Yes": "Sí" }