{text}
", + "diff --git a/app/locales.js b/app/locales.js
index 0cd375f6..910675dc 100644
--- a/app/locales.js
+++ b/app/locales.js
@@ -1156,10 +1156,10 @@ Ext.define('Ngcp.csc.locales', {
it: 'Contacts',
de: 'Contacts',
fr: 'Contacts',
- sp: 'Conversation with'
+ sp: 'Contacts'
}
},
- chat: {
+ conversationwith: {
title: {
en: 'Conversation with',
it: 'Conversation with',
@@ -1191,11 +1191,11 @@ Ext.define('Ngcp.csc.locales', {
}
},
start_conversation: {
- en: 'You can start a private conversation with {0} here.',
- it: 'You can start a private conversation with {0} here.',
- de: 'You can start a private conversation with {0} here.',
- fr: 'You can start a private conversation with {0} here.',
- sp: 'You can start a private conversation with {0} here.'
+ en: '',
+ it: 'You can start a conversation with {0} here.',
+ de: 'You can start a conversation with {0} here.',
+ fr: 'You can start a conversation with {0} here.',
+ sp: 'You can start a conversation with {0} here.'
},
start_group_conversation: {
en: 'You can start a group conversation here.',
@@ -1921,12 +1921,12 @@ Ext.define('Ngcp.csc.locales', {
fr: 'Duration',
sp: 'Duration'
},
- caller: {
- en: 'Caller',
- it: 'Caller',
- de: 'Caller',
- fr: 'Caller',
- sp: 'Caller'
+ callee: {
+ en: 'Callee',
+ it: 'Callee',
+ de: 'Callee',
+ fr: 'Callee',
+ sp: 'Callee'
},
callee: {
en: 'Callee',
@@ -1992,11 +1992,11 @@ Ext.define('Ngcp.csc.locales', {
sp: 'To'
},
done: {
- en: 'done',
- it: 'done',
- de: 'done',
- fr: 'done',
- sp: 'done'
+ en: 'Done',
+ it: 'Done',
+ de: 'Done',
+ fr: 'Done',
+ sp: 'Done'
},
groups: {
en: 'Groups',
diff --git a/app/model/Chat.js b/app/model/Chat.js
deleted file mode 100644
index 9a4b29a3..00000000
--- a/app/model/Chat.js
+++ /dev/null
@@ -1,21 +0,0 @@
-Ext.define('NgcpCsc.model.Chat', {
- extend: 'Ext.data.Model',
-
- fields: [{
- name: 'new_message',
- type: 'string'
- }, {
- name: 'chatEnabled',
- type: 'boolean'
- }],
-
- proxy: {
- type: 'ajax',
- url: '/resources/data/message.json',
- autoLoad: true,
- reader: {
- type: 'json',
- rootProperty: 'data'
- }
- }
-});
diff --git a/app/model/ChatNotification.js b/app/model/ChatNotification.js
index d763e25c..c802164d 100644
--- a/app/model/ChatNotification.js
+++ b/app/model/ChatNotification.js
@@ -1,20 +1,4 @@
-Ext.define('NgcpCsc.model.ChatNotification', {
+Ext.define('NgcpCsc.model.Message', {
extend: 'Ext.data.Model',
- fields: [{
- name: '_id'
- }, {
- name: 'parent_id'
- }, {
- name: 'name'
- }, {
- name: 'source'
- }, {
- name: 'date'
- }, {
- name: 'isActive'
- }, {
- name: 'time'
- }, {
- name: 'content'
- }]
+ fields: ['_id', 'new_message']
});
diff --git a/app/model/Notification.js b/app/model/Notification.js
new file mode 100644
index 00000000..80deddf3
--- /dev/null
+++ b/app/model/Notification.js
@@ -0,0 +1,5 @@
+Ext.define('NgcpCsc.model.Notification', {
+ extend: 'Ext.data.Model',
+
+ fields: ['id', 'conversation_type', 'status', 'text', 'direction', 'start_time']
+});
diff --git a/app/model/VoiceMail.js b/app/model/VoiceMail.js
index 8a4ad0c8..0a0030d3 100644
--- a/app/model/VoiceMail.js
+++ b/app/model/VoiceMail.js
@@ -2,7 +2,7 @@ Ext.define('NgcpCsc.model.VoiceMail', {
extend: 'Ext.data.Model',
fields: [{
- name: 'caller',
+ name: 'callee',
type: 'string'
}, {
name: 'duration',
diff --git a/app/store/Chat.js b/app/store/Chat.js
deleted file mode 100644
index e8f0abaa..00000000
--- a/app/store/Chat.js
+++ /dev/null
@@ -1,18 +0,0 @@
-Ext.define('NgcpCsc.store.Chat', {
- extend: 'Ext.data.Store',
-
- storeId: 'Chat',
-
- model: 'NgcpCsc.model.ChatNotification',
-
- autoLoad:true,
-
- proxy: {
- type: 'ajax',
- url: '/resources/data/chat.json',
- reader: {
- type: 'json',
- rootProperty: 'data'
- }
- }
-});
diff --git a/app/store/NavigationTree.js b/app/store/NavigationTree.js
index b2e5ddcd..f2602267 100644
--- a/app/store/NavigationTree.js
+++ b/app/store/NavigationTree.js
@@ -19,7 +19,7 @@ Ext.define('NgcpCsc.store.NavigationTree', {
}, {
text: 'Conversation with',
iconCls: 'x-fa fa-wechat',
- viewType: 'chat',
+ viewType: 'conversationwith',
routeId: 'conversation-with',
acl: ['administrator', 'restricted'],
visible: false,
diff --git a/app/store/Notifications.js b/app/store/Notifications.js
new file mode 100644
index 00000000..ee0ec1c0
--- /dev/null
+++ b/app/store/Notifications.js
@@ -0,0 +1,19 @@
+Ext.define('NgcpCsc.store.Notifications', {
+ extend: 'Ext.data.Store',
+
+ storeId: 'Notifications',
+
+ model: 'NgcpCsc.model.Notification',
+
+ autoLoad:true,
+
+ proxy: {
+ type: 'ajax',
+ baseUrl : '/resources/data/notifications/',
+ url: '/resources/data/notifications/0.json',
+ reader: {
+ type: 'json',
+ rootProperty: 'data'
+ }
+ }
+});
diff --git a/classic/sass/src/view/main/Main.scss b/classic/sass/src/view/main/Main.scss
index a5d8e588..6b0c5d29 100644
--- a/classic/sass/src/view/main/Main.scss
+++ b/classic/sass/src/view/main/Main.scss
@@ -201,7 +201,7 @@
}
}
.section-container {
- padding-bottom:25px;
+ padding-bottom:5px;
}
.logo {
diff --git a/classic/sass/src/view/pages/chat/Chat.scss b/classic/sass/src/view/pages/chat/Chat.scss
deleted file mode 100644
index 3e885ed1..00000000
--- a/classic/sass/src/view/pages/chat/Chat.scss
+++ /dev/null
@@ -1,126 +0,0 @@
-.user-notifications {
- padding: 15px;
- background: #fff;
-
- .x-view-item-focused {
- outline: 0 !important;
- }
-}
-
-.comments {
- margin-bottom: 10px;
- cursor: pointer;
-
- img.profile-icon {
- height: 50px;
- width: 50px;
- border: 2px solid $base-border-color;
- @include border-radius($circle-border-radius);
- float: left;
- }
-
- h4 {
- font-size: 14px;
- float: left;
-
- span {
- margin-left: 8px;
- font-size: 18px;
- position: relative;
- top: 2px;
- }
- }
-
- .from-now {
- float: right;
-
- span {
- margin-right: 5px;
- font-size: 16px;
- position: relative;
- top: 1px;
- }
- }
-
- .content-wrap {
- margin-left: 65px;
-
- .content {
- margin-bottom: 15px;
- white-space: normal;
- clear: both;
- }
- }
-
- &.sub-comments {
- margin: 0 0 10px 60px;
-
- .like-comment-btn-wrap {
- border-bottom: none;
- }
- }
-}
-
-.like-comment-btn-wrap {
- text-align: right;
- padding-bottom: 15px;
-
- button {
- margin-left: 15px;
- height: 30px;
- width: 30px;
- background-color: $like-comment-btn-background-color;
- font-size: 14px;
- color: $color;
- border: none;
- cursor: pointer;
- }
-}
-
-.menu-item-common {
- padding-right: 20px;
- position: absolute;
- font-family: FontAwesome;
- right: 0;
-}
-
-.new-message-cont {
- margin-right: 10px;
-}
-
-.submit-new-message {
- float: right;
- top: 0 !important;
-}
-
-.hide-pm {
- display: none;
-}
-
-.private-conversation-text {
- padding: 30px;
-}
-
-.online-user {
- color: $online-menu-item-color !important;
-}
-
-.offline-user {
- color: $offline-menu-item-color !important;
-}
-
-.chat-container {
- // replace core-container $ui , because tabpanel has no mixin/variables
- border: 1px solid lightgray;
- border-radius: 10px;
-
- .x-panel-body {
- background-color: $body-background-color;
- }
-}
-
-.chat-default-msg-cont {
- font-size: 16px;
- text-align: center;
- margin-top: 30px;
-}
diff --git a/classic/sass/src/view/pages/conversations/Conversations.scss b/classic/sass/src/view/pages/conversations/Conversations.scss
index 58ae6ef2..2dbb6e01 100644
--- a/classic/sass/src/view/pages/conversations/Conversations.scss
+++ b/classic/sass/src/view/pages/conversations/Conversations.scss
@@ -21,7 +21,7 @@
padding: 16px;
}
-.caller {
+.callee {
font-size: 16px;
}
diff --git a/classic/sass/src/view/pages/conversationwith/ConversationWith.scss b/classic/sass/src/view/pages/conversationwith/ConversationWith.scss
new file mode 100644
index 00000000..f1f0b55d
--- /dev/null
+++ b/classic/sass/src/view/pages/conversationwith/ConversationWith.scss
@@ -0,0 +1,121 @@
+.user-notifications {
+ padding: 15px;
+ background: #fff;
+}
+
+.icon:before {
+ font-family: FontAwesome;
+ color: $base-color;
+}
+
+.call-icon,
+.chat-icon,
+.sms-icon,
+.voicemail-icon,
+.fax-icon,
+.incoming-answered-icon,
+.incoming-missed-icon,
+.outgoing-answered-icon,
+.outgoing-missed-icon
+ {
+ float: left;
+ margin-right: 10px;
+}
+
+.incoming-answered-icon:before {
+ @extend .icon:before;
+ content: "\f053";
+ color:#66a648;
+}
+.incoming-missed-icon:before {
+ @extend .icon:before;
+ content: "\f053";
+ color:#ea5000;
+}
+.outgoing-answered-icon:before {
+ @extend .icon:before;
+ content: "\f054";
+ color:#66a648;
+}
+.outgoing-missed-icon:before {
+ @extend .icon:before;
+ content: "\f054";
+ color:#ea5000;
+}
+
+.call-icon:before {
+ @extend .icon:before;
+ content: "\f095";
+}
+
+.chat-icon:before {
+ @extend .icon:before;
+ content: "\f0e5";
+}
+
+.sms-icon:before {
+ @extend .icon:before;
+ content: "\f003";
+}
+
+.voicemail-icon:before {
+ @extend .icon:before;
+ content: "\f115";
+}
+
+.fax-icon:before {
+ @extend .icon:before;
+ content: "\f0f6";
+}
+
+.notification {
+ margin-bottom: 30px;
+ .text {
+ margin-left:40px;
+ }
+
+}
+.menu-item-common {
+ padding-right: 20px;
+ position: absolute;
+ font-family: FontAwesome;
+ right: 0;
+}
+
+.toolbar-cont {
+ background-color: #F6F6F6;
+}
+
+.submit-new-message {
+ float: right;
+ top: 0 !important;
+}
+
+.hide-pm {
+ display: none;
+}
+
+.private-conversation-text {
+ padding: 30px;
+ .x-view-item-focused {
+ outline: 0 !important;
+ }
+}
+
+.online-user {
+ color: $online-menu-item-color !important;
+}
+
+.offline-user {
+ color: $offline-menu-item-color !important;
+}
+
+.conversation-with-container {
+ // replace core-container $ui , because tabpanel has no mixin/variables
+ border: 1px solid lightgray;
+ border-radius: 10px;
+
+ .x-panel-body {
+ background-color: $body-background-color;
+ }
+}
diff --git a/classic/src/Application.js b/classic/src/Application.js
index 39d4fc4d..deef1e51 100644
--- a/classic/src/Application.js
+++ b/classic/src/Application.js
@@ -18,7 +18,7 @@ Ext.define('NgcpCsc.Application', {
'Conversations',
'ConversationTypes',
'VoiceMails',
- 'Chat',
+ 'Notifications',
'Contacts',
'Languages',
'CallBlockingOutgoing',
diff --git a/classic/src/view/common/gridfilters/GridFilters.js b/classic/src/view/common/gridfilters/GridFilters.js
index 1a973312..f4e1476f 100644
--- a/classic/src/view/common/gridfilters/GridFilters.js
+++ b/classic/src/view/common/gridfilters/GridFilters.js
@@ -15,6 +15,7 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFilters', {
reference: 'conversationsFilterForm',
margin: '20 20 0 20',
layout: 'responsivecolumn',
+ hidden:true,
bind: {
hidden: '{filtergrid.convFilterHideState}'
},
@@ -131,6 +132,7 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFilters', {
}, {
xtype: 'form',
reference: 'pbxSeatsFilterForm',
+ hidden:true,
bind: {
hidden: '{filtergrid.pbxSeatsFilterHideState}'
},
@@ -183,6 +185,7 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFilters', {
}]
}, {
xtype: 'form',
+ hidden:true,
reference: 'pbxGroupsFilterForm',
bind: {
hidden: '{filtergrid.pbxGroupsFilterHideState}'
@@ -227,6 +230,7 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFilters', {
}]
}, {
xtype: 'form',
+ hidden:true,
reference: 'pbxDevicesFilterForm',
bind: {
hidden: '{filtergrid.pbxDevicesFilterHideState}'
diff --git a/classic/src/view/common/gridfilters/GridFiltersController.js b/classic/src/view/common/gridfilters/GridFiltersController.js
index 9aa84789..5e88c8ea 100644
--- a/classic/src/view/common/gridfilters/GridFiltersController.js
+++ b/classic/src/view/common/gridfilters/GridFiltersController.js
@@ -8,7 +8,8 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
newSearchFieldInput: 'filterBySearchFieldInput',
toggleFilterForm: 'toggleFilterForm',
routeChange: 'hideFilterForms',
- toggleFreeSearch: 'toggleFreeSearch'
+ toggleFreeSearch: 'toggleFreeSearch',
+ resetFilters : 'resetVM'
}
}
},
@@ -26,6 +27,10 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
case (currentRoute == '#inbox'):
store.filterBy(me.applyConvSearchFilter, me);
break;
+ case (currentRoute == '#conversation-with'):
+ store.filterBy(me.applyConvWithSearchFilter, me);
+ break;
+ break
case (currentRoute == '#pbxconfig/devices'):
store.filterBy(me.applyPbxSearchFilter, me);
break;
@@ -57,6 +62,9 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
case (currentRoute == '#inbox'):
return 'Conversations';
break;
+ case (currentRoute == '#conversation-with'):
+ return 'Notifications';
+ break;
case (currentRoute == '#pbxconfig/devices'):
return 'Devices';
break;
@@ -80,6 +88,17 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
return retVal;
},
+ applyConvWithSearchFilter: function(record) {
+ var vm = this.getViewModel();
+ var store = Ext.getStore('Notifications');
+ var fieldInput = vm.get('filtergrid.headerBarFieldInput').toLowerCase();
+ var retVal = true;
+ if (fieldInput && record.get('text').indexOf(fieldInput) == -1) {
+ retVal = false;
+ }
+ return retVal;
+ },
+
applyPbxSearchFilter: function(record) {
var vm = this.getViewModel();
var store = Ext.getStore('Conversations');
@@ -94,6 +113,7 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
getFormReference: function (currentRoute) {
switch (true) {
case (currentRoute == '#inbox'):
+ case (currentRoute == '#conversation-with'):
return this.lookupReference('conversationsFilterForm');
break;
case (currentRoute == '#pbxconfig/seats'):
@@ -123,7 +143,9 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
store = Ext.getStore(storeId);
switch (true) {
case (currentRoute == '#inbox'):
+ case (currentRoute == '#conversation-with'):
store.filterBy(me.applyCallFilters, me);
+ me.fireEvent('focusLastMsg')
break;
case (currentRoute == '#pbxconfig/seats'):
store.filterBy(me.applyPbxconfigSeatsFilters, me);
@@ -225,7 +247,7 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
return retVal;
},
- resetFilters: function() {
+ resetFilters: function(store) {
var store;
var me = this;
var currentRoute = window.location.hash;
@@ -241,11 +263,17 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
resetVM: function(store) {
var vm = this.getViewModel();
- store.clearFilter();
+ if(store){
+ store.clearFilter();
+ }
vm.set('filtergrid.from_date', null);
vm.set('filtergrid.to_date', null);
vm.set('filtergrid.number', null);
- vm.set('filtergrid.type', ["call", "voicemail", "reminder", "fax"]);
+ vm.set('filtergrid.call', true);
+ vm.set('filtergrid.voicemail', true);
+ vm.set('filtergrid.sms', true);
+ vm.set('filtergrid.chat', true);
+ vm.set('filtergrid.fax', true);
vm.set('filtergrid.incoming', true);
vm.set('filtergrid.outgoing', true);
vm.set('filtergrid.missed', true);
@@ -296,8 +324,10 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
toggleFilterForm: function () {
var vm = this.getViewModel();
var currentRoute = window.location.hash;
+ var me = this;
switch (true) {
case (currentRoute == '#inbox'):
+ case (currentRoute == '#conversation-with'):
vm.set('filtergrid.convFilterHideState', !vm.get('filtergrid.convFilterHideState'));
break;
case (currentRoute == '#pbxconfig/seats'):
@@ -311,6 +341,10 @@ Ext.define('NgcpCsc.view.common.gridfilters.GridFiltersController', {
break;
};
vm.set('headerBarFieldHideState', !vm.get('headerBarFieldHideState'));
+ // we need to resize the section container when the filterpanel toggles
+ Ext.Function.defer(function(){
+ me.fireEvent('setCardHeight');
+ }, 100);
},
hideFilterForms: function () {
diff --git a/classic/src/view/common/rtc/RtcController.js b/classic/src/view/common/rtc/RtcController.js
index e720e6e7..a128f51e 100644
--- a/classic/src/view/common/rtc/RtcController.js
+++ b/classic/src/view/common/rtc/RtcController.js
@@ -1,6 +1,7 @@
Ext.define('NgcpCsc.view.common.rtc.RtcController', {
extend: 'Ext.app.ViewController',
alias: 'controller.rtc',
+ id:'rtc',
listen: {
controller: {
'*': {
@@ -14,19 +15,28 @@ Ext.define('NgcpCsc.view.common.rtc.RtcController', {
currentStream: null,
intervalId: '',
- showRtcPanel: function(record, action, switchVideoOn) {
+ showRtcPanel: function(record, action, switchVideoOn, preventReloadConversation) {
+ var me = this;
var panel = this.getView();
var vm = this.getViewModel();
vm.set('numberToCall', '');
switch (action) {
case 'startCall':
case 'startVideoCall':
- var buddyUser = Ext.getStore('Chat').findRecord('uid', record.get('uid'));
- var number = (buddyUser) ? buddyUser.get('number') : record.get('caller') || record.get('source_cli') || record.get('mobile');
+ var number = record.get('name') || record.get('source_cli') || record.get('callee');
var mainView = Ext.ComponentQuery.query('[name=mainView]')[0];
+ var notification = Ext.create('NgcpCsc.model.Notification',{
+ 'id' : Ext.id(),
+ 'conversation_type' :'call',
+ 'name':number,
+ 'direction':'outgoing',
+ 'status':'answered',
+ 'start_time' : Date.now()
+ });
+ vm.set('uid', record.get('uid') || number);
vm.set('title', Ext.String.format('Call with {0}', number));
- vm.set('thumbnail', (buddyUser) ? buddyUser.get('thumbnail') : this.getViewModel().get('defaultThumbnail'));
- vm.set('status', Ext.String.format('calling {0} ...', (buddyUser) ? buddyUser.get('name') : ''));
+ vm.set('thumbnail', record.get('thumbnail') || this.getViewModel().get('defaultThumbnail'));
+ vm.set('status', Ext.String.format('calling {0} ...', number));
vm.set('callEnabled', false);
vm.set('micEnabled', false);
vm.set('phoneComposerHidden', true);
@@ -35,8 +45,13 @@ Ext.define('NgcpCsc.view.common.rtc.RtcController', {
vm.set('callPanelHidden', false);
vm.set('videoEnabled', switchVideoOn || false);
mainView.getViewModel().set('sectionTitle', 'Conversation with ' + number);
- this.redirectTo('conversation-with');
this.emulateCall(true, action == 'startVideoCall');
+ if(!preventReloadConversation){
+ this.redirectTo('conversation-with');
+ Ext.Function.defer(function(){
+ me.fireEvent('openpmtab', null, record);
+ }, 100);
+ }
break;
case 'phoneComposer':
if(vm.get('connected')){
@@ -71,10 +86,22 @@ Ext.define('NgcpCsc.view.common.rtc.RtcController', {
break;
}
panel.show().expand();
+ this.fireEvent('collapseContacts');
},
toogleChat: function(btn) {
- this.fireEvent('togglechat', btn.pressed);
+ var me = this;
+ var vm = this.getViewModel();
+ var contactsStore = Ext.getStore('Contacts');
+ var contact = contactsStore.findRecord('uid', vm.get('uid')) || Ext.create('Ext.data.Model',{
+ id:vm.get('uid'),
+ name:vm.get('number')
+ });
+ me.fireEvent('updateconversationtitle', 'conversation-with', contact);
+ me.redirectTo('conversation-with');
+ Ext.Function.defer(function(){
+ me.fireEvent('openpmtab', null, contact, true);
+ }, 100);
},
toggleFullscreen: function() {
@@ -103,7 +130,10 @@ Ext.define('NgcpCsc.view.common.rtc.RtcController', {
this.getView().hide();
vm.set('status', '');
clearInterval(this.intervalId);
- this.endCall();
+ if(vm.get('connected')){
+ this.endCall();
+ }
+ this.fireEvent('expandContacts');
return false;
},
emulateCall: function(audioOn, videoOn) {
@@ -163,10 +193,8 @@ Ext.define('NgcpCsc.view.common.rtc.RtcController', {
},
toggleCall: function(btn) {
if (btn.pressed) { // this can be also checked against vm.get('callEnabled')
- btn.removeCls('fa-rotate-180');
this.emulateCall(true, false);
} else {
- btn.addCls('fa-rotate-180');
this.endCall();
}
},
@@ -187,6 +215,7 @@ Ext.define('NgcpCsc.view.common.rtc.RtcController', {
}
vm.set('status', 'Call ended.');
vm.set('connected', false);
+ this.fireEvent('notify', 'call');
},
startMedia: function(audio, video) {
@@ -236,30 +265,58 @@ Ext.define('NgcpCsc.view.common.rtc.RtcController', {
startNewCall: function() {
var vm = this.getViewModel();
var currentNum = vm.get('numberToCall');
- var record = Ext.create('NgcpCsc.model.Conversation', {
- caller: currentNum
+ var record = Ext.create('Ext.data.Model', {
+ callee: currentNum
});
this.showRtcPanel(record, 'startCall');
},
sendFax: function() {
- var vm = this.getViewModel();
+ var me = this;
+ var vm = me.getViewModel();
var mainView = Ext.ComponentQuery.query('[name=mainView]')[0];
- var faxForm = this.getView().down('fax-composer');
+ var faxForm = me.getView().down('fax-composer');
+ var record = Ext.create('NgcpCsc.model.Notification',{
+ 'id' : Ext.id(),
+ 'conversation_type' :'fax',
+ 'name' : vm.get('numberToCall'),
+ 'direction':'outgoing',
+ 'status':'answered',
+ 'start_time' : Date.now()
+ });
if(faxForm.isValid()){
mainView.getViewModel().set('sectionTitle', 'Conversation with ' + vm.get('numberToCall'));
- this.redirectTo('conversation-with');
+ me.redirectTo('conversation-with');
+ Ext.Function.defer(function(){
+ me.fireEvent('openpmtab', null, record);
+ me.fireEvent('notify', 'fax');
+ }, 100);
faxForm.reset();
- this.fireEvent('showmessage', true, Ngcp.csc.locales.rtc.fax_sent[localStorage.getItem('languageSelected')]);
+ me.fireEvent('showmessage', true, Ngcp.csc.locales.rtc.fax_sent[localStorage.getItem('languageSelected')]);
}else{
- this.fireEvent('showmessage', false, Ngcp.csc.locales.common.invalid_form[localStorage.getItem('languageSelected')]);
+ me.fireEvent('showmessage', false, Ngcp.csc.locales.common.invalid_form[localStorage.getItem('languageSelected')]);
}
-
},
sendSms: function() {
- var vm = this.getViewModel();
+ var me = this;
+ var vm = me.getViewModel();
var mainView = Ext.ComponentQuery.query('[name=mainView]')[0];
+ var smsForm = me.getView().down('sms-composer');
+ var record = Ext.create('NgcpCsc.model.Notification',{
+ 'id' : Ext.id(),
+ 'conversation_type' :'sms',
+ 'name' : vm.get('numberToCall'),
+ 'direction':'outgoing',
+ 'status':'answered',
+ 'text' : vm.get('smsText'),
+ 'start_time' : Date.now()
+ });
mainView.getViewModel().set('sectionTitle', 'Conversation with ' + vm.get('numberToCall'));
- this.redirectTo('conversation-with');
+ me.redirectTo('conversation-with');
+ Ext.Function.defer(function(){
+ me.fireEvent('openpmtab', null, record);
+ me.fireEvent('notify', 'sms', vm.get('smsText'));
+ }, 100);
+ smsForm.reset();
this.fireEvent('showmessage', true, Ngcp.csc.locales.rtc.sms_sent[localStorage.getItem('languageSelected')]);
}
});
diff --git a/classic/src/view/common/rtc/RtcModel.js b/classic/src/view/common/rtc/RtcModel.js
index 3ec6b4e6..af4c6f05 100644
--- a/classic/src/view/common/rtc/RtcModel.js
+++ b/classic/src/view/common/rtc/RtcModel.js
@@ -4,6 +4,7 @@ Ext.define('NgcpCsc.view.rtc.RtcModel', {
alias: 'viewmodel.rtc',
data: {
+ uid:'',
title: 123456789,
defaultThumbnail: 'resources/images/icons/phoneicon.png',
thumbnail: 'resources/images/icons/phoneicon.png',
@@ -39,6 +40,9 @@ Ext.define('NgcpCsc.view.rtc.RtcModel', {
},
disableSmsSubmit: function(get) {
return get('smsText').length > 140 || get('smsText').length < 1;
+ },
+ setuserCls:function(get){
+ return get('callEnabled') ? '' : 'fa-rotate-180';
}
}
});
diff --git a/classic/src/view/common/rtc/RtcPanel.js b/classic/src/view/common/rtc/RtcPanel.js
index 80eae5bb..e90553a6 100644
--- a/classic/src/view/common/rtc/RtcPanel.js
+++ b/classic/src/view/common/rtc/RtcPanel.js
@@ -92,7 +92,8 @@ Ext.define('NgcpCsc.view.common.rtc.RtcPanel', {
items: [{
iconCls: 'x-fa fa-phone',
bind: {
- pressed: '{callEnabled}'
+ pressed: '{callEnabled}',
+ userCls: '{setuserCls}'
},
handler:'toggleCall'
}, {
@@ -120,10 +121,7 @@ Ext.define('NgcpCsc.view.common.rtc.RtcPanel', {
handler:'toggleAudioVideo'
}, {
iconCls: 'x-fa fa-comment',
- bind: {
- pressed: '{chatEnabled}',
- disabled: '{!connected}'
- },
+ enableToggle: false,
handler: 'toogleChat'
}]
}]
diff --git a/classic/src/view/common/rtc/composer/Sms.js b/classic/src/view/common/rtc/composer/Sms.js
index f6b25c4b..4a94004e 100644
--- a/classic/src/view/common/rtc/composer/Sms.js
+++ b/classic/src/view/common/rtc/composer/Sms.js
@@ -1,5 +1,5 @@
Ext.define('NgcpCsc.view.common.composer.Sms', {
- extend: 'Ext.panel.Panel',
+ extend: 'Ext.form.Panel',
alias: 'widget.sms-composer',
diff --git a/classic/src/view/main/Main.js b/classic/src/view/main/Main.js
index c93ad782..adc26cf2 100644
--- a/classic/src/view/main/Main.js
+++ b/classic/src/view/main/Main.js
@@ -24,7 +24,7 @@ Ext.define('NgcpCsc.view.main.Main', {
resize: 'setItemsSize'
},
- name:'mainView',
+ name: 'mainView',
initComponent: function() {
var vm = this.getViewModel();
@@ -132,21 +132,22 @@ Ext.define('NgcpCsc.view.main.Main', {
type: 'hbox'
},
userCls: 'main-container',
- defaults:{
+ defaults: {
scrollable: true,
- height:'100%'
+ height: '100%'
},
items: [{
flex: 5,
- scrollable:false,
- id:'mainContainerInner',
+ scrollable: false,
+ id: 'mainContainerInner',
items: [{
reference: 'sectionTitle',
bind: {
title: '{sectionTitle}'
}
}, {
- xtype: 'gridfilters'
+ xtype: 'gridfilters',
+ reference: 'gridFilters'
}, {
reference: 'mainCardPanel',
cls: 'sencha-dash-right-main-container',
@@ -157,9 +158,8 @@ Ext.define('NgcpCsc.view.main.Main', {
listeners: {
resize: 'mainContainerResized'
},
- defaults:{
- scrollable:true,
- height: screen.height - (Ext.os.is.Desktop ? 200 : 100) // - header + filters height
+ defaults: {
+ scrollable: true
}
}]
}, {
@@ -172,8 +172,7 @@ Ext.define('NgcpCsc.view.main.Main', {
width: 250,
resizable: Ext.os.is.Desktop,
xtype: 'contacts',
- ui: 'core-container',
- margin: '0 0 20 0'
+ ui: 'core-container'
}]
}]
}];
diff --git a/classic/src/view/main/MainController.js b/classic/src/view/main/MainController.js
index f846ff07..a060cad1 100644
--- a/classic/src/view/main/MainController.js
+++ b/classic/src/view/main/MainController.js
@@ -8,7 +8,9 @@ Ext.define('NgcpCsc.view.main.MainController', {
unmatchedroute: 'onRouteChange'
},
'*': {
- showmessage: 'showMessage'
+ showmessage: 'showMessage',
+ updateconversationtitle: 'setSectionTitle',
+ setcardheight:'setCardHeight'
}
}
},
@@ -79,6 +81,10 @@ Ext.define('NgcpCsc.view.main.MainController', {
newView.focus();
}
+ me.toggleFilter();
+
+ me.fireEvent('resetFilters');
+
me.lastView = newView;
},
@@ -177,7 +183,7 @@ Ext.define('NgcpCsc.view.main.MainController', {
this.setCurrentView(id);
this.fireEvent('routeChange');
this.setSectionTitle(id);
- if (id == 'inbox' || id == 'pbxconfig/seats' || id == 'pbxconfig/groups' || id == 'pbxconfig/devices') {
+ if (id == 'inbox' || id == 'conversation-with' || id == 'pbxconfig/seats' || id == 'pbxconfig/groups' || id == 'pbxconfig/devices') {
vm.set('headerBarFieldHideState', false);
} else {
vm.set('headerBarFieldHideState', true);
@@ -188,13 +194,19 @@ Ext.define('NgcpCsc.view.main.MainController', {
};
},
- setSectionTitle: function(id) {
+ setSectionTitle: function(id, record) {
var vm = this.getViewModel();
var title;
switch (id) {
case 'inbox':
title = Ngcp.csc.locales.conversations.title[localStorage.getItem('languageSelected')];
break;
+ case 'conversation-with':
+ if(!record){
+ return;
+ }
+ title = Ngcp.csc.locales.conversationwith.title[localStorage.getItem('languageSelected')] +' '+ record.get('name')
+ break;
case 'addressbook':
title = Ngcp.csc.locales.addressbook.title[localStorage.getItem('languageSelected')];
break;
@@ -306,6 +318,14 @@ Ext.define('NgcpCsc.view.main.MainController', {
return count;
},
+ setCardHeight:function(){
+ var activeTab = this.lookupReference('mainCardPanel').getLayout().getActiveItem();
+ var gridFiltersHeight = this.lookupReference('gridFilters').getHeight();
+ var newHeight = screen.height - (Ext.os.is.Desktop ? 200 : 100) - gridFiltersHeight;
+ activeTab.setHeight(newHeight);
+ this.fireEvent('focusLastMsg')
+ },
+
newSearch: function(el) {
this.fireEvent('newSearchFieldInput', el);
},
diff --git a/classic/src/view/pages/chat/Chat.js b/classic/src/view/pages/chat/Chat.js
deleted file mode 100644
index 66c7007c..00000000
--- a/classic/src/view/pages/chat/Chat.js
+++ /dev/null
@@ -1,18 +0,0 @@
-Ext.define('NgcpCsc.view.pages.chat.Chat', {
- extend: 'Ext.panel.Panel',
-
- xtype: 'chat',
-
- layout: 'fit',
-
- defaults: {
- margin: 10
- },
-
- initComponent: function() {
- this.items = [{
- xtype: 'chatcontainer'
- }];
- this.callParent();
- }
-});
diff --git a/classic/src/view/pages/chat/ChatContainer.js b/classic/src/view/pages/chat/ChatContainer.js
deleted file mode 100644
index 6ef1ebc5..00000000
--- a/classic/src/view/pages/chat/ChatContainer.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// CHAT
-// . when call, sms or fax are sent/triggered add entry in chat
-// . when chat is opened, display topbar (add fax, sms, call to chat data)
-// . create multiple submit text btn (chat, sms, call)
-// . change how contacts look like in mobile
-// . chat should not be a tabpanel anymore
-// . apply filters on conversationwith
-// . clicking on user in chat opens conversationwith
-// . rename the module from chat to conversationwith
-Ext.define('NgcpCsc.view.pages.chat.ChatContainer', {
- extend: 'Ext.tab.Panel',
- xtype: 'chatcontainer',
- cls: 'chat-container',
- plugins: 'tabreorderer',
- viewModel: 'chat',
- controller: 'chat',
- title: null,
- listeners: {
- remove: 'tabRemoved'
- },
- dockedItems: [{
- xtype: 'toolbar',
- reference: 'chat-bottom-bar',
- cls: 'new-message-cont',
- fixed: true,
- margin: '0 5 5 5',
- dock: 'bottom',
- hidden: true,
- layout: {
- type: 'hbox',
- align: 'stretch'
- },
- items: [{
- xtype: 'textarea',
- bind: {
- value: '{message.new_message}'
- },
- cls: 'new-message',
- name: 'new-message',
- enableKeyEvents: true,
- height: 100,
- flex: 8,
- emptyText: Ngcp.csc.locales.chat.msg_box.empty_text[localStorage.getItem('languageSelected')],
- listeners: {
- keypress: 'onPressEnter'
- }
- }, {
- flex: 1,
- xtype: 'button',
- iconCls: 'fa fa-send',
- cls: 'submit-new-message',
- handler: 'onPressSubmitBtn'
- }]
- }]
-})
diff --git a/classic/src/view/pages/chat/ChatController.js b/classic/src/view/pages/chat/ChatController.js
deleted file mode 100644
index 6da26b1d..00000000
--- a/classic/src/view/pages/chat/ChatController.js
+++ /dev/null
@@ -1,135 +0,0 @@
-Ext.define('NgcpCsc.view.pages.chat.ChatController', {
- extend: 'Ext.app.ViewController',
-
- alias: 'controller.chat',
-
- listen: {
- controller: {
- '#contacts': {
- openpmtab: 'openPM',
- openchanneltab: 'openChat',
- destroytab: 'closeChat'
- },
- '*': {
- togglechat: 'toggleChat'
- }
- }
- },
-
- onPressEnter: function(field, e) {
- if (!e.shiftKey && e.getKey() == e.ENTER) {
- e.preventDefault();
- this.submitMessage();
- }
- },
-
- onPressSubmitBtn: function(field, e) {
- this.submitMessage();
- },
-
- submitMessage: function(msg, user) {
- var message = msg || this.getViewModel().get('message.new_message');
- if (message.length < 1 || !this.getView().getActiveTab()) {
- return;
- }
- var chatStore = this.getView().getActiveTab().getStore('notifications');
- var lastMsg = chatStore.getAt(chatStore.getCount() - 1) || this.getViewModel().getStore('notifications').findRecord('id', this.getView().getActiveTab().name);
- var date = new Date();
- var minutes = date.getMinutes();
- var hour = date.getHours();
- var day = date.getDate();
- var month = date.getMonth() + 1;
- var messageModel = Ext.create('NgcpCsc.model.ChatNotification', {
- /// "id": (user) ? user.get('id') : 0,
- "name": (user) ? user.get('name') : localStorage.getItem('username'),
- "date": Ext.String.format("{0}.{1}", day, month),
- "isActive": true,
- "time": Ext.String.format("{0}:{1}", hour, minutes),
- "thumbnail": (user) ? user.get('thumbnail') : "resources/images/user-profile/2.png",
- "content": message.replace(/(?:\r\n|\r|\n)/g, '
')
- });
- chatStore.add(messageModel);
- this.clearMsg();
- this.focusLastMsg();
- },
-
- clearMsg: function() {
- this.getView().down('[name=new-message]').reset();
- },
-
- focusLastMsg: function(rec) {
- var chatCmp = this.getView().getActiveTab();
- chatCmp.scrollTo(0, chatCmp.getEl().dom.scrollHeight);
- },
-
- openPM: function(item, rec) {
- var tab = this.getView().down('[name=' + rec.get('uid') + ']');
- if (rec.get('name') == 'administrator') // hardcoded administrator
- return;
- if (!tab) {
- tab = this.getView().add({
- xtype: 'chat-notifications',
- title: rec.get('name'),
- closable: true,
- scrollable: true,
- cls: 'private-conversation-text',
- deferEmptyText: false,
- emptyText: Ext.String.format(Ngcp.csc.locales.chat.start_conversation[localStorage.getItem('languageSelected')], rec.get('name')),
- name: rec.get('uid'),
- store: Ext.create('Ext.data.Store', {
- model: 'NgcpCsc.model.ChatNotification'
- })
- });
- }
- this.getView().setActiveTab(tab);
- this.toggleTextArea(true);
- this.redirectTo('conversation-with');
-
- },
- openChat: function(rec) {
- var tab = this.getView().down('[name=' + rec.get('name') + ']');
- var messages = Ext.create('NgcpCsc.store.Chat');
- messages.load({callback:function(records){
- Ext.each(records, function(message){
- if(!rec.findChild('uid',message.get('uid'))){
- messages.remove(message);
- }
- });
- }});
- if (!tab) {
- tab = this.getView().add({
- xtype: 'chat-notifications',
- title: rec.get('name'),
- name: rec.get('name'),
- closable: true,
- emptyText: Ngcp.csc.locales.chat.start_group_conversation[localStorage.getItem('languageSelected')],
- store: messages
- });
- }
- this.getView().setActiveTab(tab);
- this.toggleTextArea(true);
- },
-
- closeChat: function(tabToClose) {
- var tabToClose = this.getView().down('[name=' + tabToClose + ']');
- var contacts = this.getView().down('#contacts');
- if (tabToClose) {
- tabToClose.destroy();
- }
- if(contacts){
- contacts.getView().refresh()
- }
- },
-
- tabRemoved: function(tabP){
- this.toggleTextArea(tabP.items.length > 0);
- },
-
- toggleChat: function(visible) {
- this.getViewModel().set('messages.chatEnabled', visible);
- },
-
- toggleTextArea: function(visible){
- this.lookupReference('chat-bottom-bar').setVisible(visible);
- }
-});
diff --git a/classic/src/view/pages/chat/ChatModel.js b/classic/src/view/pages/chat/ChatModel.js
deleted file mode 100644
index ce63a8d1..00000000
--- a/classic/src/view/pages/chat/ChatModel.js
+++ /dev/null
@@ -1,13 +0,0 @@
-Ext.define('NgcpCsc.view.pages.chat.ChatModel', {
- extend: 'Ext.app.ViewModel',
- alias: 'viewmodel.chat',
- links: {
- message: {
- type: 'NgcpCsc.model.Chat',
- id: Ext.id()
- }
- },
- stores: {
- notifications: 'Chat'
- }
-});
diff --git a/classic/src/view/pages/chat/ChatNotifications.js b/classic/src/view/pages/chat/ChatNotifications.js
deleted file mode 100644
index d95852af..00000000
--- a/classic/src/view/pages/chat/ChatNotifications.js
+++ /dev/null
@@ -1,26 +0,0 @@
-Ext.define('NgcpCsc.view.pages.chat.ChatNotifications', {
- extend: 'Ext.DataView',
- xtype: 'chat-notifications',
-
- cls: 'user-notifications',
-
- listeners: {
- itemclick: 'openPM'
- },
-
- itemTpl: [
- "
{text}
", + "
{name}
", - "{time} {date}", - "", // hide the private message button in case the message comes from the user (in this case _d = 0); - "", - "", - "