diff --git a/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee index 4ebe5febf..31f3f4066 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee @@ -5,21 +5,40 @@ class App.UiElement.sla_times attribute: attribute first_response_time: params.first_response_time update_time: params.update_time - close_time: params.close_time + solution_time: params.solution_time first_response_time_in_text: @toText(params.first_response_time) update_time_in_text: @toText(params.update_time) - close_time_in_text: @toText(params.close_time) + solution_time_in_text: @toText(params.solution_time) ) ) + item.find('.js-activateRow').bind('change', (e) => + element = $(e.target) + if element.prop('checked') + element.closest('tr').addClass('is-active') + else + element.closest('tr').removeClass('is-active') + element.closest('tr').find('.js-timeConvertFrom').val('') + ) + item.find('.js-timeConvertFrom').bind('keyup', (e) => - inText = $(e.target).val() + element = $(e.target) + inText = element.val() inMinutes = @toMinutes(inText) if !inMinutes - $(e.target).addClass('has-error') + element.addClass('has-error') else - $(e.target).removeClass('has-error') - dest = $(e.target).closest('td').find('.js-timeConvertTo') + element.removeClass('has-error') + dest = element.closest('td').find('.js-timeConvertTo') dest.val(inMinutes) + element.closest('tr').find('.js-activateRow').prop('checked', true) + element.closest('tr').addClass('is-active') + ) + + item.find('.js-timeConvertFrom').each(-> + if $(@).val() + $(@).closest('tr').find('.js-activateRow').prop('checked', true) + else + $(@).closest('tr').find('.js-activateRow').prop('checked', false) ) item diff --git a/app/assets/javascripts/app/models/sla.js.coffee b/app/assets/javascripts/app/models/sla.js.coffee index d3d334b4a..102fa0992 100644 --- a/app/assets/javascripts/app/models/sla.js.coffee +++ b/app/assets/javascripts/app/models/sla.js.coffee @@ -1,5 +1,5 @@ class App.Sla extends App.Model - @configure 'Sla', 'name', 'first_response_time', 'update_time', 'close_time', 'condition', 'calendar_id' + @configure 'Sla', 'name', 'first_response_time', 'update_time', 'solution_time', 'condition', 'calendar_id' @extend Spine.Model.Ajax @url: @apiPath + '/slas' @configure_attributes = [ diff --git a/app/assets/javascripts/app/views/generic/sla_times.jst.eco b/app/assets/javascripts/app/views/generic/sla_times.jst.eco new file mode 100644 index 000000000..233c56262 --- /dev/null +++ b/app/assets/javascripts/app/views/generic/sla_times.jst.eco @@ -0,0 +1,32 @@ +
<%- @T('Active') %> + | <%- @T('Type') %> + | <%- @T('Time') %> <%- @T('in hours') %> + |
---|---|---|
+ |
+
+ <%- @T('Timeframe for the first response.') %> + | + |
+ |
+
+ <%- @T('Timeframe for every following response.') %> + | + |
+ |
+
+ <%- @T('Timeframe for solving the problem.') %> + | + |