Browse Source

Merge branch 'UI-2500'

4.3
Joris Tirado 9 years ago
parent
commit
d54cc9d262
4 changed files with 219 additions and 27 deletions
  1. +16
    -2
      i18n/en-US.json
  2. +167
    -25
      submodules/strategy/strategy.js
  3. +6
    -0
      views/strategy-faxingnum.html
  4. +30
    -0
      views/strategy-popupEditFaxbox.html

+ 16
- 2
i18n/en-US.json View File

@ -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": {


+ 167
- 25
submodules/strategy/strategy.js View File

@ -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;


+ 6
- 0
views/strategy-faxingnum.html View File

@ -15,6 +15,12 @@
<div class="number-actions">
<a href="#" class="monster-link blue cancel-link pull-right">{{ i18n.close }}</a>
<div class="action-links nav-bar clearfix">
{{#unless actionLinksEnabled}}
<a href="#" class="edit-email monster-link">
<i class="icon-telicon-setting-cog"></i>
{{i18n.strategy.faxing.editFaxbox}}
</a>
{{/unless}}
{{#if actionLinksEnabled}}
<a href="#" class="spare-link monster-link pull-left{{#unless spareLinkEnabled}} disabled{{/unless}}"><i class="fa fa-file-text-o monster-orange fa-lg"></i>{{ i18n.strategy.numberLinks.spare }}</a>
<ul class="nav pull-left">


+ 30
- 0
views/strategy-popupEditFaxbox.html View File

@ -0,0 +1,30 @@
<div class="monster-feature-popup-container" data-feature="faxing">
<div class="feature-popup-title">
<div class="feature-fa-wrapper">
<i class="icon-telicon-fax"></i>
</div>
{{i18n.strategy.popupEditFaxbox.text}}
</div>
<div class="content">
<form class="form-horizontal" id="faxbox_form">
<div class="contorl-group">
<label for="email" class="control-label">
{{i18n.strategy.popupEditFaxbox.labels.inbound}}
</label>
<div class="controls">
<input type="text" id="email" name="email" value="{{email}}">
</div>
</div>
</form>
</div>
<div class="actions clearfix">
<div class="pull-right">
{{#if email}}
<a class="cancel-link monster-link blue" href="javascript:void(0);">{{ i18n.cancel }}</a>
{{/if}}
<button type="button" class="monster-button monster-button-success save">{{ i18n.saveChanges }}</button>
</div>
</div>
</div>

Loading…
Cancel
Save