import ModalBase from 'ember-cli-dunlop/mixins/modal-base'
import WorkflowActionDefinitionOffsetNodes from 'ember-panda/utils/project/workflow-action-definition-offset-nodes'

export default ModalBase.extend
  tab: 'index'
  workflow_action_definition_nodes: Ember.computed 'model.workflow_action_definitions.@each.id', ->
    result_nodes = WorkflowActionDefinitionOffsetNodes.create
      workflow_action_definitions: @get('model.workflow_action_definitions')
      reference_date: moment()
    result_nodes.filterBy('resolved').sortBy('absolute_value')
  actions:
    set_tab: (tab_name) -> @set 'tab', tab_name
