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

wth - (SPARCRequest Step 3 & SPARCDashboard) Adding 2 new Timeline Fi… #1244

Merged
merged 1 commit into from
Feb 20, 2018
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
4 changes: 3 additions & 1 deletion app/assets/javascripts/dashboard/milestone.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ $ ->

if $('.initial-budget-sponsor-received-date-picker').val() != ''
$('.initial-amount').removeClass('hide')
$('.initial-amount-cs').removeClass('hide')

if $('.budget-agreed-upon-date-picker').val() != ''
$('.negotiated-amount').removeClass('hide')
$('.negotiated-amount-cs').removeClass('hide')

$(document).on 'dp.change', '.start-date-picker', (e) ->
$('.start-date-setter').val(e.date)
Expand All @@ -47,6 +49,6 @@ $ ->
$(document).on 'dp.hide', '.start-date-picker, .end-date-picker, .recruitment-start-date-picker, .recruitment-end-date-picker, .initial-budget-sponsor-received-date-picker, .budget-agreed-upon-date-picker', ->
$('.milestone-form').submit()

$(document).on 'blur', '.initial-amount, .negotiated-amount', ->
$(document).on 'blur', '.initial-amount, .negotiated-amount, .negotiated-amount-cs, .initial-amount-cs', ->
$('.milestone-form').submit()

4 changes: 3 additions & 1 deletion app/controllers/dashboard/milestones_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def protocol_params
:initial_budget_sponsor_received_date,
:budget_agreed_upon_date,
:initial_amount,
:negotiated_amount
:negotiated_amount,
:initial_amount_clinical_services,
:negotiated_amount_clinical_services
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/service_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def details_params
required_keys = params[:study] ? :study : params[:project] ? :project : nil
if required_keys.present?
temp = params.require(required_keys).permit(:start_date, :end_date,
:recruitment_start_date, :recruitment_end_date, :initial_budget_sponsor_received_date, :budget_agreed_upon_date, :initial_amount, :negotiated_amount).to_h
:recruitment_start_date, :recruitment_end_date, :initial_budget_sponsor_received_date, :budget_agreed_upon_date, :initial_amount, :negotiated_amount, :initial_amount_clinical_services, :negotiated_amount_clinical_services).to_h

# Finally, transform date attributes.
date_attrs = %w(start_date end_date recruitment_start_date recruitment_end_date initial_budget_sponsor_received_date budget_agreed_upon_date)
Expand Down
2 changes: 2 additions & 0 deletions app/views/dashboard/milestones/update.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ $(".selectpicker").selectpicker()
$('[data-toggle="tooltip"]').tooltip()
if $('.initial-budget-sponsor-received-date-picker').val() != ''
$('.initial-amount').removeClass('hide')
$('.initial-amount-cs').removeClass('hide')

if $('.budget-agreed-upon-date-picker').val() != ''
$('.negotiated-amount').removeClass('hide')
$('.negotiated-amount-cs').removeClass('hide')

