Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JM- (SPARCFulfillment) Study Level Activity Export on Fulfillment Level #499

Merged
merged 8 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/assets/javascripts/global.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ $ ->
### Add "exclude_in_export" class to columns you want excluded from export and then pass in table ID ###
window.exclude_from_export = (table_id) ->
excluded_cols = []
$('.exclude_in_export').each ->
$('#'+table_id + ' .exclude_in_export').each ->
excluded_cols.push $(this).closest('th').index()

if excluded_cols.length
$('#'+table_id).data('export-options').ignoreColumn = excluded_cols
1 change: 0 additions & 1 deletion app/assets/javascripts/study_level_activities.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,3 @@ $ ->

### In Study Level Activities we want to ignore data-field: fulfillments_button, components, options ###
exclude_from_export('study-level-activities-table')

18 changes: 10 additions & 8 deletions app/views/fulfillments/_fulfillment.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
json.(fulfillment)

json.id fulfillment.id
json.fulfillment_grouper fulfillment_grouper_formatter(fulfillment)
json.fulfillment_date fulfillment_date_formatter(fulfillment)
json.quantity fulfillment.quantity
json.quantity_type fulfillment.line_item.quantity_type
json.performed_by fulfillment.performer.full_name if fulfillment.performer
json.components fulfillment_components_formatter(fulfillment.components)
json.options fulfillment_options_buttons(fulfillment)
json.invoiced (fulfillment.invoiced? ? "Yes" : "No")
json.fulfillment_grouper fulfillment_grouper_formatter(fulfillment)
json.fulfillment_date fulfillment_date_formatter(fulfillment)
json.quantity fulfillment.quantity
json.quantity_type fulfillment.line_item.quantity_type
json.performed_by fulfillment.performer.full_name if fulfillment.performer
json.components fulfillment_components_formatter(fulfillment.components)
json.options fulfillment_options_buttons(fulfillment)
json.invoiced (fulfillment.invoiced? ? "Yes" : "No")
json.notes notes(fulfillment.notes)
json.docs documents(fulfillment.documents)
3 changes: 3 additions & 0 deletions app/views/fulfillments/index.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ $("#modal_area").html("<%= escape_javascript(render(:partial =>'study_level_acti
$("#fulfillments-table").bootstrapTable()
$("#modal_place").modal(backdrop: 'static', keyboard: false)
$("#modal_place").modal 'show'
$('.fulfillments-list li').find("[data-field='docs']").closest('li').hide()
$('.fulfillments-list li').find("[data-field='notes']").closest('li').hide()
exclude_from_export('fulfillments-table')
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
.modal-body
.bootstrap-table-dropdown-overflow
#fulfillment-custom-toolbar
%table.fulfillments{id: "fulfillments-table", data: {toggle: 'table', search: "true", "show-columns" => "true", "show-refresh" => "true", "show-toggle" => "true", url: fulfillments_path(format: :json, line_item_id: line_item.id), striped: "true", toolbar: "#fulfillment-custom-toolbar", "show-export" => "true", "export-types" => ['excel']}}
%table.fulfillments{id: "fulfillments-table", data: {toggle: 'table', search: "true", "show-columns" => "true", "show-refresh" => "true", "show-toggleOn" => "true", url: fulfillments_path(format: :json, line_item_id: line_item.id), striped: "true", toolbar: "#fulfillment-custom-toolbar", "show-export" => "true", "export-types" => ['xlsx'], "export-options" => '{"ignoreColumn": []}'}}
%thead.secondary-header
%tr
%th{data: {class: 'fulfillment_grouper', align: "left", sortable: 'true', sorter: 'dateSorter', field: "fulfillment_grouper"}}
Expand All @@ -44,11 +44,15 @@
= t(:fulfillment)[:performed_by]
%th{data: {class: 'components', align: "center", field: "components"}}
= t(:fulfillment)[:components]
%th{data: {class: 'options', align: "center", field: "options"}}
%th{data: {class: 'options exclude_in_export', align: "center", field: "options"}}
= t(:actions)[:actions]
- if line_item.fulfillments.any?{|fulfillment| fulfillment.invoiced == true}
%th{data: {class: 'invoiced', align: "center", field: "invoiced"}}
= t(:fulfillment)[:invoiced]
%th{data: {class: 'notes hidden', align: "center", field: "notes"}}
= t(:line_item)[:notes]
%th{data: {class: 'docs hidden', align: "center", field: "docs"}}
= t(:line_item)[:documents]
#fulfillment-klok-description
%i{class: 'glyphicon glyphicon-time'}
%span= t(:fulfillment)[:klok_description]
Expand Down