Improved cti caller list layout (more for humans).
This commit is contained in:
parent
c747c0c1f1
commit
d0fded9875
3 changed files with 42 additions and 15 deletions
|
@ -63,16 +63,17 @@ class App.CTI extends App.Controller
|
|||
)
|
||||
|
||||
notify: (data) ->
|
||||
App.Event.trigger 'notify', {
|
||||
type: 'notice'
|
||||
msg: App.i18n.translateContent('Call from %s for %s', data.from, data.to)
|
||||
timeout: 12000
|
||||
}
|
||||
text = App.i18n.translateContent('Call from %s for %s', data.from_comment || data_from, data.to_comment || data.to)
|
||||
title = App.Utils.html2text(text.replace(/<.+?>/g, '"'))
|
||||
@notifyDesktop(
|
||||
url: '#cti'
|
||||
title: title
|
||||
)
|
||||
App.OnlineNotification.play()
|
||||
|
||||
featureActive: =>
|
||||
return true
|
||||
if @Config.get('sipgate_integration')
|
||||
return true
|
||||
return true if @Config.get('sipgate_integration')
|
||||
false
|
||||
|
||||
render: ->
|
||||
|
@ -98,6 +99,30 @@ class App.CTI extends App.Controller
|
|||
"#{mins}:#{secs}"
|
||||
|
||||
for item in @list
|
||||
if item.state is 'newCall'
|
||||
item.state_human = 'ringing'
|
||||
else if item.state is 'answer'
|
||||
item.state_human = 'connected'
|
||||
else if item.state is 'hangup'
|
||||
if item.comment is 'cancel'
|
||||
item.state_human = 'not reached'
|
||||
else if item.comment is 'noAnswer'
|
||||
item.state_human = 'not reached'
|
||||
else if item.comment is 'congestion'
|
||||
item.state_human = 'not reached'
|
||||
else if item.comment is 'busy'
|
||||
item.state_human = 'busy'
|
||||
else if item.comment is 'notFound'
|
||||
item.state_human = 'not exist'
|
||||
else if item.comment is 'normalClearing'
|
||||
item.state_human = ''
|
||||
else
|
||||
item.state_human = item.comment
|
||||
else
|
||||
item.state_human = item.state
|
||||
if item.comment
|
||||
item.state_human += ", #{item.comment}"
|
||||
|
||||
if item.start && item.end
|
||||
item.duration = format((Date.parse(item.end) - Date.parse(item.start))/1000)
|
||||
@html App.view('cti/index')(
|
||||
|
@ -121,7 +146,11 @@ class App.CTI extends App.Controller
|
|||
@navupdate '#cti'
|
||||
|
||||
counter: =>
|
||||
@meta.counter
|
||||
count = 0
|
||||
for item in @list
|
||||
if item.state is 'hangup' && !item.done
|
||||
count++
|
||||
@meta.counter + count
|
||||
|
||||
switch: (state = undefined) =>
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
<th style="width: 28px;"></th>
|
||||
<th><%- @T('From') %></th>
|
||||
<th><%- @T('To') %></th>
|
||||
<th><%- @T('State') %></th>
|
||||
<th><%- @T('Comment') %></th>
|
||||
<th><%- @T('Duration') %></th>
|
||||
<th style="width: 200px;"></th>
|
||||
<th style="width: 100px;"><%- @T('Duration') %></th>
|
||||
<th><%- @T('Time') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -20,8 +19,7 @@
|
|||
<td><% if item.state is 'hangup': %><input type="checkbox" class="js-check" <% if item.done: %>checked<% end %>><% end %>
|
||||
<td><% if item.from_comment: %><%= item.from_comment %><br><% end %><%= item.from %></td>
|
||||
<td><% if item.to_comment: %><%= item.to_comment %><br><% end %><%= item.to %></td>
|
||||
<td><%= item.state %></td>
|
||||
<td><%= item.comment %></td>
|
||||
<td><%- @T(item.state_human) %></td>
|
||||
<td><%= item.duration %></td>
|
||||
<td><%- @humanTime(item.created_at) %></td>
|
||||
</tr>
|
||||
|
|
|
@ -11,9 +11,9 @@ module Cti
|
|||
Cti::Log.create(
|
||||
direction: 'in',
|
||||
from: '007',
|
||||
from_comment: '',
|
||||
from_comment: 'AAA',
|
||||
to: '008',
|
||||
to_comment: '',
|
||||
to_comment: 'BBB',
|
||||
call_id: '1',
|
||||
comment: '',
|
||||
state: 'newCall',
|
||||
|
|
Loading…
Reference in a new issue