Adapt to new event generation for project instance actions and handling
This commit is contained in:
@@ -104,13 +104,12 @@ export default ModalBase.extend
|
||||
|
||||
continue_from_inquiry: ->
|
||||
record = @get('model')
|
||||
if target_date = @get('model.target_date')
|
||||
state = if target_date.format('YYYY-MM-DD') < moment().format('YYYY-MM-DD') then 'overdue' else 'active'
|
||||
else
|
||||
state = 'active'
|
||||
record.set 'state', state
|
||||
record.save().then ->
|
||||
record.get('events').reload()
|
||||
#state = 'active'
|
||||
#state = 'overdue' if @get('model.target_date')?.clone().add(record.get('workflow_action_definition.overdue_coulance') ,'day').format('YYYY-MM-DD') < moment().format('YYYY-MM-DD')
|
||||
#record.set 'state', state
|
||||
#record.save().then ->
|
||||
# record.get('events').reload()
|
||||
record.triggerEvent(event_key: 'state', event_value: 'active').then -> record.get('events').reload()
|
||||
|
||||
add_new_note: ->
|
||||
return unless content = @get('new_note_content')
|
||||
@@ -128,8 +127,12 @@ export default ModalBase.extend
|
||||
|
||||
start_inquiry: ->
|
||||
record = @get('model')
|
||||
record.set 'state', 'inquiry'
|
||||
record.save().then => @send 'add_new_note'
|
||||
#record.set 'state', 'inquiry'
|
||||
#record.save().then => @send 'add_new_note'
|
||||
record.triggerEvent(event_key: 'state', event_value: 'inquiry', note: @get('new_note_content')).then =>
|
||||
record.get('events').reload()
|
||||
@set 'new_note_content', ''
|
||||
|
||||
#record.save().then ->
|
||||
# record.get('events').reload()
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import DS from 'ember-data'
|
||||
import { modelAction } from 'ember-custom-actions'
|
||||
export default DS.Model.extend
|
||||
state: DS.attr('string', defaultValue: 'pending') # pending, planned, (active), overdue, rejected, completed
|
||||
pending_at: DS.attr('moment')
|
||||
@@ -21,6 +22,8 @@ export default DS.Model.extend
|
||||
|
||||
completed: Ember.computed.equal 'state', 'completed'
|
||||
|
||||
triggerEvent: modelAction('trigger_event', pushToStore: true)
|
||||
|
||||
value_display: Ember.computed 'workflow_action_definition.value_type', ->
|
||||
return '' unless value_type = @get('workflow_action_definition.value_type')
|
||||
switch value_type
|
||||
|
||||
@@ -90,12 +90,12 @@ table.ui.attached.stiped.sortable.table
|
||||
td= state-badge project_instance_action.state action=(action 'edit_project_instance_action' project_instance_action)
|
||||
td
|
||||
if (gt project_instance_action.notes.length 14)
|
||||
= ui-markdown-popup tagName='i' class='sticky note outline icon' markdown=project_instance_action.notes on='click'
|
||||
= ui-markdown-popup tagName='i' class='pointable sticky note outline icon' markdown=project_instance_action.notes on='click'
|
||||
else if project_instance_action.notes
|
||||
= project_instance_action.notes
|
||||
if project_instance_action.workflow_action_definition.extra_info
|
||||
'
|
||||
= ui-markdown-popup tagName='i' class='info circle icon' markdown=project_instance_action.workflow_action_definition.extra_info on='click'
|
||||
= ui-markdown-popup tagName='i' class='pointable info circle icon' markdown=project_instance_action.workflow_action_definition.extra_info on='click'
|
||||
td= format-date project_instance_action.target_date format=globals.date_formatting
|
||||
if show_completed_at
|
||||
td= format-date project_instance_action.completed_at format=globals.time_formatting
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
"ember-composable-helpers": "^2.0.3",
|
||||
"ember-concurrency": "^0.8.10",
|
||||
"ember-cpm": "^3.0.0",
|
||||
"ember-custom-actions": "^2.1.0",
|
||||
"ember-data": "~2.16.3",
|
||||
"ember-export-application-global": "^2.0.0",
|
||||
"ember-file-upload": "^2.1.1",
|
||||
|
||||
Reference in New Issue
Block a user