58 changes: 28 additions & 30 deletions app/views/dashboard/protocols/_milestone.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -77,59 +77,57 @@
= f.label :initial_budget_sponsor_received_date,
t(:proper)[:service_details][:initial_budget_sponsor_received_date],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
= text_field_tag 'initial_budget_sponsor_received_date', nil,
class: 'datetimepicker form-control initial-budget-sponsor-received-date-picker',
value: (protocol.initial_budget_sponsor_received_date.strftime('%_m/%d/%Y') rescue nil)
= f.hidden_field :initial_budget_sponsor_received_date, value: nil,
class: 'initial-budget-sponsor-received-date-setter'
- if protocol.has_clinical_services?
.initial-amount.hide
= f.label :initial_amount,
.initial-amount-cs.hide
= f.label :initial_amount_clinical_services,
t(:proper)[:service_details][:initial_amount_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :initial_amount,
class: 'form-control'
- else
.initial-amount.hide
= f.label :initial_amount,
t(:proper)[:service_details][:initial_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.input-group
.input-group-addon $
= f.number_field :initial_amount,
= f.number_field :initial_amount_clinical_services,
class: 'form-control'
.initial-amount.hide
= f.label :initial_amount,
t(:proper)[:service_details][:initial_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :initial_amount,
class: 'form-control'
.form-group.col-lg-12#budget-agreed-upon-date
= f.label :budget_agreed_upon_date,
t(:proper)[:service_details][:budget_agreed_upon_date],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
= text_field_tag 'budget_agreed_upon_date', nil,
class: 'datetimepicker form-control budget-agreed-upon-date-picker',
value: (protocol.budget_agreed_upon_date.strftime('%_m/%d/%Y') rescue nil)
= f.hidden_field :budget_agreed_upon_date, value: nil,
class: 'budget-agreed-upon-setter'
- if protocol.has_clinical_services?
.negotiated-amount.hide
= f.label :negotiated_amount,
.negotiated-amount-cs.hide
= f.label :negotiated_amount_clinical_services,
t(:proper)[:service_details][:negotiated_amount_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.input-group
.input-group-addon $
= f.number_field :negotiated_amount,
class: 'form-control'
- else
.negotiated-amount.hide
= f.label :negotiated_amount,
t(:proper)[:service_details][:negotiated_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :negotiated_amount,
= f.number_field :negotiated_amount_clinical_services,
class: 'form-control'
.negotiated-amount.hide
= f.label :negotiated_amount,
t(:proper)[:service_details][:negotiated_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :negotiated_amount,
class: 'form-control'
59 changes: 29 additions & 30 deletions app/views/service_requests/service_details/_details_dates.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -70,55 +70,54 @@
= f.label :initial_budget_sponsor_received_date,
t(:proper)[:service_details][:initial_budget_sponsor_received_date],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
= f.text_field :initial_budget_sponsor_received_date,
class: 'datetimepicker form-control initial-budget-sponsor-received-date-picker',
value: (service_request.protocol.initial_budget_sponsor_received_date.strftime('%_m/%d/%Y') rescue nil)
- if service_request.has_ctrc_clinical_services?
- if service_request.has_per_patient_per_visit_services?
.initial-amount.hide
= f.label :initial_amount,
= f.label :initial_amount_clinical_services,
t(:proper)[:service_details][:initial_amount_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :initial_amount,
class: 'form-control'
- else
.initial-amount.hide
= f.label :initial_amount,
t(:proper)[:service_details][:initial_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.input-group
.input-group-addon $
= f.number_field :initial_amount,
= f.number_field :initial_amount_clinical_services,
class: 'form-control'

.initial-amount.hide
= f.label :initial_amount,
t(:proper)[:service_details][:initial_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :initial_amount,
class: 'form-control'
.form-group.col-lg-12#budget-agreed-upon-date
= f.label :budget_agreed_upon_date,
t(:proper)[:service_details][:budget_agreed_upon_date],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
= f.text_field :budget_agreed_upon_date,
class: 'datetimepicker form-control budget-agreed-upon-date-picker',
value: (service_request.protocol.budget_agreed_upon_date.strftime('%_m/%d/%Y') rescue nil)
- if service_request.has_ctrc_clinical_services?
- if service_request.has_per_patient_per_visit_services?
.negotiated-amount.hide
= f.label :negotiated_amount,
= f.label :negotiated_amount_clinical_services,
t(:proper)[:service_details][:negotiated_amount_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.input-group
.input-group-addon $
= f.number_field :negotiated_amount,
class: 'form-control'
- else
.negotiated-amount.hide
= f.label :negotiated_amount,
t(:proper)[:service_details][:negotiated_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-4
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :negotiated_amount,
= f.number_field :negotiated_amount_clinical_services,
class: 'form-control'
.negotiated-amount.hide
= f.label :negotiated_amount,
t(:proper)[:service_details][:negotiated_amount_non_clinical_services],
class: 'col-lg-2 control-label'
.col-lg-2
.input-group
.input-group-addon $
= f.number_field :negotiated_amount,
class: 'form-control'
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
class AddInitialAmountAndNegotiatedAmountToProtocols < ActiveRecord::Migration[5.1]
def change
add_column :protocols, :initial_amount, :decimal, precision: 8, scale: 2, after: :budget_agreed_upon_date
add_column :protocols, :negotiated_amount, :decimal, precision: 8, scale: 2, after: :initial_amount
add_column :protocols, :initial_amount_clinical_services, :decimal, precision: 8, scale: 2, after: :initial_amount
add_column :protocols, :negotiated_amount, :decimal, precision: 8, scale: 2, after: :initial_amount_clinical_services
add_column :protocols, :negotiated_amount_clinical_services, :decimal, precision: 8, scale: 2, after: :negotiated_amount
end
end
24 changes: 4 additions & 20 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
# Copyright © 2011-2018 MUSC Foundation for Research Development~
# All rights reserved.~

# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~

# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.~

# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following~
# disclaimer in the documentation and/or other materials provided with the distribution.~

# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products~
# derived from this software without specific prior written permission.~

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,~
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT~
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL~
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS~
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR~
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.~

# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
Expand Down Expand Up @@ -633,7 +613,11 @@
t.datetime "initial_budget_sponsor_received_date"
t.datetime "budget_agreed_upon_date"
t.decimal "initial_amount", precision: 8, scale: 2
t.decimal "initial_amount_clinical_services", precision: 8, scale: 2
t.decimal "negotiated_amount", precision: 8, scale: 2
t.decimal "negotiated_amount_clinical_services", precision: 8, scale: 2
t.decimal "initial_amount_ctrc", precision: 8, scale: 2
t.decimal "negotiated_amount_ctrc", precision: 8, scale: 2
t.string "billing_business_manager_static_email"
t.datetime "recruitment_start_date"
t.datetime "recruitment_end_date"
Expand Down
4 changes: 2 additions & 2 deletions spec/api/v1/protocols/get_protocol_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
parsed_body = JSON.parse(response.body)
expected_attributes = build(:protocol).attributes.
keys.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount'].include?(key) }.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount', 'initial_amount_clinical_services', 'negotiated_amount_clinical_services'].include?(key) }.
push('callback_url', 'sparc_id').
sort
expect(parsed_body['protocol'].keys.sort).to eq(expected_attributes)
Expand All @@ -81,7 +81,7 @@
parsed_body = JSON.parse(response.body)
expected_attributes = build(:protocol).attributes.
keys.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount'].include?(key) }.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount', 'initial_amount_clinical_services', 'negotiated_amount_clinical_services'].include?(key) }.
push('callback_url', 'sparc_id', 'arms', 'service_requests', 'project_roles', 'human_subjects_info').
sort

Expand Down
4 changes: 2 additions & 2 deletions spec/api/v1/protocols/get_protocols_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
parsed_body = JSON.parse(response.body)
expected_attributes = build(:protocol).attributes.
keys.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount'].include?(key) }.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount', 'initial_amount_clinical_services', 'negotiated_amount_clinical_services'].include?(key) }.
push('callback_url', 'sparc_id').
sort

Expand All @@ -93,7 +93,7 @@
parsed_body = JSON.parse(response.body)
expected_attributes = build(:protocol).attributes.
keys.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount'].include?(key) }.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount', 'initial_amount_clinical_services', 'negotiated_amount_clinical_services'].include?(key) }.
push('callback_url', 'sparc_id', 'arms', 'service_requests', 'project_roles', 'human_subjects_info').
sort

Expand Down
4 changes: 2 additions & 2 deletions spec/api/v1/protocols/get_protocols_with_ids_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
parsed_body = JSON.parse(response.body)
expected_attributes = build(:protocol).attributes.
keys.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount'].include?(key) }.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount', 'initial_amount_clinical_services', 'negotiated_amount_clinical_services'].include?(key) }.
push('callback_url', 'sparc_id').
sort
expect(parsed_body['protocols'].map(&:keys).flatten.uniq.sort).to eq(expected_attributes)
Expand All @@ -93,7 +93,7 @@
parsed_body = JSON.parse(response.body)
expected_attributes = build(:protocol).attributes.
keys.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount'].include?(key) }.
reject { |key| ['study_phase', 'id', 'created_at', 'updated_at', 'deleted_at', 'research_master_id', 'sub_service_requests_count', 'rmid_validated', 'locked', 'budget_agreed_upon_date', 'initial_budget_sponsor_received_date', 'initial_amount', 'negotiated_amount', 'initial_amount_clinical_services', 'negotiated_amount_clinical_services'].include?(key) }.
push('callback_url', 'sparc_id', 'arms', 'service_requests', 'project_roles', 'human_subjects_info').
sort

Expand Down