Skip to content

Commit

Permalink
Merge pull request #656 from sparc-request/sj-components_box_hiding
Browse files Browse the repository at this point in the history
hiding components based on otf checkbox [#129151007]
  • Loading branch information
jleonardw9 committed Sep 12, 2016
2 parents 0f9b33c + 4467969 commit 4e50433
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 112 deletions.
6 changes: 5 additions & 1 deletion app/assets/javascripts/catalog_manager/catalog.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ $ ->
############################q

$('.one_time_fee').live 'click', ->
pricing_map_ids = $(this).data('pricing_map_ids')
pricing_map_ids = String($(this).data('pricing_map_ids'))
pricing_map_ids = pricing_map_ids.split(' ')
index = 0
while index < pricing_map_ids.length
Expand Down Expand Up @@ -523,6 +523,10 @@ $ ->
$(this).children('fieldset').show('blind')
$(this).addClass('active')

$(document).on('change', 'input#service_one_time_fee', ->
$('#components_wrapper').toggle()
)

$(document).on('change', 'input[id*="_tag_list_epic"]', ->
$('#epic_wrapper').toggle()
$("#epic_wrapper input[type='checkbox']").attr('checked', false)
Expand Down
45 changes: 23 additions & 22 deletions app/views/catalog_manager/services/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,30 @@

%br

%fieldset.service_level_components.parent
.legend
= t(:organization_form)[:service_level_components]
#components_wrapper{:style => @service.one_time_fee ? "display: block;" : "display: none;"}
%fieldset.service_level_components.parent
.legend
= t(:organization_form)[:service_level_components]

%fieldset.single_fieldset
.secondary_header Components
%table
%tbody
= f.hidden_field :components
- if @service.components
- components = @service.components.split(",")
- components_length = components.length
- (0...components_length).each do |i|
%tr{id: "service_component_position_#{i}"}
%td
%input.service_component_field{ value: components[i], position: i, type: 'text'}
%button.delete{type: "button", position: i} Remove
%tr{id: "service_component_position_#{components_length}"}
%td
%input.service_component_field{ position: components_length, type: 'text' }

%button.add{type: "button"} Add components
%br
%fieldset.single_fieldset
.secondary_header Components
%table
%tbody
= f.hidden_field :components
- if @service.components
- components = @service.components.split(",")
- components_length = components.length
- (0...components_length).each do |i|
%tr{id: "service_component_position_#{i}"}
%td
%input.service_component_field{ value: components[i], position: i, type: 'text'}
%button.delete{type: "button", position: i} Remove
%tr{id: "service_component_position_#{components_length}"}
%td
%input.service_component_field{ position: components_length, type: 'text' }

%button.add{type: "button"} Add components
%br

#epic_wrapper{:style => @service.tag_list.include?("epic") ? "display: block;" : "display: none;"}
%fieldset#epic_fieldset.parent
Expand Down
45 changes: 23 additions & 22 deletions app/views/catalog_manager/services/_new_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,30 @@
%span= f.check_box :tag_list, { :multiple => true }, tag.name, nil
%br

%fieldset.service_level_components.parent
.legend
= t(:organization_form)[:service_level_components]
#components_wrapper{:style => "display: none;"}
%fieldset.service_level_components.parent
.legend
= t(:organization_form)[:service_level_components]

%fieldset.single_fieldset
.secondary_header Components
%table
%tbody
= f.hidden_field :components
- if @service.components
- components = @service.components.split(",")
- components_length = components.length
- (0...components_length).each do |i|
%tr{id: "service_component_position_#{i}"}
%td
%input.service_component_field{ value: components[i], position: i, type: 'text'}
%button.delete{type: "button", position: i} Remove
%tr{id: "service_component_position_#{components_length}"}
%td
%input.service_component_field{ position: components_length, type: 'text' }

%button.add{type: "button"} Add components
%br
%fieldset.single_fieldset
.secondary_header Components
%table
%tbody
= f.hidden_field :components
- if @service.components
- components = @service.components.split(",")
- components_length = components.length
- (0...components_length).each do |i|
%tr{id: "service_component_position_#{i}"}
%td
%input.service_component_field{ value: components[i], position: i, type: 'text'}
%button.delete{type: "button", position: i} Remove
%tr{id: "service_component_position_#{components_length}"}
%td
%input.service_component_field{ position: components_length, type: 'text' }

%button.add{type: "button"} Add components
%br

#epic_wrapper{:style => "display:none;"}
%fieldset#epic_fieldset.parent
Expand Down
69 changes: 3 additions & 66 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ en:
# Catalog Manager Organization Form
organization_form:
abbreviation: "Abbreviation"
ack_language: "Acknowledgement Language"
ack_language: "Acknowledgment Language"
actions: "Actions:"
add_map: "Add Pricing Map"
associated_surveys: "Surveys"
Expand All @@ -947,6 +947,7 @@ en:
description: "Description"
disabled: "Do not display in SPARC"
disabled_at: "Disabled at: %{disabled_parent}"
eap_id: 'EAP ID'
epic_info: "Epic Interface"
errors: "Effective Date, Display Dates, Percent of Fee, and Rates are required on all pricing setups."
gen_info: "General Information"
Expand All @@ -968,7 +969,7 @@ en:
send_to_epic: "Send To Epic"
service_center_cost: "Service Center Cost"
service_error: "There are no service providers anywhere on this tree."
service_level_components: "Service Level Components"
service_level_components: "Service Level Components (for SPARCFulfillment)"
service_provider_required_message: "You must have at least one service provider either at the provider, program, or core level"
service_providers: "Service Providers"
split_notify: "Split/Notify Here"
Expand Down Expand Up @@ -1420,70 +1421,6 @@ en:
subspecialty_prompt: "Select a Subspecialty"
subspecialty: "Subspecialty:"

# Catalog Manager - Organization Form
organization_form:
service_level_components: "Service Level Components"
gen_info: "General Information"
user_rights: "User Rights"
pricing: "Pricing"
epic_info: "Epic Interface"
program: "Program"
core: "Core"
name: "Name"
abbreviation: "Abbreviation"
description: "Description"
ack_language: "Acknowledgement Language"
order: "Order"
tag_list: "Tags"
is_ctrc: "Is CTRC?"
split_notify: "Split/Notify Here"
css_class: "Color"
disabled: "Do not display in SPARC"
disabled_at: "Disabled at: %{disabled_parent}"
one_time_fee: "One Time Fee"
core_facility: "Core/Facility Based Services"
service_center_cost: "Service Center Cost"
hospital_based_services: "Hospital Based Services"
eap_id: 'EAP ID'
cpt_code: "CPT Code"
send_to_epic: "Send To Epic"
charge_code: "Charge Code"
revenue_code: "Revenue Code"
pricing_maps: "Pricing Maps"
add_map: "Add Pricing Map"
related_services: "Related Services"
associated_surveys: "Surveys"
submission_emails: "Submission E-mails"
super_users: "Super Users"
service_providers: "Service Providers"
service_provider_required_message: "You must have at least one service provider either at the provider, program, or core level"
new_sp: "New Service Provider"
service_error: "There are no service providers anywhere on this tree."
cm_rights: "Catalog Manager Rights"
clinical_work_fulfillment: "Fulfillment"
clinical_providers: "Fulfillment Provider Rights:"
new_cm: "New Catalog Manager"
auto_price_adj: "Automatic Pricing Adjustment"
change_rates: "Increase or Decrease Rates"
pricing_setup: "Pricing Setup"
subsidy_info: "Subsidy Information"
subsidy_max_percent: "Max Percentage"
subsidy_default_percentage: "Default Percentage"
subsidy_instructions: "Instructions"
subsidy_max_dollar: "Max Dollar Cap"
actions: "Actions:"
submit_button: "Save"
cancel_button: "Cancel"
blank_field_errors: "Name and Order are required on the Service. Effective Date, Display Date, and Service Rate are required on all Pricing Maps."
per_patient_errors: "Clinical Quantity Type, Unit Factor, and Units Per Qty Maximum are required on all Per Patient Pricing Maps."
otf_field_errors: "If the Pricing Map is a one time fee (the box is checked), Quantity Type, Quantity Minimum, Unit Type, and Unit Maximum are required."
status_legend: "Status Options (Use default statuses below or click to create custom service request statuses)"
default_statuses: "Default Statuses:"
color_blank: "Select a Color"
errors: "Effective Date, Display Dates, Percent of Fee, and Rates are required on all pricing setups."
show_in_cwf: "Show in Fulfillment"
ctrc_label: "Administrative Approvals"

# Indirect cost rates, default values used to prepopulate forms
indirect_cost_rates:
internal_and_college: "0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def fill_in_service_form_general
end

def fill_in_service_form_service_level_components
find('input#service_one_time_fee').click
wait_for_javascript_to_finish
find(".service_level_components").click
wait_for_javascript_to_finish
find(:css, ".service_component_field").set("Test service component 1")
Expand All @@ -61,7 +63,7 @@ def fill_in_service_form_pricing_map
page.execute_script %Q{ $("a.ui-state-default:contains('15')").trigger("click") } # click on day 15

fill_in "pricing_maps_blank_pricing_map_full_rate", with: 4321
fill_in "clinical_quantity_", with: "Each"
fill_in "otf_quantity_type_", with: "Each"
find('#unit_factor_').click
end
end
Expand Down

0 comments on commit 4e50433

Please sign in to comment.