TT#10032 ngccp-csc Conversation with module

- renaming
- layout adjusted
- data added
- entry items on sms/fax/call triggered
- trigger call from conversation-with
- applied filters

Change-Id: Ia6d9c3a57e0fd35f710ab202d684498a48d54b6e
changes/41/11741/18
Carlo 8 years ago
parent 138166f39a
commit 8d69e694aa

@ -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',

@ -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'
}
}
});

@ -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']
});

@ -0,0 +1,5 @@
Ext.define('NgcpCsc.model.Notification', {
extend: 'Ext.data.Model',
fields: ['id', 'conversation_type', 'status', 'text', 'direction', 'start_time']
});

@ -2,7 +2,7 @@ Ext.define('NgcpCsc.model.VoiceMail', {
extend: 'Ext.data.Model',
fields: [{
name: 'caller',
name: 'callee',
type: 'string'
}, {
name: 'duration',

@ -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'
}
}
});

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

@ -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'
}
}
});

@ -201,7 +201,7 @@
}
}
.section-container {
padding-bottom:25px;
padding-bottom:5px;
}
.logo {

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

@ -21,7 +21,7 @@
padding: 16px;
}
.caller {
.callee {
font-size: 16px;
}

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

@ -18,7 +18,7 @@ Ext.define('NgcpCsc.Application', {
'Conversations',
'ConversationTypes',
'VoiceMails',
'Chat',
'Notifications',
'Contacts',
'Languages',
'CallBlockingOutgoing',

@ -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}'

@ -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 () {

@ -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')]);
}
});

@ -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';
}
}
});

@ -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'
}]
}]

@ -1,5 +1,5 @@
Ext.define('NgcpCsc.view.common.composer.Sms', {
extend: 'Ext.panel.Panel',
extend: 'Ext.form.Panel',
alias: 'widget.sms-composer',

@ -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'
}]
}]
}];

@ -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);
},

@ -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();
}
});

@ -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'
}]
}]
})

@ -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, '<br />')
});
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);
}
});

@ -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'
}
});

@ -1,26 +0,0 @@
Ext.define('NgcpCsc.view.pages.chat.ChatNotifications', {
extend: 'Ext.DataView',
xtype: 'chat-notifications',
cls: 'user-notifications',
listeners: {
itemclick: 'openPM'
},
itemTpl: [
"<div class='comments'>",
"<img src='{thumbnail}' alt='' class='profile-icon'>",
"<div class='content-wrap'>",
"<div>",
"<h4 class='profilenotifications-username'>{name}</h4>",
"<span class='from-now'><span class='x-fa fa-clock-o'></span>{time} {date}",
"<span class='like-comment-btn-wrap'>", // hide the private message button in case the message comes from the user (in this case _d = 0);
"<button type='button' id='{name}' class='x-fa fa-comments {[values.name === 'administrator' ? 'hide-pm' : '']}'></button>",
"</span></span>",
"</div>",
"<div class='content'>{content}</div>",
"</div>",
"</div>"
]
});

