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

Sj tm bootstrap reporting #429

Merged
merged 4 commits into from
May 27, 2016
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
24 changes: 24 additions & 0 deletions app/assets/stylesheets/dashboard/layout.css.sass
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@
margin-left: 5px
vertical-align: middle


// Custom Reporting Styling
h2.report_title
padding: 10px
margin-bottom: 50px

#reporting_form #report_fields .checkbox-inline
margin: 0px 30px 0 0
cursor: auto

#reporting_form .report_actions
margin-top: 40px

//Custom Navbar Styling
.navbar ol.breadcrumb
background: none
margin: 7px 0 0

#container nav.navbar-default .navbar-nav li
a:hover,
a:focus
background-color: #e7e7e7
color: #555

.accordion-heading
cursor: pointer

Expand Down
126 changes: 0 additions & 126 deletions app/assets/stylesheets/proper/reports.css.sass

This file was deleted.

12 changes: 7 additions & 5 deletions app/controllers/dashboard/protocols_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def index

@protocols = @filterrific.find.page(params[:page])
@protocol_filters = ProtocolFilter.latest_for_user(@user.id, 5)
#toggles the display of the navigation bar, instead of breadcrumbs
@show_navbar = true
session[:breadcrumbs].clear

respond_to do |format|
Expand Down Expand Up @@ -115,10 +117,10 @@ def edit
session[:breadcrumbs].
clear.
add_crumbs(protocol_id: @protocol.id, edit_protocol: true)

@protocol.valid?
@errors = @protocol.errors

respond_to do |format|
format.html
end
Expand All @@ -130,7 +132,7 @@ def update
attrs[:end_date] = Time.strptime(attrs[:end_date], "%m-%d-%Y") if attrs[:end_date]

protocol_role = @protocol.project_roles.find_by(identity_id: @user.id)

# admin is not able to activate study_type_question_group
if @admin && protocol_role.nil? && @protocol.update_attributes(attrs)
flash[:success] = "#{@protocol.type} Updated!"
Expand All @@ -154,10 +156,10 @@ def update_protocol_type

@protocol.update_attribute(:type, @protocol_type)
conditionally_activate_protocol

@protocol = Protocol.find(@protocol.id)#Protocol type has been converted, this is a reload
@protocol.populate_for_edit

flash[:success] = "Protocol Type Updated!"
if @protocol_type == "Study" && @protocol.sponsor_name.nil? && @protocol.selected_for_epic.nil?
flash[:alert] = "Please complete Sponsor Name and Publish Study in Epic"
Expand Down
21 changes: 13 additions & 8 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,21 @@ class ReportsController < ApplicationController
before_filter :authenticate_identity!
before_filter :require_super_user, :only => [:index, :setup, :generate]
before_filter :set_user
before_filter :set_show_navbar

def current_user
current_identity
end

def set_user
@user = current_identity
session['uid'] = @user.nil? ? nil : @user.id
end

def set_show_navbar
@show_navbar = true
end

def require_super_user
redirect_to root_path unless current_identity.is_super_user?
end
Expand All @@ -56,7 +61,7 @@ def generate
@report = report.constantize.new report_params

# generate excel
tempfile = @report.to_excel
tempfile = @report.to_excel
send_file tempfile.path, :filename => 'report.xlsx', :disposition => 'inline', :type => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

# generate csv
Expand All @@ -66,7 +71,7 @@ def generate

def research_project_summary
@sub_service_request = SubServiceRequest.find params[:id]
@service_request = @sub_service_request.service_request
@service_request = @sub_service_request.service_request
@protocol = @service_request.protocol
@start_date = params[:start_date].blank? ? nil : Date.parse(params[:start_date])
@end_date = params[:end_date].blank? ? nil : Date.parse(params[:end_date])
Expand All @@ -77,7 +82,7 @@ def research_project_summary
xlsx.class.class_eval { attr_accessor :original_filename, :content_type }
xlsx.original_filename = "research_project_summary.xlsx"
xlsx.content_type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

report = @sub_service_request.reports.new
report.xlsx = xlsx
report.report_type = "research_project_summary"
Expand All @@ -89,7 +94,7 @@ def research_project_summary

def cwf_audit
included_cores = params[:organizations] || []

@ssr = SubServiceRequest.find params[:id]

if params[:min_start_date].to_time.strftime('%Y-%m-%d') == params[:cwf_audit_start_date]
Expand All @@ -110,7 +115,7 @@ def cwf_audit
@audit_trail += @ssr.subsidy.audit_trail start_date, end_date
end
@audit_trail += @ssr.reports.map{|x| x.audit_trail start_date, end_date}

