51 lines
3.4 KiB
CoffeeScript
51 lines
3.4 KiB
CoffeeScript
import Ember from 'ember'
|
|
import DS from 'ember-data'
|
|
import add_business_day_computations from 'ember-panda/utils/business-day-computations'
|
|
|
|
export value_type_options = ['boolean', 'date', 'number', 'select', 'string', 'text', 'timestamp']
|
|
Model =
|
|
identifier: DS.attr('string')
|
|
title: DS.attr('string')
|
|
name: Ember.computed.alias 'title'
|
|
description: DS.attr('string')
|
|
isEditing: DS.attr('boolean', defaultValue: false) #TODO: remove, is from PMBC
|
|
done: DS.attr('boolean', defaultValue: false) #TODO: remove, is from PMBC
|
|
position: DS.attr('number', defaultValue: 0)
|
|
value_type: DS.attr('string', defaultValue: 'boolean') # means checkbox progress type
|
|
value_type_select_options: DS.attr(defaultValue: -> [])
|
|
extra_info: DS.attr('string')
|
|
offset_type: DS.attr('string', defaultValue: 'none') # none, attached, configured
|
|
overdue_coulance: DS.attr('number', defaultValue: 0)
|
|
completes_group: DS.attr('boolean', defaultValue: false)
|
|
|
|
# Offset tree
|
|
#action_offset_base: DS.belongsTo('workflow-action-definition', inverse: 'action_offset_dependents')
|
|
#action_offset_dependents: DS.hasMany('workflow-action-definition', inverse: null) # do not give with api, will clear inverse if not given
|
|
|
|
workflow_group: DS.belongsTo('panda/workflow-group')
|
|
project: DS.belongsTo('panda/project', inverse: 'workflow_action_definitions')
|
|
organization: DS.belongsTo('panda/organization', inverse: 'workflow_action_definitions')
|
|
workflow_action_constraints: DS.hasMany('panda/workflow-action-constraint', inverse: 'workflow_action_definition')
|
|
workflow_action_offsets: DS.hasMany('panda/workflow-action-offset', inverse: 'workflow_action_definition')
|
|
dependent_workflow_action_offsets: DS.hasMany('panda/workflow-action-offset', inverse: 'base_workflow_action_definition')
|
|
#project_scenarios: DS.hasMany('panda/project-scenario', inverse: 'workflow_action_definitions')
|
|
project_scenarios: DS.hasMany('panda/project-scenario', inverse: null)
|
|
project_instance_actions: DS.hasMany('panda/project-instance-action', inverse: 'workflow_action_definition')
|
|
confirms_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', inverse: 'confirmed_by_workflow_action_definition')
|
|
confirmed_by_workflow_action_definition: DS.belongsTo('panda/workflow-action-definition', inverse: 'confirms_workflow_action_definition')
|
|
|
|
workflow_action_connections: DS.hasMany('panda/workflow-action-connection', inverse: 'workflow_action_definition')
|
|
pointing_workflow_action_connections: DS.hasMany('panda/workflow-action-connection', inverse: 'base_workflow_action_definition')
|
|
|
|
absolute_position: Ember.computed 'workflow_group.position', 'position', ->
|
|
(@get('workflow_group.position') || 99) * 100 + (@get('position') || 99 )
|
|
|
|
#drag_identifier: Ember.computed 'id', 'workflow_group.id', 'position', ->
|
|
# "#{@get('id')}-#{@get('workflow_group.id')}-#{@get('position')}"
|
|
#smart_position: Ember.computed 'done', 'position', ->
|
|
# num = @get('position')
|
|
# if @get('done') then num + 1000 else num
|
|
add_business_day_computations Model, 'offset', add_attributes: true
|
|
add_business_day_computations Model, 'batch_element_threshold', add_attributes: true #, default_unit: 'businessday'
|
|
export default DS.Model.extend(Model)
|