Implement set_value_action_for_date
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import Ember from 'ember'
|
||||
export default Ember.Controller.extend
|
||||
set_value_on_non_final_till_date_date: moment()
|
||||
set_value_on_non_final_till_date_action: null
|
||||
operation_running_time: Ember.computed 'globals.operation_running', ->
|
||||
return '' unless start_time = @get('globals.operation_running')
|
||||
duration = moment.duration(moment().diff(start_time))
|
||||
@@ -10,3 +12,9 @@ export default Ember.Controller.extend
|
||||
minutes = ('0' + duration.minutes()).slice(-2)
|
||||
seconds = ('0' + duration.seconds()).slice(-2)
|
||||
"#{hours}:#{minutes}:#{seconds}"
|
||||
actions:
|
||||
set_value_on_non_final_till_date: ->
|
||||
return unless date = @get('set_value_on_non_final_till_date_date')
|
||||
return unless action = @get('set_value_on_non_final_till_date_action')
|
||||
@set 'globals.operation_running', moment()
|
||||
action.set_value_on_non_final_till_date(date: date.format('YYYY-MM-DD'), event_value: 't')
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
set_value_on_non_final_till_date_date: moment(),
|
||||
set_value_on_non_final_till_date_action: null,
|
||||
operation_running_time: Ember.computed('globals.operation_running', function() {
|
||||
var duration, hours, minutes, seconds, start_time;
|
||||
if (!(start_time = this.get('globals.operation_running'))) {
|
||||
@@ -16,5 +18,21 @@ export default Ember.Controller.extend({
|
||||
seconds = ('0' + duration.seconds()).slice(-2);
|
||||
return hours + ":" + minutes + ":" + seconds;
|
||||
}
|
||||
})
|
||||
}),
|
||||
actions: {
|
||||
set_value_on_non_final_till_date: function() {
|
||||
var action, date;
|
||||
if (!(date = this.get('set_value_on_non_final_till_date_date'))) {
|
||||
return;
|
||||
}
|
||||
if (!(action = this.get('set_value_on_non_final_till_date_action'))) {
|
||||
return;
|
||||
}
|
||||
this.set('globals.operation_running', moment());
|
||||
return action.set_value_on_non_final_till_date({
|
||||
date: date.format('YYYY-MM-DD'),
|
||||
event_value: 't'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Ember from 'ember'
|
||||
import DS from 'ember-data'
|
||||
import { modelAction } from 'ember-custom-actions'
|
||||
import add_business_day_computations from 'ember-panda/utils/business-day-computations'
|
||||
|
||||
export value_type_options = ['boolean', 'date', 'number', 'select', 'string', 'text', 'timestamp']
|
||||
@@ -40,6 +41,8 @@ Model =
|
||||
absolute_position: Ember.computed 'workflow_group.position', 'position', ->
|
||||
(@get('workflow_group.position') || 99) * 100 + (@get('position') || 99 )
|
||||
|
||||
set_value_on_non_final_till_date: modelAction('set_value_on_non_final_till_date', pushToStore: false)
|
||||
|
||||
#drag_identifier: Ember.computed 'id', 'workflow_group.id', 'position', ->
|
||||
# "#{@get('id')}-#{@get('workflow_group.id')}-#{@get('position')}"
|
||||
#smart_position: Ember.computed 'done', 'position', ->
|
||||
|
||||
@@ -5,6 +5,10 @@ import Ember from 'ember';
|
||||
|
||||
import DS from 'ember-data';
|
||||
|
||||
import {
|
||||
modelAction
|
||||
} from 'ember-custom-actions';
|
||||
|
||||
import add_business_day_computations from 'ember-panda/utils/business-day-computations';
|
||||
|
||||
export var value_type_options = ['boolean', 'date', 'number', 'select', 'string', 'text', 'timestamp'];
|
||||
@@ -77,6 +81,9 @@ Model = {
|
||||
}),
|
||||
absolute_position: Ember.computed('workflow_group.position', 'position', function() {
|
||||
return (this.get('workflow_group.position') || 99) * 100 + (this.get('position') || 99);
|
||||
}),
|
||||
set_value_on_non_final_till_date: modelAction('set_value_on_non_final_till_date', {
|
||||
pushToStore: false
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user