action-list completed_at and inquiry_at additions and project-instance actions filtering
This commit is contained in:
@@ -10,6 +10,9 @@ export default Ember.Controller.extend
|
||||
show_completed_at: Ember.computed 'filters.state_in.[]', 'filters.completed_at_gteq', 'filters.completed_at_lteq', ->
|
||||
return true if @get('filters.completed_at_lteq') or @get('filters.completed_at_gteq')
|
||||
JSON.stringify(@get('filters.state_in')) is '["completed"]'
|
||||
show_inquiry_at: Ember.computed 'filters.state_in.[]', 'filters.inquiry_at_gteq', 'filters.inquiry_at_lteq', ->
|
||||
return true if @get('filters.inquiry_at_lteq') or @get('filters.inquiry_at_gteq')
|
||||
JSON.stringify(@get('filters.state_in')) is '["inquiry"]'
|
||||
filter_query: Ember.computed 'filters.filter_calls', ->
|
||||
@get('filters')?.toProperties() || {}
|
||||
export_human_url: Ember.computed 'filter_query', ->
|
||||
|
||||
@@ -15,6 +15,12 @@ export default Ember.Controller.extend({
|
||||
}
|
||||
return JSON.stringify(this.get('filters.state_in')) === '["completed"]';
|
||||
}),
|
||||
show_inquiry_at: Ember.computed('filters.state_in.[]', 'filters.inquiry_at_gteq', 'filters.inquiry_at_lteq', function() {
|
||||
if (this.get('filters.inquiry_at_lteq') || this.get('filters.inquiry_at_gteq')) {
|
||||
return true;
|
||||
}
|
||||
return JSON.stringify(this.get('filters.state_in')) === '["inquiry"]';
|
||||
}),
|
||||
filter_query: Ember.computed('filters.filter_calls', function() {
|
||||
var ref;
|
||||
return ((ref = this.get('filters')) != null ? ref.toProperties() : void 0) || {};
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import Ember from 'ember'
|
||||
import {create_date_sort} from 'ember-cli-dunlop/utils/date-sort'
|
||||
{get} = Ember
|
||||
target_date_sort = create_date_sort('target_date')
|
||||
export default Ember.Controller.extend
|
||||
#filter: Ember.Object.create
|
||||
# project_scenario_id_in: []
|
||||
# state_in: []
|
||||
# reference_date_gteq: null
|
||||
# reference_date_lteq: null
|
||||
#filter_project_scenarios: Ember.computed 'filter.project_scenario_id_in.[]', ->
|
||||
# @get('model.sorted_project_scenarios').filter((r) => r.get('id') in @get('filter.project_scenario_id_in'))
|
||||
#reference_date_filter_active: Ember.computed.or 'filter.{reference_date_gteq,reference_date_lteq}'
|
||||
#reference_date_filter_text: Ember.computed 'filter.reference_date_gteq', 'filter.reference_date_lteq', ->
|
||||
# if gteq = @get('filter.reference_date_gteq')
|
||||
# gteq = gteq.format('ll')
|
||||
# else
|
||||
# gteq = '-'
|
||||
# if lteq = @get('filter.reference_date_lteq')
|
||||
# lteq = lteq.format('ll')
|
||||
# else
|
||||
# lteq = '-'
|
||||
# "#{gteq} / #{lteq}"
|
||||
#filtered_project_instances: Ember.computed 'model.project_instances.@each.id', 'filter.{project_scenario_id_in.length,state_in.length,reference_date_gteq,reference_date_lteq}', ->
|
||||
# base = @get('model.project_instances').toArray()
|
||||
# if @get('filter.project_scenario_id_in.length')
|
||||
# base = base.filter (record) => record.get('project_scenario.id') in @get('filter.project_scenario_id_in')
|
||||
# if reference_date_gteq = @get('filter.reference_date_gteq')
|
||||
# base = base.filter (record) -> if reference_date = record.get('reference_date') then reference_date.toISOString().substring(0, 10) >= reference_date_gteq.toISOString().substring(0, 10) else false
|
||||
# if reference_date_lteq = @get('filter.reference_date_lteq')
|
||||
# base = base.filter (record) -> if reference_date = record.get('reference_date') then reference_date.toISOString().substring(0, 10) <= reference_date_lteq.toISOString().substring(0, 10) else false
|
||||
# if @get('filter.state_in.length')
|
||||
# base = base.filter (record) => record.get('state') in @get('filter.state_in')
|
||||
# base.sort date_sort
|
||||
apply_filters: -> # empty since handled inline
|
||||
filters: Ember.Object.create
|
||||
state_in: []
|
||||
workflow_group_name_cont: ''
|
||||
workflow_action_definition_title_cont: ''
|
||||
target_date_lteq: null
|
||||
target_date_gteq: null
|
||||
|
||||
filtered_project_instance_actions: Ember.computed 'model.project_instance_actions.[]', 'filters.filter_calls', ->
|
||||
return [] unless actions = @get('model.project_instance_actions')?.toArray()
|
||||
if @get('filters.state_in.length')
|
||||
actions = actions.filter (record) => record.get('state') in @get('filters.state_in')
|
||||
if group_name_filter = @get('filters.workflow_group_name_cont')
|
||||
matcher = new RegExp(group_name_filter, 'i')
|
||||
actions = actions.filter (record) -> matcher.test record.get('project_instance_group.workflow_group.name')
|
||||
if title_filter = @get('filters.workflow_action_definition_title_cont')
|
||||
matcher = new RegExp(title_filter, 'i')
|
||||
actions = actions.filter (record) -> matcher.test record.get('workflow_action_definition.title')
|
||||
actions.sort target_date_sort
|
||||
|
||||
actions:
|
||||
edit_project_instance_action: (project_instance_action) ->
|
||||
@modal 'project/edit-instance-action', model: project_instance_action
|
||||
@@ -33,6 +33,9 @@ table.ui.attached.stiped.sortable.table
|
||||
if show_completed_at
|
||||
= sortable-table-header filters=filters key='completed_at' model=model.project_instance_actions defaultDirection='desc'
|
||||
= t 'attributes.project_instance_action.completed_at'
|
||||
if show_inquiry_at
|
||||
= sortable-table-header filters=filters key='inquiry_at' model=model.project_instance_actions defaultDirection='desc'
|
||||
= t 'attributes.project_instance_action.inquiry_at'
|
||||
th= t 'attributes.project_instance_action.value'
|
||||
table-filters content=model.project_instance_actions filters=filters as |filter|
|
||||
unless scope_project
|
||||
@@ -53,6 +56,8 @@ table.ui.attached.stiped.sortable.table
|
||||
= filter.date-range key='target_date' expandingTime=true weekSelector=true
|
||||
if show_completed_at
|
||||
= filter.date-range key='completed_at' expandingTime=true weekSelector=true
|
||||
if show_inquiry_at
|
||||
= filter.date-range key='inquiry_at' expandingTime=true weekSelector=true
|
||||
th
|
||||
tbody
|
||||
if model.project_instance_actions.loading
|
||||
@@ -91,9 +96,11 @@ table.ui.attached.stiped.sortable.table
|
||||
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
|
||||
td= format-date project_instance_action.target_date
|
||||
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
|
||||
if show_inquiry_at
|
||||
td= format-date project_instance_action.inquiry_at format=globals.time_formatting
|
||||
td= project/instance-action-value-display project_instance_action=project_instance_action
|
||||
/each project_instance_action.pointing_project_instance_action_connections as |project_instance_action_connection|
|
||||
if (eq project_instance_action_connection.connection_type 'attached')
|
||||
|
||||
@@ -92,5 +92,5 @@ table.ui.bottom.attached.stiped.table
|
||||
td= link-to 'project.show.project-instance.show' project_instance_action.project_instance.project.id project_instance_action.project_instance.id
|
||||
span= project_instance_action.project_instance.client_identifier
|
||||
td= state-badge project_instance_action.state
|
||||
td= format-date project_instance_action.target_date
|
||||
td= format-date project_instance_action.target_date format=globals.date_formatting
|
||||
td= project/instance-action-value-display project_instance_action=project_instance_action
|
||||
|
||||
@@ -6,14 +6,22 @@ table.ui.bottom.attached.striped.table
|
||||
th= t 'attributes.project_instance_action.state'
|
||||
th= t 'attributes.project_instance_action.target_date'
|
||||
th= t 'attributes.project_instance_action.value'
|
||||
table-filters filters=filters as |filter|
|
||||
= filter.input key='workflow_group_name_cont'
|
||||
= filter.input key='workflow_action_definition_title_cont'
|
||||
= filter.dropdown-select-multiple key='state_in' options=globals.project_instance_action.states translationPath='attributes.state' eager_filter=true
|
||||
th
|
||||
th
|
||||
|
||||
tbody
|
||||
each (sort-by (route-action 'dateSort' 'target_date') model.project_instance_actions) as |project_instance_action|
|
||||
/each (sort-by (route-action 'dateSort' 'target_date') model.project_instance_actions) as |project_instance_action|
|
||||
each filtered_project_instance_actions as |project_instance_action|
|
||||
tr
|
||||
td
|
||||
if project_instance_action.project_instance_group.id
|
||||
= link-to 'project.show.project-instance-group.show' model.project project_instance_action.project_instance_group.id
|
||||
span= project_instance_action.project_instance_group.workflow_group.name
|
||||
td= project_instance_action.workflow_action_definition.title
|
||||
td= state-badge project_instance_action.state
|
||||
td= state-badge project_instance_action.state action=(action 'edit_project_instance_action' project_instance_action)
|
||||
td= format-date project_instance_action.target_date format=globals.date_formatting
|
||||
td= project/instance-action-value-display project_instance_action=project_instance_action
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
window.client_id ||= "client#{Math.round(Math.random()*1000000)}"
|
||||
#$translations.en.attributes.state ||= {}
|
||||
$translations.en.attributes.state ||= {}
|
||||
$translations.en.attributes.project_instance_action ||= {}
|
||||
Ember.assign $translations.en.attributes.state,
|
||||
inquiry: 'Issue'
|
||||
Ember.assign $translations.en.attributes.project_instance_action,
|
||||
inquiry_at: 'Issue'
|
||||
default_globals =
|
||||
flash_message: ''
|
||||
preload_resources_fulfilled: true
|
||||
|
||||
Reference in New Issue
Block a user