diff --git a/app/assets/javascripts/app/controllers/cti.coffee b/app/assets/javascripts/app/controllers/cti.coffee index 9244701b9..ea65e59dc 100644 --- a/app/assets/javascripts/app/controllers/cti.coffee +++ b/app/assets/javascripts/app/controllers/cti.coffee @@ -5,8 +5,9 @@ class App.CTI extends App.Controller elements: '.js-callerLog': 'callerLog' events: - 'click .js-check': 'done' - 'click .js-newUser': 'newUser' + 'click .js-check': 'done' + 'click .js-checkAll': 'doneAll' + 'click .js-newUser': 'newUser' list: [] backends: [] meta: @@ -191,10 +192,23 @@ class App.CTI extends App.Controller @updateNavMenu() + doneAll: => + + # get id's of all unchecked caller logs + @logIds = $('.js-callerLog').map(-> + return $(@).data('id') if !$(@).find('.js-check').prop('checked') + ).get() + + @ajax( + type: 'POST' + url: "#{@apiPath}/cti/done/bulk" + data: JSON.stringify({ids: @logIds}) + ) + done: (e) => element = $(e.currentTarget) - id = element.closest('tr').data('id') - done = element.prop('checked') + id = element.closest('tr').data('id') + done = element.prop('checked') @ajax( type: 'POST' url: "#{@apiPath}/cti/done/#{id}" diff --git a/app/assets/javascripts/app/views/cti/caller_log.jst.eco b/app/assets/javascripts/app/views/cti/caller_log.jst.eco index b3551483f..ea3d40ffd 100644 --- a/app/assets/javascripts/app/views/cti/caller_log.jst.eco +++ b/app/assets/javascripts/app/views/cti/caller_log.jst.eco @@ -1,7 +1,13 @@