@ -15,11 +15,11 @@ Ext.define('NgcpCsc.view.pages.contacts.Contacts', {
rootVisible: false,
scrollable:true,
scrollable: true,
collapsible:true,
collapsible: true,
collapseDirection:'left',
collapseDirection: 'left',
title: Ngcp.csc.locales.contacts.title[localStorage.getItem('languageSelected')],
@ -41,14 +41,14 @@ Ext.define('NgcpCsc.view.pages.contacts.Contacts', {
items: [{
xtype: 'button',
name: 'showNewChatBtn',
text: Ngcp.csc.locales.chat.new_group[localStorage.getItem('languageSelected')],
text: Ngcp.csc.locales.conversationwith.new_group[localStorage.getItem('languageSelected')],
handler: 'showCreationFields',
align:'right'
},{
align: 'right'
}, {
xtype: 'textfield',
name: 'newChatName',
hidden: true,
emptyText: Ngcp.csc.locales.chat.provide_name[localStorage.getItem('languageSelected')],
emptyText: Ngcp.csc.locales.conversationwith.provide_name[localStorage.getItem('languageSelected')],
minLength: 1,
enableKeyEvents: true,
listeners: {
@ -66,7 +66,8 @@ Ext.define('NgcpCsc.view.pages.contacts.Contacts', {
name: 'commitChangesBtn',
text: Ngcp.csc.locales.common.done[localStorage.getItem('languageSelected')],
handler: 'save',
hidden: true
hidden: true,
margin: '0 10 40 0'
}],
defaults: {

@ -3,8 +3,25 @@ Ext.define('NgcpCsc.view.pages.contacts.ContactsController', {
alias: 'controller.contacts',
listen: {
controller: {
'*': {
collapseContacts: 'collapseContacts',
expandContacts: 'expandContacts'
}
}
},
id: 'contacts', // needed as reference in ChatController listeners
collapseContacts:function(){
this.getView().collapse();
},
expandContacts:function(){
this.getView().expand();
},
renderStatus: function(val, meta, rec) {
if (rec.get('leaf')) {
rec.set('iconCls', 'x-fa fa-circle ' + (rec.get('online') ? 'online-user' : 'offline-user'));
@ -63,7 +80,7 @@ Ext.define('NgcpCsc.view.pages.contacts.ContactsController', {
var newChatName = tbar.down('[name=newChatName]');
var newChatBtn = tbar.down('[name=newChatBtn]');
if (newChatName.getValue().length < 1) {
this.fireEvent('showmessage', false, Ngcp.csc.locales.chat.alerts.choose_valid_name[localStorage.getItem('languageSelected')]);
this.fireEvent('showmessage', false, Ngcp.csc.locales.conversationwith.alerts.choose_valid_name[localStorage.getItem('languageSelected')]);
return;
}
@ -74,7 +91,7 @@ Ext.define('NgcpCsc.view.pages.contacts.ContactsController', {
"children": []
});
contacts.getStore().sort('online', 'DESC');
this.fireEvent('showmessage', true, Ngcp.csc.locales.chat.alerts.channel_created[localStorage.getItem('languageSelected')]);
this.fireEvent('showmessage', true, Ngcp.csc.locales.conversationwith.alerts.channel_created[localStorage.getItem('languageSelected')]);
createGroupBtn.show();
newChatName.hide();
newChatBtn.hide();
@ -100,13 +117,16 @@ Ext.define('NgcpCsc.view.pages.contacts.ContactsController', {
this.fireEvent('initrtc', record, 'startVideoCall', true);
},
nodeClicked: function(node, record, item, index, e) {
var me = this;
if (record.get('checked') != null || record.get('name') == 'Buddies')
return;
this.redirectTo('conversation-with');
if (!record.get('leaf'))
this.fireEvent('openchanneltab', record);
else
this.fireEvent('openpmtab', null, record);
this.fireEvent('updateconversationtitle', 'conversation-with', record);
if (record.get('leaf')){
this.redirectTo('conversation-with');
Ext.Function.defer(function(){
me.fireEvent('openpmtab', null, record);
}, 100);
}
return false;
},
deleteNode: function(grid, rowIndex, colIndex, item, ev) {
@ -115,7 +135,7 @@ Ext.define('NgcpCsc.view.pages.contacts.ContactsController', {
if (nodeToDelete.get('leaf'))
return;
Ext.Msg.show({
message: Ext.String.format(Ngcp.csc.locales.chat.alerts.channel_delete[localStorage.getItem('languageSelected')], nodeToDelete.get('name')),
message: Ext.String.format(Ngcp.csc.locales.conversationwith.alerts.channel_delete[localStorage.getItem('languageSelected')], nodeToDelete.get('name')),
buttons: Ext.Msg.YESNO,
icon: Ext.Msg.QUESTION,
fn: function(btn) {

@ -9,53 +9,7 @@ Ext.define('NgcpCsc.view.pages.conversations.Conversations', {
initComponent: function() {
this.dockedItems = [{
xtype: 'toolbar',
dock: 'top',
layout: 'center',
ui: 'conversations-actions-tbar',
items: [{
xtype: 'core-container',
margin: Ext.os.is.Desktop ? '-5 0 0 35' : '-5 0 0 15',
width: Ext.os.is.Desktop ? 810 : '100%',
layout: {
type: 'hbox',
align: 'stretch'
},
defaults: {
xtype: 'button',
flex: 1,
iconAlign: 'top',
scale: 'medium',
ui: 'conversations-actions-btn'
},
items: [{
text: Ngcp.csc.locales.conversations.btns.new_sms[localStorage.getItem('languageSelected')],
itemId: 'newSms',
iconCls: 'x-fa fa-envelope fa',
overCls: 'conversations-btn-over',
margin: '0 20 0 0',
handler: 'composeSms',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_sms[localStorage.getItem('languageSelected')]
}, {
text: Ngcp.csc.locales.conversations.btns.new_call[localStorage.getItem('languageSelected')],
itemId: 'newCall',
iconCls: 'x-fa fa-phone fa',
overCls: 'conversations-btn-over',
margin: '0 20 0 0',
handler: 'composeCall',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_call[localStorage.getItem('languageSelected')]
}, {
text: Ngcp.csc.locales.conversations.btns.new_fax[localStorage.getItem('languageSelected')],
itemId: 'newfax',
iconCls: 'x-fa fa-file-text fa',
overCls: 'conversations-btn-over',
handler: 'composeFax',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_fax[localStorage.getItem('languageSelected')]
}]
}]
}];
this.dockedItems = Ext.create('NgcpCsc.view.pages.conversations.ConversationsToolbar');
this.items = [{
xtype: 'conversations-grid',

@ -1,8 +1,10 @@
Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
extend: 'NgcpCsc.view.pages.account.AccountController',
extend: 'Ext.app.ViewController',
alias: 'controller.conversations',
id:'conversations',
onIconClicked: function(event, el) {
if (el.dataset.callback) {
// eval is never the best option
@ -161,8 +163,8 @@ Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
return '<div class="conv-description">' + desc + '</div>';
},
renderCaller: function(val) {
return '<div class="caller">' + val + '</div>';
renderCallee: function(val) {
return '<div class="callee">' + val + '</div>';
},
removeCard: function(el) {
@ -211,7 +213,12 @@ Ext.define('NgcpCsc.view.pages.conversations.ConversationsController', {
},
startChat: function(el) {
this.fireEvent('initrtc', record, 'startCall');
var record = Ext.getStore('Conversations').findRecord('id', el.id.split('-')[1]);
var me = this;
me.redirectTo('conversation-with');
Ext.Function.defer(function(){
me.fireEvent('openpmtab', null, record, true);
}, 100);
},
composeSms: function() {

@ -54,7 +54,7 @@ Ext.define('NgcpCsc.view.pages.conversations.CallsGrid', {
}, {
text: (this._groupCallsByMonth) ? Ngcp.csc.locales.common.number[localStorage.getItem('languageSelected')] : '',
dataIndex: 'source_cli',
renderer: 'renderCaller',
renderer: 'renderCallee',
flex: 3
}]
},

@ -0,0 +1,47 @@
Ext.define('NgcpCsc.view.pages.conversations.ConversationsToolbar', {
extend: 'Ext.toolbar.Toolbar',
dock: 'top',
layout: 'center',
ui: 'conversations-actions-tbar',
items: [{
xtype: 'core-container',
margin: Ext.os.is.Desktop ? '-5 0 0 35' : '-5 0 0 15',
width: Ext.os.is.Desktop ? 810 : '100%',
layout: {
type: 'hbox',
align: 'stretch'
},
defaults: {
xtype: 'button',
flex: 1,
iconAlign: 'top',
scale: 'medium',
ui: 'conversations-actions-btn'
},
items: [{
text: Ngcp.csc.locales.conversations.btns.new_sms[localStorage.getItem('languageSelected')],
itemId: 'newSms',
iconCls: 'x-fa fa-envelope fa',
overCls: 'conversations-btn-over',
margin: '0 20 0 0',
handler: 'composeSms',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_sms[localStorage.getItem('languageSelected')]
}, {
text: Ngcp.csc.locales.conversations.btns.new_call[localStorage.getItem('languageSelected')],
itemId: 'newCall',
iconCls: 'x-fa fa-phone fa',
overCls: 'conversations-btn-over',
margin: '0 20 0 0',
handler: 'composeCall',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_call[localStorage.getItem('languageSelected')]
}, {
text: Ngcp.csc.locales.conversations.btns.new_fax[localStorage.getItem('languageSelected')],
itemId: 'newfax',
iconCls: 'x-fa fa-file-text fa',
overCls: 'conversations-btn-over',
handler: 'composeFax',
tooltip: Ngcp.csc.locales.conversations.tooltips.new_fax[localStorage.getItem('languageSelected')]
}]
}]
});

@ -0,0 +1,77 @@
Ext.define('NgcpCsc.view.pages.conversationwith.ConversationWith', {
extend: 'Ext.tab.Panel',
xtype: 'conversationwith',
cls: 'conversation-with-container',
plugins: 'tabreorderer',
viewModel: 'conversationwith',
controller: 'conversationwith',
title: null,
scrollable:false,
listeners: {
render: 'hideTabBar'
},
dockedItems: [Ext.create('NgcpCsc.view.pages.conversations.ConversationsToolbar'),
{
xtype: 'toolbar',
dock: 'top',
height:60,
cls: 'toolbar-cont',
items:['->',{
text:'Older',
handler: 'loadOlderMsg'
},'->']
}
, {
xtype: 'toolbar',
reference: 'chat-bottom-bar',
cls: 'toolbar-cont',
fixed: true,
margin: '0 5 5 5',
dock: 'bottom',
items: [{
width: '100%',
xtype: 'panel',
layout: {
type: 'hbox'
},
items: [{
// bind is dynamically set in controller (search for ".setBind")
xtype: 'textfield',
cls: 'new-message',
reference:'newmessage',
enableKeyEvents: true,
flex: 1,
emptyText: Ngcp.csc.locales.conversationwith.msg_box.empty_text[localStorage.getItem('languageSelected')],
listeners: {
keypress: 'onPressEnter'
}
}, {
width:50,
xtype: 'button',
menu: {
defaults:{
handler:'onPressSubmitBtn'
},
items:[{
text: 'Send as SMS',
value:'sms'
}, {
text: 'Send as chat message',
value:'chat'
}]
},
bind:{
iconCls: '{iconcls}'
},
cls: 'submit-new-message'
},{
width:35,
xtype: 'button',
margin : '0 0 0 5',
cls:'rtc-icons',
iconCls: 'x-fa fa-phone',
handler:'onPressCallBtn'
}]
}]
}]
})

@ -0,0 +1,143 @@
Ext.define('NgcpCsc.view.pages.conversationwith.ConversationWithController', {
extend: 'NgcpCsc.view.pages.conversations.ConversationsController',
alias: 'controller.conversationwith',
listen: {
controller: {
'*': {
openpmtab: 'openPM',
destroytab: 'closeChat',
notify: 'submitNotification',
focusLastMsg: 'focusLastMsg'
}
}
},
onPressEnter: function(field, e) {
var vm = this.getViewModel();
var currMsg = this.lookupReference('newmessage').getValue();
var type = vm.get('messagetype');
if (!e.shiftKey && e.getKey() == e.ENTER && currMsg.length > 0) {
e.preventDefault();
this.submitNotification(type);
}
},
onPressSubmitBtn: function(menuitem, ev) {
var currMsg = this.lookupReference('newmessage').getValue();
this.getViewModel().set('messagetype', menuitem.value);
this.getViewModel().set('iconcls', menuitem.value == 'sms' ? 'fa fa-envelope' : 'fa fa-comment');
if (currMsg.length > 0) {
this.submitNotification(menuitem.value);
}
},
onPressCallBtn: function(btn) {
var vm = this.getViewModel();
var contact = Ext.getStore('Contacts').findRecord("uid", vm.get('activeUserId'));
var record = Ext.create('Ext.data.Model', {
id: vm.get('activeUserId'),
callee: vm.get('activeUserName'),
thumbnail: contact ? contact.get('thumbnail') : null
});
this.fireEvent('initrtc', record, 'startCall', false, true);
},
hideTabBar: function(panel) {
panel.getTabBar().hide();
},
submitNotification: function(type, msg) {
var vm = this.getViewModel();
var chatStore = this.getView().getActiveTab().getStore('Notifications');
var messageModel = Ext.create('NgcpCsc.model.Notification', {
"id": Ext.id(),
"conversation_type": type || vm.get('messagetype'),
"direction": "outgoing",
"status": "answered",
"text": (type && ['sms', 'chat'].indexOf(type) > -1) ? msg || this.lookupReference('newmessage').getValue() : '',
"start_time": Date.now()
});
chatStore.add(messageModel);
this.clearMsg();
this.focusLastMsg();
},
clearMsg: function() {
this.lookupReference('newmessage').reset();
},
focusLastMsg: function() {
var chatCmp = this.getView().getActiveTab();
if (chatCmp) {
chatCmp.getEl().scroll('b', Infinity);
}
},
loadOlderMsg: function(btn) {
var chatCmp = this.getView().getActiveTab();
chatCmp.getEl().scroll('t', Infinity, true);
},
openPM: function(item, rec, focusTextarea) {
var id = rec.get('uid') || rec.get('id');
var tab = this.getView().down('[name=' + id + ']');
var me = this;
var vm = this.getViewModel();
var textArea = this.lookupReference('newmessage');
if (!tab) {
vm.set('newmessage-' + id, '');
tab = this.getView().add({
xtype: 'notifications',
title: rec.get('name'),
closable: false,
cls: 'private-conversation-text',
deferEmptyText: false,
emptyText: Ext.String.format(Ngcp.csc.locales.conversationwith.start_conversation[localStorage.getItem('languageSelected')], rec.get('name')),
name: id,
store: Ext.create('NgcpCsc.store.Notifications', {
autoLoad: !!rec.get('uid'), // when new call/sms/fax is triggered the callback has no uid ( = user id from contacts), so the conversation is new and should not have logs => prevents autoload (TODO remove when API is available)
listeners: {
beforeload: function(store) {
me.updateProxy(store, id);
},
load: function() {
me.focusLastMsg();
}
}
})
});
}
textArea.setBind({
value: '{newmessage-' + id + '}'
});
me.getView().setActiveTab(tab);
me.focusLastMsg();
vm.set('activeUserName', rec.get('name') || rec.get('callee'));
vm.set('activeUserId', id);
if (focusTextarea) {
textArea.focus();
vm.set('messagetype', 'chat');
vm.set('iconcls', 'fa fa-comment');
}
},
// (only for prototyping) change randomly the read url to retrieve different json
updateProxy: function(store, uid) {
var filename = uid + '.json';
store.proxy.url = store.proxy.baseUrl + filename;
},
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()
}
}
});

@ -0,0 +1,13 @@
Ext.define('NgcpCsc.view.pages.conversationwith.ConversationWithModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.conversationwith',
data:{
messagetype:'chat',
iconcls:'fa fa-comment',
activeUserName:'',
activeUserId:''
},
stores: {
notifications: 'Notifications'
}
});

@ -0,0 +1,23 @@
Ext.define('NgcpCsc.view.pages.conversationwith.Notifications', {
extend: 'Ext.DataView',
xtype: 'notifications',
cls: 'user-notifications',
scrollable: true,
disableSelection: true,
itemTpl: [
"<div class='notification'>",
"<div class='{conversation_type}-icon'></div>",
"<div class='{direction}-{status}-icon'></div>",
"<div>{[Ngcp.csc.formatter.timeSince(values.start_time)]} " + Ngcp.csc.locales.common.ago[localStorage.getItem('languageSelected')] + "</div>",
"<div class='text'>",
"<tpl if='conversation_type == \"sms\" || conversation_type == \"chat\"'>",
"<p>{text}</p>",
"</tpl>",
"</div>",
"</div>"
]
});

@ -1,30 +0,0 @@
{
"data": [{
"uid": 840,
"name": "Jil Sanchez",
"date": "10/27/2016",
"isActive": true,
"number": "439911233",
"time": "13:42",
"thumbnail": "resources/images/user-profile/9.png",
"content": "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don\'t look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn\'t anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc."
}, {
"uid": 252,
"name": "Ben Wright",
"date": "10/27/2010",
"number": "141423442",
"isActive": true,
"time": "14:03",
"thumbnail": "resources/images/user-profile/10.png",
"content": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
}, {
"uid": 162,
"name": "Allen Morris",
"date": "10/27/2016",
"number": "23423423234",
"isActive": true,
"time": "4:57",
"thumbnail": "resources/images/user-profile/11.png",
"content": "There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don\'t look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn\'t anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc."
}]
}

@ -6,31 +6,37 @@
"uid": 840,
"online": true,
"name": "Jil Sanchez",
"thumbnail": "resources/images/user-profile/9.png",
"leaf": true
}, {
"uid": 1,
"online": false,
"name": "Oneill Franklin",
"thumbnail": "resources/images/user-profile/6.png",
"leaf": true
}, {
"uid": 3,
"online": false,
"name": "Branch Allison",
"thumbnail": "resources/images/user-profile/8.png",
"leaf": true
}, {
"uid": 252,
"online": true,
"name": "Ben Wright",
"thumbnail": "resources/images/user-profile/10.png",
"leaf": true
}, {
"uid": 162,
"online": true,
"name": "Allen Morris",
"thumbnail": "resources/images/user-profile/11.png",
"leaf": true
}, {
"uid": 5,
"online": false,
"name": "Suzette Powell",
"thumbnail": "resources/images/user-profile/7.png",
"leaf": true
}]
}, {
@ -41,21 +47,25 @@
"uid": 162,
"online": true,
"name": "Allen Morris",
"thumbnail": "resources/images/user-profile/11.png",
"leaf": true
},{
"uid": 840,
"online": true,
"name": "Jil Sanchez",
"thumbnail": "resources/images/user-profile/9.png",
"leaf": true
},{
"uid": 252,
"online": true,
"name": "Ben Wright",
"thumbnail": "resources/images/user-profile/10.png",
"leaf": true
}, {
"uid": 5,
"online": false,
"name": "Suzette Powell",
"thumbnail": "resources/images/user-profile/7.png",
"leaf": true
}]
}, {
@ -66,11 +76,13 @@
"uid": 162,
"online": true,
"name": "Allen Morris",
"thumbnail": "resources/images/user-profile/11.png",
"leaf": true
}, {
"uid": 5,
"online": false,
"name": "Suzette Powell",
"thumbnail": "resources/images/user-profile/7.png",
"leaf": true
}]
}]

@ -0,0 +1,105 @@
{
"data": [{
"id": 5,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-01-10T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 4,
"conversation_type": "chat",
"text": "This is a chat message. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-01-30T10:05:33.384000000+02:00"
}, {
"id": 3,
"conversation_type": "sms",
"text": "This is an sms. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-01-31T10:05:33+02:00"
}, {
"id": 2,
"conversation_type": "call",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-02-09T10:05:33.384000000+02:00"
}, {
"id": 1,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-02-09T12:05:33.384000000+02:00"
}, {
"id": 15,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-03T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 14,
"conversation_type": "chat",
"text": "This is a chat message. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-04T10:05:33.384000000+02:00"
}, {
"id": 13,
"conversation_type": "sms",
"text": "This is an sms. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-05T10:05:33+02:00"
}, {
"id": 12,
"conversation_type": "call",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-06T10:05:33.384000000+02:00"
}, {
"id": 11,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T12:05:33.384000000+02:00"
}, {
"id": 25,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-07T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 24,
"conversation_type": "chat",
"text": "This is a chat message. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-07T11:05:33.384000000+02:00"
}, {
"id": 23,
"conversation_type": "sms",
"text": "This is an sms. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-07T12:05:33+02:00"
}, {
"id": 22,
"conversation_type": "call",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-07T13:05:33.384000000+02:00"
}, {
"id": 21,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T14:05:33.384000000+02:00"
}]
}

@ -0,0 +1,25 @@
{
"data": [{
"id": 5,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-01-10T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 4,
"conversation_type": "chat",
"text": "This is a chat message. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-01-30T10:05:33.384000000+02:00"
}, {
"id": 3,
"conversation_type": "sms",
"text": "This is an sms. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-01-31T10:05:33+02:00"
}]
}

@ -0,0 +1,15 @@
{
"data": [{
"id": 22,
"conversation_type": "call",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-07T13:05:33.384000000+02:00"
}, {
"id": 21,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T14:05:33.384000000+02:00"
}]
}

@ -0,0 +1,58 @@
{
"data": [{
"id": 5,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-01-10T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 2,
"conversation_type": "call",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-02-09T10:05:33.384000000+02:00"
}, {
"id": 15,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-03T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 12,
"conversation_type": "call",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-06T10:05:33.384000000+02:00"
}, {
"id": 11,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T12:05:33.384000000+02:00"
}, {
"id": 25,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-07T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 23,
"conversation_type": "sms",
"text": "This is an sms. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-07T12:05:33+02:00"
}, {
"id": 21,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T14:05:33.384000000+02:00"
}]
}

@ -0,0 +1,30 @@
{
"data": [{
"id": 2,
"conversation_type": "call",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-02-09T10:05:33.384000000+02:00"
}, {
"id": 1,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-02-09T12:05:33.384000000+02:00"
}, {
"id": 15,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-03T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 14,
"conversation_type": "chat",
"text": "This is a chat message. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-04T10:05:33.384000000+02:00"
}]
}

@ -0,0 +1,37 @@
{
"data": [{
"id": 15,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-03-03T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 14,
"conversation_type": "chat",
"text": "This is a chat message. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-04T10:05:33.384000000+02:00"
},{
"id": 11,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T12:05:33.384000000+02:00"
}, {
"id": 24,
"conversation_type": "chat",
"text": "This is a chat message. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
"direction": "incoming",
"status": "answered",
"start_time": "2017-03-07T11:05:33.384000000+02:00"
}, {
"id": 21,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T14:05:33.384000000+02:00"
}]
}

@ -0,0 +1,17 @@
{
"data": [{
"id": 5,
"conversation_type": "fax",
"source_cli": "+390290775544",
"status": "missed",
"direction": "outgoing",
"start_time": "2017-01-10T10:05:33.384000000+02:00",
"pages": "7"
}, {
"id": 21,
"conversation_type": "voicemail",
"status": "answered",
"direction": "incoming",
"start_time": "2017-03-07T14:05:33.384000000+02:00"
}]
}
Loading…
Cancel
Save