diff --git a/app.js b/app.js index 7940895..a028bd8 100755 --- a/app.js +++ b/app.js @@ -68,11 +68,101 @@ define(function(require) { } ]; + var tabConfig = { + text: self.i18n.active().recordings.menuTitles.config, + menus: [{ + tabs: [ + { + text: 'Account', + callback: self.renderRecordConfig + } + ], + }] + }; + + menus[0].tabs.push(tabConfig); + monster.ui.generateAppLayout(self, { menus: menus }); }, + renderRecordConfig: function (pArgs) { + var self = this, + args = pArgs || {}, + parent = args.container || $('#recordings_app_container .app-content-wrapper'); + + self.getAccount(function (accountData) { + var templateData = { + account: $.extend(true, {}, accountData) + }; + + var contentTemplate = $(self.getTemplate({ + name: 'recordings-config', + data: templateData + })); + + contentTemplate.find('#recordings_config_save').on('click', function() { + var formData = monster.ui.getFormData('recordings_config_form'); + + var formattedData = { + "call_recording": { + "account": { + "inbound": { + "offnet": { + "enabled": formData['inbound-offnet'], + }, + "onnet": { + "enabled": formData['inbound-onnet'], + } + }, + "outbound": { + "offnet": { + "enabled": formData['outbound-offnet'], + }, + "onnet": { + "enabled": formData['outbound-onnet'], + } + } + } + } + }; + self.callApi({ + resource: 'account.get', + data: { + accountId: accountData.id + }, + success: function(data, status) { + self.callApi({ + resource: 'account.update', + data: { + accountId: accountData.id, + data: $.extend(true, {}, data.data, formattedData) + }, + success: function(_data, _status) { + monster.ui.toast({ + type: 'success', + message: self.i18n.active().toastrMessages.recordConfigUpdateSuccess, + options: { + timeOut: 5000 + } + }); + } + }); + } + }); + }); + + parent + .fadeOut(function () { + $(this) + .empty() + .append(contentTemplate) + .fadeIn(); + }); + }); + }, + renderReceivedRECs: function(pArgs) { var self = this, args = pArgs || {}, @@ -474,6 +564,20 @@ define(function(require) { return formattedData; }, + getAccount: function (callback) { + var self = this; + + self.callApi({ + resource: 'account.get', + data: { + accountId: self.accountId + }, + success: function (data) { + callback(data.data); + } + }); + }, + getCDR: function(callId, callback, error) { var self = this; diff --git a/i18n/en-US.json b/i18n/en-US.json index 9218cbc..8b0d30d 100755 --- a/i18n/en-US.json +++ b/i18n/en-US.json @@ -3,7 +3,8 @@ "title": "Recordings Manager", "menuTitles": { "receivedRECs": "Received Recordings", - "storage": "Storage" + "storage": "Storage", + "config": "Configuration" }, "receivedRECs": { "filterByDate": "Filter by Dates", @@ -63,6 +64,20 @@ "CDRPopup": { "title": "CDR Details" } + }, + "config": { + "legend": "Record Entire Account", + "internalInbound": "Record Internal Inbound", + "externalInbound": "Record External Inbound", + "internalOutbound": "Record Internal Outbound", + "externalOutbound": "Record External Outbound", + "internalInboundTooltip": "This setting will record every inbound internal calls on the account, including callflows, ring groups, conferences, etc. unless specific settings for the user and/or device indicate otherwise", + "externalInboundTooltip": "This setting will record every inbound external calls on the account, including callflows, ring groups, conferences, etc. unless specific settings for the user and/or device indicate otherwise", + "internalOutboundTooltip": "This setting will record every outbound internal calls on the account, including callflows, ring groups, conferences, etc. unless specific settings for the user and/or device indicate otherwise", + "externalOutboundTooltip": "This setting will record every outbound external calls on the account, including callflows, ring groups, conferences, etc. unless specific settings for the user and/or device indicate otherwise" } + }, + "toastrMessages": { + "recordConfigUpdateSuccess": "Recordings configuration updated successfully!" } } diff --git a/metadata/app.json b/metadata/app.json index 0d81220..23057fa 100755 --- a/metadata/app.json +++ b/metadata/app.json @@ -20,7 +20,7 @@ "license": "-", "price": 0, "screenshots": [ - "recordings.png" + "screenshot1.png" ], "urls": { "documentation": "{documentation_url}", diff --git a/metadata/screenshots/recordings.png b/metadata/screenshots/screenshot1.png similarity index 100% rename from metadata/screenshots/recordings.png rename to metadata/screenshots/screenshot1.png diff --git a/style/app.css b/style/app.css index 38a3101..a89506e 100755 --- a/style/app.css +++ b/style/app.css @@ -295,4 +295,63 @@ #recordings_cdr_details_dialog { width: 750px; margin: 15px +} + +/***** Record Config Tab *****/ +.main-content .tab-content { + background: transparent; + border: none; + overflow: visible; +} +.main-content .tab-content .tab-pane { + border-radius: 2px; + border: solid 1px #c0c0c9; + background: #f0f0f9; +} + +.recordings_account_tab { + padding: 20px; +} + +.recordings_account_tab .control-label { + text-align: left; + width: 180px; +} + +.recordings_account_tab .control-label .help-tip { + margin-left: 0.5rem; +} + +.recordings_account_tab .control-label .iconography-small { + margin-top: -3px; + font-size: 14px; + width: 14px; + height: 14px; +} + +.recordings_account_tab .control-label .iconography-help { + color: #909099; +} + .recordings_account_tab .control-label .iconography-help:hover { + color: #2e2e32; + } + +.recordings_account_tab .controls { + margin-left: 250px; +} + +.main-content .tab-content { + background: transparent; + border: none; + overflow: visible; +} + +.main-content .tab-content .buttons-div { + margin-top: 20px; + padding-top: 20px; + border-top: solid 1px #c0c0c9; +} + +.main-content .tab-content .buttons-div > button { + float: right; } \ No newline at end of file diff --git a/views/recordings-config.html b/views/recordings-config.html new file mode 100755 index 0000000..7473773 --- /dev/null +++ b/views/recordings-config.html @@ -0,0 +1,81 @@ +