diff --git a/i18n/en-US.json b/i18n/en-US.json index 372d2cf..fdf8f93 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -88,7 +88,9 @@ "mainMenu": "Main Menu (Open hours)", "voicemails": "Voicemail Boxes", "users": "Users" - } + }, + "__comment": "UI-819, v3.19_s1: Showing an error popup when group data is outdated.", + "outdatedGroupsError": "Your User Groups data is outdated and can not be rendered. Please contact your administrator to update your data." }, "devices": { diff --git a/i18n/fr-FR.json b/i18n/fr-FR.json index f76c5e8..a102a41 100644 --- a/i18n/fr-FR.json +++ b/i18n/fr-FR.json @@ -88,7 +88,9 @@ "mainMenu": "Menu principal", "voicemails": "Répondeurs", "users": "Utilisateurs" - } + }, + "__comment": "UI-819, v3.19_s1: Showing an error popup when group data is outdated.", + "outdatedGroupsError": "Les données de vos Groupes sont obsolètes et ne peuvent être affichées. Veuillez contacter votre administrateur afin de mettre à jour vos données." }, "devices": { diff --git a/submodules/groups/groups.js b/submodules/groups/groups.js index a28fadc..5abb9fe 100644 --- a/submodules/groups/groups.js +++ b/submodules/groups/groups.js @@ -26,38 +26,46 @@ define(function(require){ self.groupsRemoveOverlay(); self.groupsGetData(function(data) { - var dataTemplate = self.groupsFormatListData(data), - template = $(monster.template(self, 'groups-layout', { countGroups: Object.keys(dataTemplate.groups).length })), - templateGroup; + var hasOldData = _.find(data.callflows, function(callflow) { + return !callflow.hasOwnProperty('type'); + }); - _.each(dataTemplate.groups, function(group) { - templateGroup = monster.template(self, 'groups-row', group); + if(hasOldData) { + monster.ui.alert('error', self.i18n.active().groups.outdatedGroupsError); + } else { + var dataTemplate = self.groupsFormatListData(data), + template = $(monster.template(self, 'groups-layout', { countGroups: Object.keys(dataTemplate.groups).length })), + templateGroup; - template.find('.groups-rows').append(templateGroup); - }); + _.each(dataTemplate.groups, function(group) { + templateGroup = monster.template(self, 'groups-row', group); - self.groupsBindEvents(template, parent); + template.find('.groups-rows').append(templateGroup); + }); - parent - .empty() - .append(template); + self.groupsBindEvents(template, parent); - if(_groupId) { - var cells = parent.find('.grid-row[data-id=' + _groupId + '] .grid-cell'); + parent + .empty() + .append(template); - monster.ui.fade(cells); - } + if(_groupId) { + var cells = parent.find('.grid-row[data-id=' + _groupId + '] .grid-cell'); - for (var group in dataTemplate.groups) { - noGroup = ( typeof dataTemplate.groups[group] === 'undefined' ) ? true : false; - } + monster.ui.fade(cells); + } - if ( noGroup ) { - parent.find('.grid-row.title').css('display', 'none'); - parent.find('.no-groups-row').css('display', 'block'); - } else { - parent.find('.grid-row.title').css('display', 'block'); - parent.find('.no-groups-row').css('display', 'none'); + for (var group in dataTemplate.groups) { + noGroup = ( typeof dataTemplate.groups[group] === 'undefined' ) ? true : false; + } + + if ( noGroup ) { + parent.find('.grid-row.title').css('display', 'none'); + parent.find('.no-groups-row').css('display', 'block'); + } else { + parent.find('.grid-row.title').css('display', 'block'); + parent.find('.no-groups-row').css('display', 'none'); + } } }); },