diff --git a/i18n/en-US.json b/i18n/en-US.json index c3b7dac..0a68220 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -980,7 +980,10 @@ }, "__comment": "UI-1210: Display the Main Faxbox number on the dashboard", "__version": "3.22", - "faxingNumberLabel": "Faxbox Number" + "faxingNumberLabel": "Faxbox Number", + "__comment": "UI-1197: Display company directory on the dashboard", + "__version": "3.22", + "directoryLabel": "Company Directory Users:" }, "__comment": "UI-299, v3.19_s2: Added the Feature Codes tab to SmartPBX.", diff --git a/submodules/myOffice/myOffice.js b/submodules/myOffice/myOffice.js index cffd4b0..2851059 100644 --- a/submodules/myOffice/myOffice.js +++ b/submodules/myOffice/myOffice.js @@ -48,7 +48,9 @@ define(function(require){ devicesList: _.toArray(myOfficeData.devicesData).sort(function(a, b) { return b.count - a.count ; }), assignedNumbersList: _.toArray(myOfficeData.assignedNumbersData).sort(function(a, b) { return b.count - a.count ; }), // numberTypesList: _.toArray(myOfficeData.numberTypesData).sort(function(a, b) { return b.count - a.count ; }), - classifiedNumbers: myOfficeData.classifiedNumbers + classifiedNumbers: myOfficeData.classifiedNumbers, + directoryUsers: myOfficeData.directory && myOfficeData.directory.users.length || 0, + directoryLink: myOfficeData.directoryLink }, template = $(monster.template(self, 'myOffice-layout', dataTemplate)), chartOptions = { @@ -296,6 +298,39 @@ define(function(require){ parallelCallback && parallelCallback(null, data.data); } }); + }, + directory: function(parallelCallback) { + self.callApi({ + resource: 'directory.list', + data: { + accountId: self.accountId + }, + success: function(data, status) { + var mainDirectory = _.find(data.data, function(val) { + return val.name === 'SmartPBX Directory'; + }); + if(mainDirectory) { + self.callApi({ + resource: 'directory.get', + data: { + accountId: self.accountId, + directoryId: mainDirectory.id + }, + success: function(data, status) { + parallelCallback && parallelCallback(null, data.data); + }, + error: function(data, status) { + parallelCallback && parallelCallback(null, {}); + } + }); + } else { + parallelCallback && parallelCallback(null, {}); + } + }, + error: function(data, status) { + parallelCallback && parallelCallback(null, {}); + } + }); } }, function(error, results) { @@ -513,6 +548,10 @@ define(function(require){ // data.numberTypesData = numberTypes; data.totalConferences = totalConferences; + if(data.directory && data.directory.id) { + data.directoryLink = self.apiUrl + 'accounts/' + self.accountId +'/directories/' + data.directory.id + '?accept=pdf&auth_token=' + self.authToken; + } + return data; }, diff --git a/views/myOffice-layout.html b/views/myOffice-layout.html index f473862..ce297e5 100644 --- a/views/myOffice-layout.html +++ b/views/myOffice-layout.html @@ -198,14 +198,16 @@ +