diff --git a/i18n/en-US.json b/i18n/en-US.json index dd26527..f7aa068 100644 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -908,7 +908,8 @@ "__version": "3.22", "faxing": { "nameExtension": "'s Main Faxbox", - "headerExtension": " Fax Printer" + "headerExtension": " Fax Printer", + "editFaxbox": "Edit Faxbox" }, "__comment": "UI-1774: Adding custom greetings to conference", "__version": "3.22", @@ -922,7 +923,20 @@ "__comment": "UI-2499: Handle case where greeting has been deleted", "__version": "4.0", - "greetingMissing": "The greeting that was configured on this Virtual Receptionist is missing. Please setup a new greeting." + "greetingMissing": "The greeting that was configured on this Virtual Receptionist is missing. Please setup a new greeting.", + + "__comment": "", + "__version": "3.22", + "popupEditFaxbox": { + "titles": { + "create": "Create Main Faxbox", + "edit": "Edit Main Faxbox" + }, + "text": "Main Faxbox", + "labels": { + "inbound": "Inbound Notification Email" + } + } }, "callLogs": { @@ -967,7 +981,8 @@ "actions": { "report": "Report Call", "details": "Technical Details" - } + }, + "downloadTooltip": "In \"Custom\" Mode, you'll need to click on \"Filter\" before clicking on download." }, "myOffice": { diff --git a/submodules/callLogs/callLogs.css b/submodules/callLogs/callLogs.css index 82be377..2090de6 100644 --- a/submodules/callLogs/callLogs.css +++ b/submodules/callLogs/callLogs.css @@ -32,6 +32,7 @@ #call_logs_container .fixed-ranges-date { margin-top: 10px; + margin-right: 30px; } #call_logs_container .fixed-ranges-date .highlight-date { @@ -42,6 +43,7 @@ #call_logs_container .custom-range { display: none; + margin-right: 30px; } #call_logs_container .custom-range.active { diff --git a/submodules/callLogs/callLogs.js b/submodules/callLogs/callLogs.js index d6e7ffb..5840abb 100644 --- a/submodules/callLogs/callLogs.js +++ b/submodules/callLogs/callLogs.js @@ -42,6 +42,7 @@ define(function(require){ dataTemplate.cdrs = cdrs; template = $(monster.template(self, 'callLogs-layout', dataTemplate)); + monster.ui.tooltips(template); if(cdrs && cdrs.length) { var cdrsTemplate = $(monster.template(self, 'callLogs-cdrsList', {cdrs: cdrs, showReport: monster.config.whitelabel.callReportEmail ? true : false})); diff --git a/submodules/strategy/strategy.js b/submodules/strategy/strategy.js index c8931df..5eb9e63 100644 --- a/submodules/strategy/strategy.js +++ b/submodules/strategy/strategy.js @@ -185,7 +185,7 @@ define(function(require){ self.strategyListDirectories(function (directories) { callback(null, directories); }); - } + }, }, function(err, results) { var hasMainNumber = (results.callflows["MainCallflow"].numbers.length > 1), @@ -1104,8 +1104,8 @@ define(function(require){ self.strategyRefreshTemplate(parentContainer, strategyData); }); }; - if(mainFaxing.numbers.length <= 1 - && mainFaxing.numbers[0] === "undefinedfaxing") { + + if(mainFaxing.numbers.length <= 1 && mainFaxing.numbers[0] === "undefinedfaxing") { mainFaxing.numbers = []; } mainFaxing.numbers = mainFaxing.numbers.concat(numbers); @@ -1113,15 +1113,53 @@ define(function(require){ updateCallflow(); } else { - self.strategyBuildFaxbox({ - data: { - number: mainFaxing.numbers[0] - }, - success: function(data) { - mainFaxing.flow.data.id = data.id; - updateCallflow(); - } - }); + var template = $(monster.template(self, 'strategy-popupEditFaxbox')), + popup = monster.ui.dialog(template, { + title: self.i18n.active().strategy.popupEditFaxbox.titles.create, + position: ['center', 20], + hideClose: true + }); + + template + .find('.cancel-link') + .on('click', function(event) { + event.preventDefault(); + + popup.dialog('close').remove(); + }); + + template + .find('.save') + .on('click', function(event) { + event.preventDefault(); + + var $form = template.find('#faxbox_form'), + email = monster.ui.getFormData('faxbox_form').email; + + monster.ui.validate($form, { + rules: { + email: { + required: true, + email: true + } + } + }); + + if (monster.ui.valid($form)) { + popup.dialog('close').remove(); + + self.strategyBuildFaxbox({ + data: { + email: email, + number: mainFaxing.numbers[0] + }, + success: function(data) { + mainFaxing.flow.data.id = data.id; + updateCallflow(); + } + }); + } + }); } } }, @@ -1158,6 +1196,88 @@ define(function(require){ monster.pub('common.numbers.dialogSpare', args); }); + container.on('click', '.action-links .edit-email', function(e) { + event.preventDefault(); + + monster.waterfall([ + function(callback) { + self.strategyGetFaxbox({ + data: { + faxboxId: strategyData.callflows.MainFaxing.flow.data.id + }, + success: function(faxbox) { + var template = $(monster.template(self, 'strategy-popupEditFaxbox', { + email: faxbox.notifications.inbound.email.send_to + })), + popup = monster.ui.dialog(template, { + title: self.i18n.active().strategy.popupEditFaxbox.titles.edit, + position: ['center', 20] + }); + + template + .find('.cancel-link') + .on('click', function(event) { + event.preventDefault(); + + popup.dialog('close').remove(); + + callback(true, null); + }); + + template + .find('.save') + .on('click', function(event) { + event.preventDefault(); + + var $form = template.find('#faxbox_form'), + email = monster.ui.getFormData('faxbox_form').email; + + monster.ui.validate($form, { + rules: { + email: { + required: true, + email: true + } + } + }); + + if (monster.ui.valid($form)) { + popup.dialog('close').remove(); + + callback(null, _.extend(faxbox, { + notifications: { + inbound: { + email: { + send_to: email + } + } + } + })); + } + }); + } + }); + }, + function(faxboxData, callback) { + self.strategyUpdateFaxbox({ + data: { + faxboxId: faxboxData.id, + data: faxboxData + }, + success: function(updatedFaxbox) { + callback(null, updatedFaxbox); + } + }); + } + ], + function(err, results) { + if (!err) { + toastr.success('Main Fabox Email Successfully Changed'); + } + } + ); + }); + container.on('click', '.action-links .buy-link', function(e) { e.preventDefault(); monster.pub('common.buyNumbers', { @@ -2519,14 +2639,11 @@ define(function(require){ return results; }, - strategyBuildFaxbox: function(args) { var self = this; self.strategyGetAccount({ success: function(account) { - var email = account.contact && account.contact.technical && account.contact.technical.hasOwnProperty('email') ? account.contact.technical.email : undefined; - args.data = { name: account.name + self.i18n.active().strategy.faxing.nameExtension, caller_name: account.name, @@ -2538,21 +2655,12 @@ define(function(require){ notifications: { inbound: { email: { - send_to: email - } - }, - outbound: { - email: { - send_to: email + send_to: args.data.email } } } }; - if(!email) { - delete args.data.notifications; - } - self.strategyCreateFaxbox(args); } }); @@ -3388,6 +3496,23 @@ define(function(require){ }); }, + strategyGetFaxbox: function(args) { + var self = this; + + self.callApi({ + resource: 'faxbox.get', + data: $.extend(true, { + accountId: self.accountId + }, args.data), + success: function(data, status) { + args.hasOwnProperty('success') && args.success(data.data); + }, + error: function(data, status) { + args.hasOwnProperty('error') && args.error(); + } + }); + }, + strategyCreateFaxbox: function(args) { var self = this; @@ -3406,6 +3531,23 @@ define(function(require){ }); }, + strategyUpdateFaxbox: function(args) { + var self = this; + + self.callApi({ + resource: 'faxbox.update', + data: $.extend(true, { + accountId: self.accountId + }, args.data), + success: function(data, status) { + args.hasOwnProperty('success') && args.success(data.data); + }, + error: function(data, status) { + args.hasOwnProperty('error') && args.error(); + } + }); + }, + strategyDeleteFaxbox: function(args) { var self = this; diff --git a/views/callLogs-layout.html b/views/callLogs-layout.html index 25b1593..c85b808 100644 --- a/views/callLogs-layout.html +++ b/views/callLogs-layout.html @@ -38,6 +38,7 @@ {{/if}} {{i18n.download}} + diff --git a/views/strategy-faxingnum.html b/views/strategy-faxingnum.html index 775c44a..5c5cae7 100644 --- a/views/strategy-faxingnum.html +++ b/views/strategy-faxingnum.html @@ -15,6 +15,12 @@
{{ i18n.close }}