Skip to content

Commit

Permalink
portal/users: add section Voicemails
Browse files Browse the repository at this point in the history
  • Loading branch information
R0MANDEV committed Apr 3, 2024
1 parent 9074205 commit 2ebaa52
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 28 deletions.
27 changes: 27 additions & 0 deletions web/portal/user/src/entities/Voicemail/Form.tsx
Original file line number Diff line number Diff line change
@@ -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<FieldsetGroups> = [
{
legend: _('Basic Configuration'),
fields: ['enabled', 'name'],
},
{
legend: _('Notification configuration'),
fields: ['sendMail', 'email', 'attachSound'],
},
{
legend: _('Customization'),
fields: ['locution'],
},
];

return <DefaultEntityForm {...props} groups={groups} />;
};

export default Form;
109 changes: 97 additions & 12 deletions web/portal/user/src/entities/Voicemail/Voicemail.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<DeleteRowButton
disabled={true}
row={row}
entityService={entityService}
/>
);
}
}

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<string>) => `${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;
21 changes: 21 additions & 0 deletions web/portal/user/src/entities/Voicemail/VoicemailProperties.tsx
Original file line number Diff line number Diff line change
@@ -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<T> = {
id?: T;
enabled?: T;
user?: T;
name?: T;
email?: T;
sendMail?: T;
attachSound?: T;
voicemail?: T;
};

export type VoicemailProperties = VoicemailPropertyList<Partial<PropertySpec>>;
export type VoicemailPropertiesList = Array<
VoicemailPropertyList<EntityValue | EntityValues>
>;
14 changes: 10 additions & 4 deletions web/portal/user/src/router/EntityMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ const getEntityMap = (): RouteMap => {
{
entity: entities.CallForwardSetting,
},
{
entity: entities.Voicemail,
children: [
{
entity: entities.VoicemailMessage,
filterBy: 'voicemail',
},
],
divider: true,
},
{
entity: {
...entities.UsersCdr,
Expand All @@ -26,10 +36,6 @@ const getEntityMap = (): RouteMap => {
detail: false,
},
},
divider: true,
},
{
entity: entities.VoicemailMessage,
},
];

Expand Down
15 changes: 11 additions & 4 deletions web/portal/user/src/translations/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -22,6 +23,7 @@
"Country_many": "Països",
"Country_one": "País",
"Country_other": "Països",
"Customization": "Personalitzat",
"Date": "Data",
"Direction": "Direcció",
"Disposition": "Disposició",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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 <br />Ivoz Provider vPBX user portal": "Benvingut a <br /> Portal d'usuari del proveïdor d'Ivoz VPBX"
"Welcome to <br />Ivoz Provider vPBX user portal": "Benvingut a <br /> Portal d'usuari del proveïdor d'Ivoz VPBX",
"Yes": ""
}
9 changes: 8 additions & 1 deletion web/portal/user/src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -18,6 +19,7 @@
"Change Password": "Change Password",
"Country_one": "Country",
"Country_other": "Countries",
"Customization": "Customization",
"Date": "Date",
"Direction": "Direction",
"Disposition": "Disposition",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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 <br />Ivoz Provider vPBX user portal": "Bienvenido al <br />Portal de usuario de IvozProvider"
"Welcome to <br />Ivoz Provider vPBX user portal": "Bienvenido al <br />Portal de usuario de IvozProvider",
"Yes": "Yes"
}
11 changes: 9 additions & 2 deletions web/portal/user/src/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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 <br />Ivoz Provider vPBX user portal": "Bienvenido al <br /> Portal de usuario de Ivoz Provider"
"Welcome to <br />Ivoz Provider vPBX user portal": "Bienvenido al <br /> Portal de usuario de Ivoz Provider",
"Yes": ""
}
17 changes: 12 additions & 5 deletions web/portal/user/src/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -22,6 +23,7 @@
"Country_many": "Paesi",
"Country_one": "Paese",
"Country_other": "Paesi",
"Customization": "Personalizzato",
"Date": "Data",
"Direction": "Direzione",
"Disposition": "Disposizione",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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 <br />Ivoz Provider vPBX user portal": "Benvenuto nel portale utente Ivoz Provider vPBX"
"Welcome to <br />Ivoz Provider vPBX user portal": "Benvenuto nel portale utente Ivoz Provider vPBX",
"Yes": ""
}

0 comments on commit 2ebaa52

Please sign in to comment.