Skip to content

Commit

Permalink
Fixed issue zammad#1478 - Allow cti log entries to check done (also i…
Browse files Browse the repository at this point in the history
…f no hangup state is available).
  • Loading branch information
martini committed Sep 26, 2017
1 parent 31b1154 commit 2075117
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion app/assets/javascripts/app/controllers/cti.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@ class App.CTI extends App.Controller

for item in @list
item.status_class = ''

item.disabled = true
if item.state is 'newCall'
item.state_human = 'ringing'
item.status_class = 'neutral'
else if item.state is 'answer'
item.state_human = 'connected'
item.status_class = 'ok'
else if item.state is 'hangup'
item.disabled = false
item.state_human = switch item.comment
when 'cancel', 'noAnswer', 'congestion' then 'not reached'
when 'busy' then 'busy'
Expand All @@ -164,6 +165,10 @@ class App.CTI extends App.Controller
if item.start && item.end
item.duration = format((Date.parse(item.end) - Date.parse(item.start))/1000)

diff_in_min = ((Date.now() - Date.parse(item.created_at)) / 1000) / 60
if diff_in_min > 1
item.disabled = false

@userPopupsDestroy()
@callerLog.html( App.view('cti/caller_log')(list: @list))
@userPopups()
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/app/views/cti/caller_log.jst.eco
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
</thead>
<tbody>
<% for item in @list: %>
<tr <% if item.state is 'hangup' && item.done: %>class="is-grayed-out"<% end %> data-id="<%- item.id %>">
<tr <% if 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 %>>
<label class="checkbox-replacement<% if item.disabled is true: %> is-disabled<% end %>">
<input type="checkbox" class="js-check"<% if item.done: %> checked<% end %><% if item.disabled is true: %> disabled<% end %>>
<%- @Icon('checkbox', 'icon-unchecked') %>
<%- @Icon('checkbox-checked', 'icon-checked') %>
</label>
Expand Down

0 comments on commit 2075117

Please sign in to comment.