Improved cti caller list layout (more for humans).

This commit is contained in:
Martin Edenhofer 2016-04-27 14:35:36 +02:00
parent c747c0c1f1
commit d0fded9875
3 changed files with 42 additions and 15 deletions

View file

@ -63,16 +63,17 @@ class App.CTI extends App.Controller
) )
notify: (data) -> notify: (data) ->
App.Event.trigger 'notify', { text = App.i18n.translateContent('Call from %s for %s', data.from_comment || data_from, data.to_comment || data.to)
type: 'notice' title = App.Utils.html2text(text.replace(/<.+?>/g, '"'))
msg: App.i18n.translateContent('Call from %s for %s', data.from, data.to) @notifyDesktop(
timeout: 12000 url: '#cti'
} title: title
)
App.OnlineNotification.play()
featureActive: => featureActive: =>
return true return true
if @Config.get('sipgate_integration') return true if @Config.get('sipgate_integration')
return true
false false
render: -> render: ->
@ -98,6 +99,30 @@ class App.CTI extends App.Controller
"#{mins}:#{secs}" "#{mins}:#{secs}"
for item in @list 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 if item.start && item.end
item.duration = format((Date.parse(item.end) - Date.parse(item.start))/1000) item.duration = format((Date.parse(item.end) - Date.parse(item.start))/1000)
@html App.view('cti/index')( @html App.view('cti/index')(
@ -121,7 +146,11 @@ class App.CTI extends App.Controller
@navupdate '#cti' @navupdate '#cti'
counter: => counter: =>
@meta.counter count = 0
for item in @list
if item.state is 'hangup' && !item.done
count++
@meta.counter + count
switch: (state = undefined) => switch: (state = undefined) =>

View file

@ -8,9 +8,8 @@
<th style="width: 28px;"></th> <th style="width: 28px;"></th>
<th><%- @T('From') %></th> <th><%- @T('From') %></th>
<th><%- @T('To') %></th> <th><%- @T('To') %></th>
<th><%- @T('State') %></th> <th style="width: 200px;"></th>
<th><%- @T('Comment') %></th> <th style="width: 100px;"><%- @T('Duration') %></th>
<th><%- @T('Duration') %></th>
<th><%- @T('Time') %></th> <th><%- @T('Time') %></th>
</tr> </tr>
</thead> </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.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.from_comment: %><%= item.from_comment %><br><% end %><%= item.from %></td>
<td><% if item.to_comment: %><%= item.to_comment %><br><% end %><%= item.to %></td> <td><% if item.to_comment: %><%= item.to_comment %><br><% end %><%= item.to %></td>
<td><%= item.state %></td> <td><%- @T(item.state_human) %></td>
<td><%= item.comment %></td>
<td><%= item.duration %></td> <td><%= item.duration %></td>
<td><%- @humanTime(item.created_at) %></td> <td><%- @humanTime(item.created_at) %></td>
</tr> </tr>

View file

@ -11,9 +11,9 @@ module Cti
Cti::Log.create( Cti::Log.create(
direction: 'in', direction: 'in',
from: '007', from: '007',
from_comment: '', from_comment: 'AAA',
to: '008', to: '008',
to_comment: '', to_comment: 'BBB',
call_id: '1', call_id: '1',
comment: '', comment: '',
state: 'newCall', state: 'newCall',