@ssr.service_request.protocol.arms.each do |arm|
@audit_trail += arm.audit_trail start_date, end_date
@audit_trail += arm.line_items_visits.includes(:line_item => :service).where("services.organization_id IN (?)", included_cores).map{|x| x.audit_trail start_date, end_date}
Expand All @@ -121,7 +126,7 @@ def cwf_audit
@audit_trail += subject.calendar.audit_trail start_date, end_date
@audit_trail += subject.calendar.appointments.map{|x| x.audit_trail start_date, end_date}
end

subject.calendar.appointments.where("organization_id IN (?)", included_cores).each do |appointment|
@audit_trail += appointment.procedures.includes(:service).where("services.organization_id IN (?)", included_cores).map{|x| x.audit_trail start_date, end_date}
@audit_trail += appointment.procedures.includes(:line_item => :service).where("services.organization_id IN (?)", included_cores).map{|x| x.audit_trail start_date, end_date}
Expand All @@ -143,7 +148,7 @@ def cwf_subject
@subject.calendar.build_subject_data
@arm = Arm.find params[:arm]
@sub_service_request = SubServiceRequest.find params[:id]
@service_request = @sub_service_request.service_request
@service_request = @sub_service_request.service_request
@protocol = @service_request.protocol
end
end
15 changes: 11 additions & 4 deletions app/views/layouts/dashboard/_dashboard_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@
%nav.navbar.navbar-default.portal-nav
.container-fluid
.navbar-header
%p.navbar-text#breadcrumbs
= session[:breadcrumbs].breadcrumbs
%p.navbar-text
= show_welcome_message(user)
- if @show_navbar
%ul.nav.navbar-nav
- NAVBAR_LINKS.each do |name, path|
%li= link_to name.to_s, path, target: '_blank'
- else
%ol.breadcrumb
= session[:breadcrumbs].breadcrumbs

%ul.nav.navbar-nav.navbar-right
%li
- if QUEUE_EPIC_EDIT_LDAP_UIDS.include?(user.ldap_uid)
Expand All @@ -34,3 +38,6 @@
= t(:dashboard)[:navbar][:messages]
%span.badge
= user.unread_notification_count

%p.navbar-text.navbar-right
= show_welcome_message(user)
59 changes: 40 additions & 19 deletions app/views/layouts/reporting.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,50 @@
-# 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.

!!! 1.1
%html{"xml:lang" => "en", :xmlns => "http://www.w3.org/1999/xhtml"}
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title= t 'application_title'
= stylesheet_link_tag "#{CUSTOM_ASSET_PATH}application", '960', 'jquery-ui', :media => 'all'
= javascript_include_tag "application"
%title SPARC Request Reporting
= stylesheet_link_tag "#{CUSTOM_ASSET_PATH}dashboard/application"
= javascript_include_tag 'application'
= javascript_include_tag 'jquery.qtip.min.js'
/[if IE]
= stylesheet_link_tag 'ie'
/[if gt IE 7]
= stylesheet_link_tag 'ie8_plus'
/[if lt IE 8]
= javascript_include_tag "ie7_warning"
= csrf_meta_tags
:javascript
window.I18n = #{current_translations.to_json.html_safe};
%body
// load spinner and cancel images so they are cached
= image_tag 'spinner.gif', :style => 'display:none'

%body#body
#ie7_warning{style: 'display: none'}
%p
= t('ie_warning.text1')
%br
%p
= t('ie_warning.text2')

= image_tag 'cancel.png', :style => 'display:none'

#container.container
= render 'shared/header_logos', in_dashboard: false
#welcome_msg= show_welcome_message(current_user)
#sparc_logo_header
= image_tag('sparc_request_header.jpg')
#right_header
#content.container_12
- flash.each do |name, msg|
= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String)
#container
#processing_request.ui-corner-all{style: 'display:none'}
%br
= t(:cm_index)[:processing]
%br
= image_tag 'spinner.gif'
#header
= render 'shared/header_logos', in_dashboard: true
%input#current_user_id{type: 'hidden', value: @user.try(:id)}
= render 'layouts/dashboard/dashboard_header', user: @user

.notification_dialog
.flash
= render "shared/flash"
#inner-content
= yield
= render :partial => 'shared/piwik_tracking' if Rails.env == 'production'

%footer
= render 'shared/piwik_tracking' if Rails.env == 'production'
= render 'shared/modal'