Fixed issue #681 - Keep modal open on call log event.
This commit is contained in:
parent
f2d969a6e3
commit
4d7f3c1e6a
3 changed files with 108 additions and 100 deletions
|
@ -1,18 +1,19 @@
|
|||
class App.CTI extends App.Controller
|
||||
elements:
|
||||
'.js-callerLog': 'callerLog'
|
||||
events:
|
||||
'click .js-check': 'done',
|
||||
'click .js-check': 'done'
|
||||
'click .js-userNew': 'userNew'
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
@list = []
|
||||
@backends = []
|
||||
@meta =
|
||||
list: []
|
||||
backends: []
|
||||
meta:
|
||||
active: false
|
||||
counter: 0
|
||||
state: {}
|
||||
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
preferences = @Session.get('preferences') || {}
|
||||
@meta.active = preferences.cti || false
|
||||
|
||||
|
@ -41,13 +42,16 @@ class App.CTI extends App.Controller
|
|||
@backends = data.backends
|
||||
if data.list
|
||||
@list = data.list
|
||||
if @renderDone
|
||||
@renderCallerLog()
|
||||
return
|
||||
@render()
|
||||
|
||||
'cti_list_push'
|
||||
)
|
||||
@bind('auth', (data) =>
|
||||
@meta.counter = 0
|
||||
)
|
||||
|
||||
@bind('cti:reload', =>
|
||||
@load()
|
||||
'cti_reload'
|
||||
|
@ -80,6 +84,9 @@ class App.CTI extends App.Controller
|
|||
@backends = data.backends
|
||||
if data.list
|
||||
@list = data.list
|
||||
if @renderDone
|
||||
@renderCallerLog()
|
||||
return
|
||||
@render()
|
||||
)
|
||||
|
||||
|
@ -96,6 +103,7 @@ class App.CTI extends App.Controller
|
|||
false
|
||||
|
||||
render: ->
|
||||
@renderDone = true
|
||||
if !@permissionCheck('cti.agent')
|
||||
@renderScreenUnauthorized(objectName: 'CTI')
|
||||
return
|
||||
|
@ -113,6 +121,11 @@ class App.CTI extends App.Controller
|
|||
@updateNavMenu()
|
||||
return
|
||||
|
||||
@html App.view('cti/index')()
|
||||
@renderCallerLog()
|
||||
@updateNavMenu()
|
||||
|
||||
renderCallerLog: ->
|
||||
format = (time) ->
|
||||
|
||||
# Hours, minutes and seconds
|
||||
|
@ -152,11 +165,8 @@ class App.CTI extends App.Controller
|
|||
item.duration = format((Date.parse(item.end) - Date.parse(item.start))/1000)
|
||||
|
||||
@userPopupsDestroy()
|
||||
@html App.view('cti/index')(
|
||||
list: @list
|
||||
)
|
||||
@callerLog.html( App.view('cti/caller_log')(list: @list))
|
||||
@userPopups()
|
||||
@updateNavMenu()
|
||||
|
||||
done: (e) =>
|
||||
element = $(e.currentTarget)
|
||||
|
|
84
app/assets/javascripts/app/views/cti/caller_log.jst.eco
Normal file
84
app/assets/javascripts/app/views/cti/caller_log.jst.eco
Normal file
|
@ -0,0 +1,84 @@
|
|||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40px;"></th>
|
||||
<th><%- @T('From') %></th>
|
||||
<th><%- @T('To') %></th>
|
||||
<th style="width: 130px;"><%- @T('Status') %></th>
|
||||
<th style="width: 100px;"><%- @T('Duration') %></th>
|
||||
<th style="width: 170px;"><%- @T('Time') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for item in @list: %>
|
||||
<tr <% if item.state is 'hangup' && item.done: %>class="is-grayed-out"<% end %> data-id="<%- item.id %>">
|
||||
<td class="table-checkbox" style="vertical-align: middle">
|
||||
<label class="checkbox-replacement<% if item.state isnt 'hangup': %> is-disabled<% end %>">
|
||||
<input type="checkbox" class="js-check"<% if item.done: %> checked<% end %><% if item.state isnt 'hangup': %> disabled<% end %>>
|
||||
<%- @Icon('checkbox', 'icon-unchecked') %>
|
||||
<%- @Icon('checkbox-checked', 'icon-checked') %>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<% shown = false %>
|
||||
<% if item.preferences.from && !_.isEmpty(item.preferences.from): %>
|
||||
<% for caller_id in item.preferences.from: %>
|
||||
<% if caller_id.user_id && App.User.exists(caller_id.user_id): %>
|
||||
<% shown = true %>
|
||||
<% user = App.User.find(caller_id.user_id) %>
|
||||
<% if caller_id.level isnt 'known': %><%- @T('maybe') %> <% end %>
|
||||
<span class="user-popover" data-id="<%- user.id %>"><%= user.displayNameLong() %></span><br>
|
||||
<% else if caller_id.comment: %>
|
||||
<% shown = true %>
|
||||
<%- @T('maybe') %> <%= caller_id.comment %><br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !shown && item.from_comment: %>
|
||||
<% shown = true %>
|
||||
<% if item.from_comment: %><%= item.from_comment %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% if shown: %>
|
||||
<small><%= item.from %></small>
|
||||
<% else: %>
|
||||
<span class="js-userNew u-clickable" href="#"><%= item.from %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% shown = false %>
|
||||
<% if item.preferences.to && !_.isEmpty(item.preferences.to): %>
|
||||
<% for caller_id in item.preferences.to: %>
|
||||
<% if caller_id.user_id && App.User.exists(caller_id.user_id): %>
|
||||
<% shown = true %>
|
||||
<% user = App.User.find(caller_id.user_id) %>
|
||||
<% if caller_id.level isnt 'known': %><%- @T('maybe') %> <% end %>
|
||||
<span class="user-popover" data-id="<%- user.id %>"><%= user.displayNameLong() %></span><br>
|
||||
<% else if caller_id.comment: %>
|
||||
<% shown = true %>
|
||||
<%- @T('maybe') %> <%= caller_id.comment %><br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !shown && item.to_comment: %>
|
||||
<% shown = true %>
|
||||
<% if item.to_comment: %><%= item.to_comment %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% if shown: %>
|
||||
<small><%= item.to %></small>
|
||||
<% else: %>
|
||||
<%= item.to %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="vertical-align: middle">
|
||||
<% if item.state_human: %>
|
||||
<%- @Icon('status', "#{item.status_class} inline") %> <%- @T(item.state_human) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="vertical-align: middle"><%= item.duration %></td>
|
||||
<td style="vertical-align: middle"><%- @humanTime(item.created_at) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
|
@ -1,90 +1,4 @@
|
|||
<div class="main flex">
|
||||
<h1><%- @T('Caller log') %></h1>
|
||||
|
||||
<div class="page-content">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 40px;"></th>
|
||||
<th><%- @T('From') %></th>
|
||||
<th><%- @T('To') %></th>
|
||||
<th style="width: 130px;"><%- @T('Status') %></th>
|
||||
<th style="width: 100px;"><%- @T('Duration') %></th>
|
||||
<th style="width: 170px;"><%- @T('Time') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% for item in @list: %>
|
||||
<tr <% if item.state is 'hangup' && item.done: %>class="is-grayed-out"<% end %> data-id="<%- item.id %>">
|
||||
<td class="table-checkbox" style="vertical-align: middle">
|
||||
<label class="checkbox-replacement<% if item.state isnt 'hangup': %> is-disabled<% end %>">
|
||||
<input type="checkbox" class="js-check"<% if item.done: %> checked<% end %><% if item.state isnt 'hangup': %> disabled<% end %>>
|
||||
<%- @Icon('checkbox', 'icon-unchecked') %>
|
||||
<%- @Icon('checkbox-checked', 'icon-checked') %>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<% shown = false %>
|
||||
<% if item.preferences.from && !_.isEmpty(item.preferences.from): %>
|
||||
<% for caller_id in item.preferences.from: %>
|
||||
<% if caller_id.user_id && App.User.exists(caller_id.user_id): %>
|
||||
<% shown = true %>
|
||||
<% user = App.User.find(caller_id.user_id) %>
|
||||
<% if caller_id.level isnt 'known': %><%- @T('maybe') %> <% end %>
|
||||
<span class="user-popover" data-id="<%- user.id %>"><%= user.displayNameLong() %></span><br>
|
||||
<% else if caller_id.comment: %>
|
||||
<% shown = true %>
|
||||
<%- @T('maybe') %> <%= caller_id.comment %><br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !shown && item.from_comment: %>
|
||||
<% shown = true %>
|
||||
<% if item.from_comment: %><%= item.from_comment %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% if shown: %>
|
||||
<small><%= item.from %></small>
|
||||
<% else: %>
|
||||
<span class="js-userNew u-clickable" href="#"><%= item.from %></span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% shown = false %>
|
||||
<% if item.preferences.to && !_.isEmpty(item.preferences.to): %>
|
||||
<% for caller_id in item.preferences.to: %>
|
||||
<% if caller_id.user_id && App.User.exists(caller_id.user_id): %>
|
||||
<% shown = true %>
|
||||
<% user = App.User.find(caller_id.user_id) %>
|
||||
<% if caller_id.level isnt 'known': %><%- @T('maybe') %> <% end %>
|
||||
<span class="user-popover" data-id="<%- user.id %>"><%= user.displayNameLong() %></span><br>
|
||||
<% else if caller_id.comment: %>
|
||||
<% shown = true %>
|
||||
<%- @T('maybe') %> <%= caller_id.comment %><br>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !shown && item.to_comment: %>
|
||||
<% shown = true %>
|
||||
<% if item.to_comment: %><%= item.to_comment %><% end %>
|
||||
<br>
|
||||
<% end %>
|
||||
<% if shown: %>
|
||||
<small><%= item.to %></small>
|
||||
<% else: %>
|
||||
<%= item.to %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="vertical-align: middle">
|
||||
<% if item.state_human: %>
|
||||
<%- @Icon('status', "#{item.status_class} inline") %> <%- @T(item.state_human) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td style="vertical-align: middle"><%= item.duration %></td>
|
||||
<td style="vertical-align: middle"><%- @humanTime(item.created_at) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="page-content js-callerLog"></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue