renalware-core 2.0.125 → 2.0.126

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/renalware/components/masonry.run.js +28 -3
  3. data/app/assets/javascripts/renalware/components/tabs.js +12 -9
  4. data/app/assets/javascripts/renalware/components/toggler.js +29 -0
  5. data/app/assets/stylesheets/renalware/modules/_hd.scss +52 -33
  6. data/app/assets/stylesheets/renalware/partials/_tabs.scss +26 -0
  7. data/app/assets/stylesheets/renalware/partials/_toggling.scss +23 -0
  8. data/app/controllers/renalware/events/lists_controller.rb +58 -0
  9. data/app/controllers/renalware/hd/sessions_controller.rb +13 -1
  10. data/app/helpers/renalware/toggle_helper.rb +25 -0
  11. data/app/models/renalware/events/event_list_query.rb +45 -0
  12. data/app/models/renalware/events/lists/form.rb +41 -0
  13. data/app/models/renalware/hd/prescription_administration.rb +1 -0
  14. data/app/presenters/renalware/hd/dashboard_presenter.rb +14 -3
  15. data/app/presenters/renalware/hd/session_presenter.rb +3 -3
  16. data/app/presenters/renalware/medications/prescription_presenter.rb +9 -0
  17. data/app/views/renalware/events/events/_event.html.slim +2 -0
  18. data/app/views/renalware/events/events/_table.html.slim +8 -3
  19. data/app/views/renalware/events/lists/_filters.html.slim +29 -0
  20. data/app/views/renalware/events/lists/_table.html.slim +29 -0
  21. data/app/views/renalware/events/lists/_tabs.html.slim +0 -0
  22. data/app/views/renalware/events/lists/show.slim +9 -0
  23. data/app/views/renalware/hd/current_profile/_summary.html.slim +1 -1
  24. data/app/views/renalware/hd/historical_profiles/_table.html.slim +1 -1
  25. data/app/views/renalware/hd/sessions/_administered_drugs_row.html.slim +27 -0
  26. data/app/views/renalware/hd/sessions/_administered_drugs_thead.html.slim +11 -0
  27. data/app/views/renalware/hd/sessions/_row.html.slim +43 -43
  28. data/app/views/renalware/hd/sessions/_table.html.slim +25 -7
  29. data/app/views/renalware/hd/sessions/_thead.html.slim +5 -2
  30. data/app/views/renalware/hd/sessions/closed/_administered_drugs_row.html.slim +3 -0
  31. data/app/views/renalware/hd/sessions/dna/_administered_drugs_row.html.slim +11 -0
  32. data/app/views/renalware/hd/sessions/dna/_row.html.slim +12 -14
  33. data/app/views/renalware/hd/sessions/open/_administered_drugs_row.html.slim +3 -0
  34. data/app/views/renalware/mdm/_prescriptions.html.slim +2 -2
  35. data/app/views/renalware/navigation/_renal.html.slim +1 -0
  36. data/app/views/renalware/transplants/mdm/_prescriptions.html.slim +4 -4
  37. data/config/locales/renalware/events/events.yml +1 -0
  38. data/config/locales/renalware/hd/session.en.yml +3 -0
  39. data/config/locales/renalware/navigation/renal.en.yml +1 -0
  40. data/config/routes/events.rb +8 -0
  41. data/db/migrate/20191203112310_add_pg_stat_statements_extension.rb +6 -0
  42. data/lib/renalware/version.rb +1 -1
  43. metadata +15 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f02d9c6095c5d84a50a76fb8b2b1a5c0167a5fbad53fbfdf886ac610e162dca3
4
- data.tar.gz: fd8ac6bdca0f0b55ebb66c490ef77db34efca9f644ea88594d38fd74bb30d593
3
+ metadata.gz: c1b4b5e0615d605d093018e57c295da81fa8b2c7b51bd83b8ab02065ce357c91
4
+ data.tar.gz: f78640822218ff8dfbae7ef9281d0cb9c5636791222fbb06a37cd36001b41ee8
5
5
  SHA512:
6
- metadata.gz: 8ec5256950daad498967c57453f259a84fcace23c47006316c1e1a838d93db7edf0ea70353a875bece3dbd3c60c9fcafeab3c13c68a91f3ae3bb9897eab70da0
7
- data.tar.gz: ac3ceff3c0f484bab79c5b00ca2bb78d64b6132455bb39e0eedad01163717be0b488c4107596ab0d93e8a0280fd835b3ad4940d80f37b147621b0780df294b67
6
+ metadata.gz: a4074e24c734e3c38efb99687920d41ab1ac0e555dc6663a7cc356fc8035465b94ffa18be1ddcf8c2bbafd2e347a77caf0cf7806cd7d201980e699d8077bfcb6
7
+ data.tar.gz: 680f524d251700a637fec7a8900a4c242cc691fad41d868254a773bd8de314859fbd7510bcb67fc01481cb300456b1bbebfee17aac0df95f0d86b63671ddd18e
@@ -1,3 +1,28 @@
1
- $('.grid > .row').masonry({
2
- itemSelector: '.columns'
3
- });
1
+ var Renalware = typeof Renalware === 'undefined' ? {} : Renalware;
2
+
3
+ Renalware.MasonryHelper = (function() {
4
+ var setupMasonry = function() {
5
+ $('.grid > .row').masonry({ itemSelector: '.columns' });
6
+ }
7
+
8
+ var refreshMasonry = function() {
9
+ $('.grid > .row').masonry('layout');
10
+ }
11
+
12
+ var triggerMasonryRefresh = function() {
13
+ setTimeout(refreshMasonry, 100);
14
+ }
15
+
16
+ var createHandlerToTriggerMasonryRefresh = function() {
17
+ $("[data-trigger-masonry-refresh]").on("click", triggerMasonryRefresh);
18
+ }
19
+
20
+ return {
21
+ init: function () {
22
+ setupMasonry();
23
+ createHandlerToTriggerMasonryRefresh();
24
+ }
25
+ };
26
+ }());
27
+
28
+ $(document).ready(Renalware.MasonryHelper.init);
@@ -1,13 +1,16 @@
1
1
  function initTabs() {
2
- function masonryLayoutRefresh() {
3
- $('.grid > .row').masonry('layout');
4
- }
5
-
6
- function triggerMasonryLayoutRefresh() {
7
- setTimeout(masonryLayoutRefresh, 200)
8
- }
9
-
10
- $(".tab-strip a").on("click", triggerMasonryLayoutRefresh);
2
+ $(".sub-nav.with-tabs dl a").on("click", function(e) {
3
+ e.preventDefault();
4
+ var anchor = e.target
5
+ var dl = $(anchor).closest("dl");
6
+ var dd = $(anchor).closest("dd");
7
+ var idToDeactivate = $("dd.active a", dl).attr("href");
8
+ $("dd.active", dl).removeClass("active")
9
+ $(dd).addClass("active");
10
+ var idToActivate = anchor.getAttribute("href");
11
+ $(idToDeactivate).hide();
12
+ $(idToActivate).show();
13
+ })
11
14
  }
12
15
 
13
16
  $(function() {
@@ -57,6 +57,35 @@ function initTogglers() {
57
57
  triggerMasonryLayoutRefresh();
58
58
  })
59
59
  }
60
+
61
+ // These two handlers mimic the row-toggler stimulus stimulus controller methods which
62
+ // are not ywt wired up because of lack of stimulus polyfill support in the asset pipline
63
+ // which means stimulus will not work with IE11. Hence the use of data-action etc here so
64
+ // once stimulus is working we can remove these 2 handlers without changing any markup.
65
+
66
+ // This handler toggles the last tr in the current tbody. We use multiple tbodys in each table
67
+ // to make toggling like this simpler, and to group the related (visible and toggleable) rows
68
+ // together.
69
+ // Note table must have the .toggleable class
70
+ $("a[data-action='row-toggler#toggleRow']").on("click", function(event) {
71
+ event.preventDefault();
72
+ $(event.target).closest("tbody").toggleClass("toggleable--open");
73
+ triggerMasonryLayoutRefresh();
74
+ });
75
+
76
+ // This handler toggles the last tr in each tbody in the current table.
77
+ // The link will probably sit in a thead < th
78
+ $("a[data-action='row-toggler#toggleTable']").on("click", function(event) {
79
+ event.preventDefault();
80
+ var link = event.target;
81
+ var table = $(link).closest("table");
82
+ var thead = $(link).closest("thead");
83
+ var tbodies = $("tbody", table);
84
+ var hide = thead.hasClass("toggleable--open");
85
+ thead.toggleClass("toggleable--open");
86
+ $(tbodies).toggleClass("toggleable--open", !hide);
87
+ triggerMasonryLayoutRefresh();
88
+ });
60
89
  }
61
90
 
62
91
  $(function() {
@@ -254,7 +254,7 @@ label#toggle-full-hd-profile {
254
254
  .full-hd-profile {
255
255
  max-height: 0;
256
256
  overflow-y: hidden;
257
- transition: max-height .3s ease 0s;
257
+ //transition: max-height .3s ease 0s;
258
258
  }
259
259
 
260
260
  input#toggle-full-hd-profile-input {
@@ -268,8 +268,9 @@ input#toggle-full-hd-profile-input {
268
268
  // End CSS-only toggle of full HD Profile
269
269
 
270
270
  table.hd-sessions {
271
- border-collapse: collapse;
272
271
  border-spacing: 0;
272
+ border-collapse: collapse;
273
+
273
274
  td {
274
275
  height: 2rem;
275
276
  }
@@ -279,13 +280,11 @@ table.hd-sessions {
279
280
  }
280
281
 
281
282
  thead {
282
- tr {
283
- &:nth-of-type(even) {
284
- background-color: #f5f5f5;
285
- }
283
+ border-bottom: solid 1px #222;
286
284
 
285
+ tr {
287
286
  th {
288
- border: 1px solid #ddd;
287
+ border-bottom: none;
289
288
  padding: 3px;
290
289
  vertical-align: top;
291
290
  }
@@ -300,41 +299,38 @@ table.hd-sessions {
300
299
  }
301
300
 
302
301
  tbody {
303
- tr {
304
- &:nth-of-type(even) {
305
- background-color: $white;
306
- }
302
+ border-top: solid 1px #555;
307
303
 
308
- &:nth-of-type(odd) {
309
- background-color: $white;
310
- }
304
+ &:last-child {
305
+ border-bottom: solid 1px #BBB;
306
+ }
311
307
 
312
- &.even{
313
- background-color: #f9f9f9;
314
- }
308
+ &:hover {
309
+ background-color: $table-row-hover-colour !important;
310
+ }
315
311
 
316
- &.open {
317
- td {
318
- background-color: #ffffc8;
319
- }
312
+ &.dna {
313
+ td {
314
+ background-color: #E6EFF8;
320
315
  }
316
+ }
321
317
 
322
- &.dna {
323
- td {
324
- background-color: #ccc;
325
- }
318
+ &.open {
319
+ td {
320
+ background-color: #FFF1CC; // #FFF1CC; // #ffffc8;
326
321
  }
322
+ }
327
323
 
324
+ &.dna {
328
325
  td {
329
- border-right: 1px solid #ddd;
330
-
331
- &:first-child {
332
- border-left: 1px solid #ddd;
333
- }
326
+ // background-color: #eee;
327
+ background-color: #E6EFF8;
328
+ }
329
+ }
334
330
 
335
- &.derived {
336
- font-style: italic;
337
- }
331
+ td {
332
+ &.derived {
333
+ font-style: italic;
338
334
  }
339
335
  }
340
336
  }
@@ -598,3 +594,26 @@ use flexbox to layout items inside each prescription.
598
594
  }
599
595
  }
600
596
  }
597
+
598
+ table.hd-session-drugs {
599
+ thead {
600
+ border-bottom: solid 1px #222;
601
+ }
602
+
603
+ tr {
604
+ span.given {
605
+ @include badge;
606
+ }
607
+ &.administered-true {
608
+ span.given {
609
+ background-color: $nhs-light-green;
610
+ }
611
+ }
612
+
613
+ &.administered-false {
614
+ span.given {
615
+ background-color: $nhs-red;
616
+ }
617
+ }
618
+ }
619
+ }
@@ -81,3 +81,29 @@
81
81
  }
82
82
  }
83
83
  }
84
+
85
+
86
+ .sub-nav {
87
+ &.with-tabs {
88
+ position: relative;
89
+ margin: 0;
90
+ padding: 0;
91
+
92
+ dl {
93
+ position: relative;
94
+ top: 1px;
95
+ z-index: 2; // So we can overlap .tab-bottom-border
96
+ }
97
+
98
+ .tab-bottom-border {
99
+ position: relative;
100
+ display: block;
101
+ z-index: 0;
102
+ color: $table-border-colour;
103
+ background-color: $table-border-colour;
104
+ padding: 0;
105
+ margin: 0;
106
+ margin-bottom: 1rem;
107
+ }
108
+ }
109
+ }
@@ -36,3 +36,26 @@ th.togglers .toggler {
36
36
  th.togglers {
37
37
  width: 1rem;
38
38
  }
39
+
40
+ // row-toggler-controller classes
41
+ .toggleable {
42
+ .toggleable--open {
43
+ td .toggler i:before {
44
+ content: asset-data-url("renalware/icons/chevron-up.svg");
45
+ }
46
+
47
+ th .toggler i:before {
48
+ content: asset-data-url("renalware/icons/chevrons-up.svg");
49
+ }
50
+ }
51
+
52
+ tbody {
53
+ tr:last-child {
54
+ display: none
55
+ }
56
+
57
+ &.toggleable--open tr:last-child {
58
+ display: table-row;
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/events"
4
+
5
+ module Renalware
6
+ module Events
7
+ class ListsController < BaseController
8
+ include Renalware::Concerns::Pageable
9
+
10
+ def show
11
+ query = EventListQuery.new(params: form.attributes)
12
+ events = query.call.page(page).per(per_page)
13
+ authorize events
14
+ render locals: { events: events, q: query.search, form: form }
15
+ end
16
+
17
+ private
18
+
19
+ def form
20
+ @form ||= form_for(named_filter)
21
+ end
22
+
23
+ # Get requests to #show may have a filter param {} if filters where selectec (eg an event
24
+ # type) and if any sorting was done there will also be e.g. params[:q][:s] = "something asc"
25
+ # The EventListQuery just accepts our form object, from which it attributes to ransack, so
26
+ # here we need to make sure the search
27
+ def form_for(named_filter)
28
+ Lists::Form.new(
29
+ named_filter: named_filter,
30
+ params: add_ransack_search_param_to_filter_parameters
31
+ )
32
+ end
33
+
34
+ def named_filter
35
+ @named_filter ||= params.fetch(:named_filter, "all").to_sym
36
+ end
37
+
38
+ def add_ransack_search_param_to_filter_parameters
39
+ filter_parameters.merge(s: params.dig(:q, :s))
40
+ end
41
+
42
+ def filter_parameters
43
+ return {} unless params.key?(:filters)
44
+
45
+ params
46
+ .require(:filters)
47
+ .permit(
48
+ :event_type_id_eq,
49
+ :created_by_id_eq,
50
+ :created_at_gteq,
51
+ :created_at_lteq,
52
+ :from,
53
+ :to
54
+ )
55
+ end
56
+ end
57
+ end
58
+ end
@@ -16,7 +16,19 @@ module Renalware
16
16
  query = sessions_query
17
17
  sessions = query
18
18
  .call
19
- .includes(:hospital_unit, :patient, :signed_on_by, :signed_off_by)
19
+ .eager_load(
20
+ :hospital_unit,
21
+ :patient,
22
+ :signed_on_by,
23
+ :signed_off_by,
24
+ prescription_administrations: [
25
+ {
26
+ prescription: [:medication_route, :drug]
27
+ },
28
+ :administered_by,
29
+ :reason
30
+ ])
31
+ .merge(PrescriptionAdministration.ordered)
20
32
  .page(page)
21
33
  .per(per_page || 15)
22
34
  authorize sessions
@@ -42,5 +42,30 @@ module Renalware
42
42
  toggler(row_selector)
43
43
  end
44
44
  end
45
+
46
+ # Create a link in a thead > tr > th that will toggle the last row in all tbodies in the table.
47
+ def rows_toggler(link_title: "Toggle all rows")
48
+ link_to(
49
+ "#",
50
+ data: { action: "row-toggler#toggleTable" },
51
+ class: "toggler",
52
+ title: link_title
53
+ ) do
54
+ content_tag(:i)
55
+ end
56
+ end
57
+
58
+ # Create a link to be used in a tbody > tr > td that will toggle the last row in the current
59
+ # tbody.
60
+ def row_toggler(link_title: "Toggle")
61
+ link_to(
62
+ "#",
63
+ data: { action: "row-toggler#toggleRow" },
64
+ class: "toggler",
65
+ title: link_title
66
+ ) do
67
+ content_tag(:i)
68
+ end
69
+ end
45
70
  end
46
71
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "renalware/clinics"
4
+
5
+ module Renalware
6
+ module Events
7
+ class EventListQuery
8
+ attr_reader :params
9
+
10
+ def initialize(params: {})
11
+ @params = params
12
+ @params[:s] = "created_at DESC" if @params[:s].blank?
13
+ end
14
+
15
+ def call
16
+ search
17
+ .result
18
+ .eager_load(:event_type, :created_by, :patient)
19
+ .ordered
20
+ end
21
+
22
+ def search
23
+ @search ||= Event.include(Ransackers).ransack(params)
24
+ end
25
+
26
+ # Create ransackers to mixin to Event at runtime.
27
+ # These for instance cast created_at to a date so that for instance the predicate
28
+ # created_gteq excludes any time references - using created_gteq and created_lteq without
29
+ # this creates SQL that cannot find an event on one day, because of the way Ransack adds
30
+ # start of date and end of day times.
31
+ module Ransackers
32
+ extend ActiveSupport::Concern
33
+ included do
34
+ ransacker :created_at, type: :date do
35
+ Arel.sql("DATE(events.created_at)")
36
+ end
37
+
38
+ ransacker :created_at, type: :date do
39
+ Arel.sql("DATE(events.created_at)")
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Renalware
4
+ module Events
5
+ module Lists
6
+ # Form object to help us build and parse the appropriate filters for the
7
+ # events_lists controller
8
+ class Form
9
+ delegate_missing_to :@handler
10
+
11
+ def initialize(named_filter:, params: {})
12
+ @handler = create_filter_specific_object_to_handle_all_requests(named_filter, params)
13
+ end
14
+
15
+ def create_filter_specific_object_to_handle_all_requests(named_filter, params)
16
+ handler_klass = "#{self.class.name}::#{named_filter.to_s.classify}Events"
17
+ handler_klass.constantize.new(params)
18
+ end
19
+
20
+ class AllEvents
21
+ include ActiveModel::Model
22
+ include Virtus::Model
23
+
24
+ attribute :s, String # sort order, not really part of the form
25
+ attribute :event_type_id_eq, Integer
26
+ attribute :created_by_id_eq, Integer
27
+ attribute :created_at_gteq, Date
28
+ attribute :created_at_lteq, Date
29
+
30
+ def event_type_options
31
+ Events::Type.order(:name).pluck(:name, :id)
32
+ end
33
+
34
+ def created_by_options
35
+ User.excluding_system_user.ordered
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -24,6 +24,7 @@ module Renalware
24
24
  validates :witnessed_by, presence: true, if: :validate_administrator_and_witness?
25
25
  validate :check_administrator_authorisation_token
26
26
  validate :check_witness_authorisation_token
27
+ scope :ordered, -> { order(created_at: :desc) }
27
28
 
28
29
  private
29
30
 
@@ -45,14 +45,25 @@ module Renalware
45
45
  end
46
46
  end
47
47
 
48
+ # rubocop:disable Metrics/MethodLength
48
49
  def sessions
49
50
  @sessions ||= begin
50
- hd_sessions = Session.includes(:hospital_unit, :patient, :signed_on_by, :signed_off_by)
51
- .for_patient(patient)
52
- .limit(10).ordered
51
+ hd_sessions = Session
52
+ .eager_load(
53
+ :hospital_unit,
54
+ :patient,
55
+ :signed_on_by,
56
+ :signed_off_by,
57
+ prescription_administrations: [
58
+ { prescription: [:medication_route, :drug] }, :administered_by, :reason
59
+ ]
60
+ )
61
+ .for_patient(patient)
62
+ .limit(10).ordered.merge(PrescriptionAdministration.ordered)
53
63
  CollectionPresenter.new(hd_sessions, SessionPresenter, view_context)
54
64
  end
55
65
  end
66
+ # rubocop:enable Metrics/MethodLength
56
67
 
57
68
  def can_add_hd_profile?
58
69
  profile.new_record? && policy_for(profile).edit? && has_ever_been_on_hd?
@@ -153,9 +153,9 @@ module Renalware
153
153
  end
154
154
 
155
155
  # Ensure drug administrations are always in the same order.
156
- def prescription_administrations
157
- __getobj__.prescription_administrations.order(created_at: :asc)
158
- end
156
+ # def prescription_administrations
157
+ # __getobj__.prescription_administrations.order(created_at: :asc)
158
+ # end
159
159
 
160
160
  protected
161
161
 
@@ -38,6 +38,15 @@ module Renalware
38
38
  administer_on_hd ? "Yes" : "No"
39
39
  end
40
40
 
41
+ def to_s
42
+ [
43
+ drug,
44
+ "DOSE #{dose}",
45
+ route_code,
46
+ frequency
47
+ ].compact.join(" - ")
48
+ end
49
+
41
50
  private
42
51
 
43
52
  def translated_dose_unit
@@ -8,6 +8,8 @@ tr
8
8
  td.nowrap= l event.created_at.to_date
9
9
  - unless local_assigns[:exclude_type_column] == true
10
10
  td= event.event_type
11
+ - if local_assigns[:include_patient_column] == true
12
+ td= default_patient_link(event.patient)
11
13
  td.col-width-medium-with-ellipsis
12
14
  = render partial: event.to_cell_partial_path,
13
15
  locals: { event: event }
@@ -9,6 +9,8 @@ table.has-togglable-rows.events-table
9
9
  th.col-width-date=t(".created_at")
10
10
  - unless local_assigns.fetch(:exclude_type_column, false)
11
11
  th.col-width-large= t(".type")
12
+ - if local_assigns.fetch(:include_patient_column, false)
13
+ th.col-width-large= t(".patient")
12
14
  th= t(".description")
13
15
  th.created_at.col-width-date-time= t(".date_time")
14
16
  th.created_by.col-width-medium= t(".created_by")
@@ -18,6 +20,9 @@ table.has-togglable-rows.events-table
18
20
  / an Edit link or Type column in certain circumstances.
19
21
  = render partial: "renalware/events/events/event",
20
22
  collection: events,
21
- locals: { exclude_type_column: local_assigns[:exclude_type_column],
22
- edit_proc: local_assigns[:edit_proc],
23
- toggle_prefix: toggle_prefix }
23
+ locals: { \
24
+ exclude_type_column: local_assigns[:exclude_type_column],
25
+ include_patient_column: local_assigns[:include_patient_column],
26
+ edit_proc: local_assigns[:edit_proc],
27
+ toggle_prefix: toggle_prefix \
28
+ }
@@ -0,0 +1,29 @@
1
+ .search-form.filters
2
+ = simple_form_for form,
3
+ as: :filters,
4
+ url: renalware.events_filtered_list_path(named_filter: :all),
5
+ html: { autocomplete: "off" },
6
+ method: :get do |f|
7
+ .row
8
+ .small-6.medium-3.large-2.columns
9
+ = f.input :event_type_id_eq,
10
+ collection: form.event_type_options,
11
+ input_html: { class: "searchable_select" },
12
+ label: "Event type"
13
+ .small-6.medium-3.large-2.columns
14
+ = f.input :created_by_id_eq,
15
+ as: :user_picker,
16
+ collection: form.created_by_options,
17
+ label: "Created by"
18
+ .small-6.medium-2.large-2.columns
19
+ = f.input :created_at_gteq,
20
+ as: :date_picker,
21
+ label: "From"
22
+ .small-6.medium-2.large-2.columns
23
+ = f.input :created_at_lteq,
24
+ as: :date_picker,
25
+ label: "To"
26
+ .small-12.medium-2.large-2.columns.actions.end
27
+ = f.submit t("helpers.submit.filter"), class: "button secondary"
28
+ span= " or "
29
+ = link_to t("helpers.reset"), renalware.events_filtered_list_path(named_filter: :all)
@@ -0,0 +1,29 @@
1
+ /= render "renalware/events/events/table", events: events, include_patient_column: true
2
+
3
+ - toggle_prefix ||= "event"
4
+
5
+ table.has-togglable-rows.events-table
6
+ thead
7
+ tr
8
+ th.noprint.togglers= table_toggler
9
+ - if local_assigns[:edit_proc]
10
+ th.col-width-tiny
11
+ th.col-width-date= sort_link(q, :created_at, "Added", default_order: :desc)
12
+ th.col-width-large= sort_link(q, :event_type_name, "Type", default_order: :asc)
13
+ th.col-width-large= sort_link(q, :patient_family_name, ["patient_family_name", "patient_given_name asc"], "Patient")
14
+ th Desscription
15
+ th.created_at.col-width-date-time= sort_link(q, :date_time, "Date/Time", default_order: :desc)
16
+ th.created_by.col-width-medium= sort_link(q, :created_by_family_name, ["created_by_family_name", "created_by_given_name asc"], "Created by", default_order: :asc)
17
+ tbody
18
+ / Note we can't use cached: true yet when rendering the events collection, as each row is
19
+ / used in a different context and displays there slightly differently, for example showing
20
+ / an Edit link or Type column in certain circumstances.
21
+ = render partial: "renalware/events/events/event",
22
+ collection: events,
23
+ locals: { \
24
+ exclude_type_column: false,
25
+ include_patient_column: true,
26
+ toggle_prefix: toggle_prefix \
27
+ }
28
+
29
+ = paginate events
File without changes
@@ -0,0 +1,9 @@
1
+
2
+ = content_for(:tabs) do
3
+ = render "tabs"
4
+
5
+ = content_for(:filters) do
6
+ = render "filters", form: form
7
+
8
+ = within_admin_layout(title: "Events") do
9
+ = render "table", events: events, q: q
@@ -5,7 +5,7 @@ article.hd-profile-summary
5
5
  li= link_to "View", patient_hd_current_profile_path(patient), class: "button"
6
6
  li= link_to "Edit", edit_patient_hd_current_profile_path(patient), class: "button"
7
7
  li
8
- label#toggle-full-hd-profile(for="toggle-full-hd-profile-input") Toggle full profile
8
+ label.trigger-masonry-refresh#toggle-full-hd-profile(for="toggle-full-hd-profile-input") Toggle full profile
9
9
 
10
10
  input#toggle-full-hd-profile-input(type="checkbox")
11
11
 
@@ -10,7 +10,7 @@ table
10
10
  - else
11
11
  th.col-width-date-time Started
12
12
  th.col-width-date-time.at-least Stopped
13
- th.col-width-tiny Type
13
+ th Type
14
14
  th.col-width-tiny Time
15
15
  - unless compact
16
16
  th.col-width-medium Schedule
@@ -0,0 +1,27 @@
1
+ - drugs_count = session.prescription_administrations.length
2
+ - rows_span = drugs_count + 1
3
+ tbody.hd-session-row(class=[session.state, stripe_class])
4
+ tr
5
+ td.noprint(rowspan=rows_span)= row_toggler
6
+ td(rowspan=rows_span)= session.edit_or_view_url
7
+ td(rowspan=rows_span)= session.performed_on
8
+ td.col-width-medium-with-ellipsis(rowspan=rows_span)= session.hospital_unit_unit_code
9
+ - if drugs_count.zero?
10
+ td
11
+ td
12
+ td
13
+ td
14
+ td
15
+ - session.prescription_administrations.each do |da|
16
+ tr(class="administered-#{da.administered?}")
17
+ td= Renalware::Medications::PrescriptionPresenter.new(da.prescription).to_s
18
+ td
19
+ span.given= yes_no da.administered?
20
+ td.col-width-medium-with-ellipsis= da.administered_by
21
+ td.col-width-medium-with-ellipsis= da.reason&.name
22
+ td= da.notes
23
+ tr
24
+ td(colspan=9)
25
+ .quick-preview
26
+ = definition_list_for(session, size: :large) do |list|
27
+ = list.definition(:notes){ |value| simple_format(value) }
@@ -0,0 +1,11 @@
1
+ thead
2
+ tr
3
+ th.togglers.noprint= rows_toggler
4
+ th.noprint.col-width-small
5
+ th.col-width-date= t(".date")
6
+ th.col-width-small= t(".site")
7
+ th.col-width-large Prescription
8
+ th.col-width-tiny Given
9
+ th.col-width-small Given by
10
+ th.col-width-medium Reason not given
11
+ th Notes
@@ -1,44 +1,44 @@
1
- tr.hd-session-row(class=[session.state, stripe_class])
2
- td.noprint(rowspan=2)= toggler("#hd-session-#{session.id}")
3
- td.noprint(rowspan=2)
4
- = session.edit_or_view_url
5
- td.col-width-date(rowspan=2)= session.performed_on
6
- td= session.hospital_unit_unit_code
7
- td= session.start_time
8
- td.derived(rowspan=2)= session.duration
9
- td= session.before_measurement_for(:weight)
10
- td= session.before_measurement_for(:pulse)
11
- td= session.before_measurement_for(:temperature)
12
- td= session.before_measurement_for(:respiratory_rate)
13
- td.nowrap= session.before_measurement_for(:bm_stix)
14
- td.nowrap= session.before_measurement_for(:blood_pressure)
15
- td.nowrap(rowspan=2)= session.arterial_pressure
16
- td.nowrap(rowspan=2)= session.venous_pressure
17
- td.nowrap(rowspan=2)= session.blood_flow
18
- td.nowrap(rowspan=2)= session.litres_processed
19
- td.nowrap(rowspan=2)= session.fluid_removed
20
- td.nowrap(rowspan=2)= session.machine_no
21
- td.nowrap(rowspan=2)= session.machine_ktv
22
- td.nowrap(rowspan=2)= session.machine_urr
23
- td.print-only(rowspan=2)
24
- td.print-only(rowspan=2)= session.notes
25
- td.print-only= session.signed_on_by
1
+ tbody.hd-session-row(class=[session.state, stripe_class])
2
+ tr
3
+ td.noprint(rowspan=2)= row_toggler
4
+ td.noprint(rowspan=2)= session.edit_or_view_url
5
+ td.col-width-date(rowspan=2)= session.performed_on
6
+ td= session.hospital_unit_unit_code
7
+ td= session.start_time
8
+ td.derived(rowspan=2)= session.duration
9
+ td= session.before_measurement_for(:weight)
10
+ td= session.before_measurement_for(:pulse)
11
+ td= session.before_measurement_for(:temperature)
12
+ td= session.before_measurement_for(:respiratory_rate)
13
+ td.nowrap= session.before_measurement_for(:bm_stix)
14
+ td.nowrap= session.before_measurement_for(:blood_pressure)
15
+ td.nowrap(rowspan=2)= session.arterial_pressure
16
+ td.nowrap(rowspan=2)= session.venous_pressure
17
+ td.nowrap(rowspan=2)= session.blood_flow
18
+ td.nowrap(rowspan=2)= session.litres_processed
19
+ td.nowrap(rowspan=2)= session.fluid_removed
20
+ td.nowrap(rowspan=2)= session.machine_no
21
+ td.nowrap(rowspan=2)= session.machine_ktv
22
+ td.nowrap(rowspan=2)= session.machine_urr
23
+ td.print-only(rowspan=2)
24
+ td.print-only(rowspan=2)= session.notes
25
+ td.print-only= session.signed_on_by
26
26
 
27
- tr(class=[session.state, stripe_class])
28
- td= tooltip(label: session.summarised_access_used, content: session.access_used)
29
- td= session.end_time
30
- td.nowrap
31
- = session.after_measurement_for(:weight)
32
- - if (change = session.change_in(:weight))
33
- i=" (#{change})"
34
- td.nowrap= session.after_measurement_for(:pulse)
35
- td.nowrap= session.after_measurement_for(:temperature)
36
- td.nowrap= session.after_measurement_for(:respiratory_rate)
37
- td.nowrap= session.after_measurement_for(:bm_stix)
38
- td.nowrap= session.after_measurement_for(:blood_pressure)
39
- td.print-only= session.signed_off_by
40
- = content_tag(:tr, id: "hd-session-#{session.id}", style: "display: none")
41
- td(colspan=20)
42
- .quick-preview
43
- = definition_list_for(session, size: :large) do |list|
44
- = list.definition(:notes){ |value| simple_format(value) }
27
+ tr(class=[session.state, stripe_class])
28
+ td= tooltip(label: session.summarised_access_used, content: session.access_used)
29
+ td= session.end_time
30
+ td.nowrap
31
+ = session.after_measurement_for(:weight)
32
+ - if (change = session.change_in(:weight))
33
+ i=" (#{change})"
34
+ td.nowrap= session.after_measurement_for(:pulse)
35
+ td.nowrap= session.after_measurement_for(:temperature)
36
+ td.nowrap= session.after_measurement_for(:respiratory_rate)
37
+ td.nowrap= session.after_measurement_for(:bm_stix)
38
+ td.nowrap= session.after_measurement_for(:blood_pressure)
39
+ td.print-only= session.signed_off_by
40
+ tr
41
+ td(colspan=20)
42
+ .quick-preview
43
+ = definition_list_for(session, size: :large) do |list|
44
+ = list.definition(:notes){ |value| simple_format(value) }
@@ -1,9 +1,27 @@
1
- table.auto-layout.hd-sessions
1
+
2
+ .sub-nav.with-tabs
3
+ dl
4
+ dd.active
5
+ = link_to "Details", "#hd-sessions", data: { "trigger-masonry-refresh" => true }
6
+ dd
7
+ = link_to "Drugs given", "#hd-session-drugs", data: { "trigger-masonry-refresh" => true }
8
+ hr.tab-bottom-border
9
+ / .column_hover
10
+ table.toggleable.auto-layout.hd-sessions#hd-sessions
2
11
  = render "renalware/hd/sessions/thead"
3
12
 
4
- tbody
5
- - sessions.each_with_index do |session, index|
6
- - stripe_class = index % 2 == 0 ? "even" : "odd"
7
- = render "renalware/hd/sessions/#{session.state}/row",
8
- session: session,
9
- stripe_class: stripe_class
13
+ - sessions.each_with_index do |session, index|
14
+ - stripe_class = index % 2 == 0 ? "even" : "odd"
15
+ = render "renalware/hd/sessions/#{session.state}/row",
16
+ session: session,
17
+ stripe_class: stripe_class
18
+
19
+ /.column_hover
20
+ table.toggleable.auto-layout.hd-sessions.hd-session-drugs#hd-session-drugs(style="display: none")
21
+ = render "renalware/hd/sessions/administered_drugs_thead"
22
+
23
+ - sessions.each_with_index do |session, index|
24
+ - stripe_class = index % 2 == 0 ? "even" : "odd"
25
+ = render "renalware/hd/sessions/#{session.state}/administered_drugs_row",
26
+ session: session,
27
+ stripe_class: stripe_class
@@ -1,10 +1,12 @@
1
1
  thead
2
+ / - 20.times do
3
+ / colgroup
2
4
  tr
3
- th.togglers.noprint(rowspan=3)= table_toggler
5
+ th
4
6
  th.noprint.col-width-small(rowspan=3)
5
7
  th.col-width-date(rowspan=3 valign="top")= t(".date")
6
8
  th.col-width-small= t(".site")
7
- th.col-width-time.text-center= t(".time")
9
+ th.col-width-time= t(".time")
8
10
  th.col-width-time(rowspan=3)= t(".duration")
9
11
  th.col-width-tiny= t(".weight")
10
12
  th.col-width-tiny= t(".pulse")
@@ -23,6 +25,7 @@ thead
23
25
  th.col-width-user.text-center.print-only= t(".user")
24
26
 
25
27
  tr.row2
28
+ th.togglers.noprint(rowspan=2)= rows_toggler
26
29
  th(rowspan=2)= t(".access")
27
30
  th.col-width-time= t(".start_time")
28
31
  th.col-width-small= t(".pre")
@@ -0,0 +1,3 @@
1
+ = render "renalware/hd/sessions/administered_drugs_row",
2
+ session: session,
3
+ stripe_class: stripe_class
@@ -0,0 +1,11 @@
1
+ tbody(class=[session.state, stripe_class])
2
+ tr
3
+ td.noprint= row_toggler
4
+ td= session.performed_on
5
+ td= session.hospital_unit_unit_code
6
+ td(colspan=6) Did not attend
7
+ tr
8
+ td(colspan=10)
9
+ .quick-preview
10
+ = definition_list_for(session, size: :large) do |list|
11
+ = list.definition(:notes){ |value| simple_format(value) }
@@ -1,14 +1,12 @@
1
- tr(class=[session.state, stripe_class])
2
- td.noprint= toggler("#hd-session-#{session.id}")
3
- td.noprint
4
- = session.edit_or_view_url
5
- td= session.performed_on
6
- td= session.hospital_unit_unit_code
7
- td(colspan=3) Did not attend
8
- td(colspan=13)
9
- i= session.truncated_notes
10
- = content_tag(:tr, id: "hd-session-#{session.id}", style: "display: none")
11
- td(colspan=20)
12
- .quick-preview
13
- = definition_list_for(session, size: :large) do |list|
14
- = list.definition(:notes) { |value| simple_format(value) }
1
+ tbody(class=[session.state, stripe_class])
2
+ tr
3
+ td.noprint= row_toggler
4
+ td.noprint= session.edit_or_view_url
5
+ td= session.performed_on
6
+ td= session.hospital_unit_unit_code
7
+ td(colspan=16) Did not attend
8
+ tr
9
+ td(colspan=20)
10
+ .quick-preview
11
+ = definition_list_for(session, size: :large) do |list|
12
+ = list.definition(:notes){ |value| simple_format(value) }
@@ -0,0 +1,3 @@
1
+ = render "renalware/hd/sessions/administered_drugs_row",
2
+ session: session,
3
+ stripe_class: stripe_class
@@ -10,8 +10,8 @@ article
10
10
  - if local_assigns[:with_esa] == true
11
11
 
12
12
  ul.tab-strip(data-tab)
13
- li.tab-title.active= link_to "Current", "#current"
14
- li.tab-title= link_to "EPO History", "#epo-history"
13
+ li.tab-title.active= link_to "Current", "#current", data: { "trigger-masonry-refresh" => true }
14
+ li.tab-title= link_to "EPO History", "#epo-history", data: { "trigger-masonry-refresh" => true }
15
15
 
16
16
  .tabs-content
17
17
  #current.content.active
@@ -3,6 +3,7 @@ li.has-dropdown
3
3
  ul.dropdown
4
4
  li= link_to t(".appointments"), appointments_path
5
5
  li= link_to t(".clinic_visits"), clinic_visits_path
6
+ li= link_to t(".events"), events_filtered_list_path
6
7
  li= link_to t(".tx_wait_list"), transplants_wait_list_path(named_filter: "active")
7
8
  li= link_to t(".live_donors"), transplants_live_donors_path
8
9
  li= link_to t(".ongoing_hd_sessions"), hd_ongoing_sessions_path
@@ -8,10 +8,10 @@ article
8
8
  #prescriptions.expandable
9
9
 
10
10
  ul.tab-strip(data-tab)
11
- li.tab-title.active= link_to "Current", "#current"
12
- li.tab-title= link_to "Current Immunosuppressant", "#current_immunosuppressant"
13
- li.tab-title= link_to "Historical", "#historical"
14
- li.tab-title= link_to "Historical Immunosuppressant", "#historical_immunosuppressant"
11
+ li.tab-title.active= link_to "Current", "#current", data: { "trigger-masonry-refresh" => true }
12
+ li.tab-title= link_to "Current Immunosuppressant", "#current_immunosuppressant", data: { "trigger-masonry-refresh" => true }
13
+ li.tab-title= link_to "Historical", "#historical", data: { "trigger-masonry-refresh" => true }
14
+ li.tab-title= link_to "Historical Immunosuppressant", "#historical_immunosuppressant", data: { "trigger-masonry-refresh" => true }
15
15
 
16
16
  .tabs-content
17
17
  #current.content.active
@@ -8,6 +8,7 @@ en:
8
8
  description: Description
9
9
  date_time: Date/Time
10
10
  created_by: Created by
11
+ patient: Patient
11
12
  activerecord:
12
13
  attributes:
13
14
  renalware/events/event:
@@ -265,3 +265,6 @@ en:
265
265
  edit: Edit
266
266
  dna:
267
267
  edit: Edit
268
+ administered_drugs_thead:
269
+ date: Date
270
+ site: Site
@@ -5,6 +5,7 @@ en:
5
5
  menu_title: Renal
6
6
  appointments: Appointments
7
7
  clinic_visits: Clinic Visits
8
+ events: Events
8
9
  tx_wait_list: Tx Wait List
9
10
  live_donors: Live Donors
10
11
  ongoing_hd_sessions: Ongoing HD Sessions
@@ -26,4 +26,12 @@ end
26
26
 
27
27
  namespace :events do
28
28
  resources :types, except: :show
29
+ constraints(named_filter: /all/) do
30
+ get(
31
+ "list/:named_filter",
32
+ to: "lists#show",
33
+ as: :filtered_list,
34
+ defaults: { named_filter: "all" }
35
+ )
36
+ end
29
37
  end
@@ -0,0 +1,6 @@
1
+ class AddPgStatStatementsExtension < ActiveRecord::Migration[5.2]
2
+ def change
3
+ enable_extension "pg_stat_statements"
4
+ enable_extension "plpgsql"
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Renalware
4
- VERSION = "2.0.125"
4
+ VERSION = "2.0.126"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renalware-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.125
4
+ version: 2.0.126
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2019-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview-component
@@ -1171,6 +1171,7 @@ files:
1171
1171
  - app/controllers/renalware/drugs/drugs_controller.rb
1172
1172
  - app/controllers/renalware/events/events_controller.rb
1173
1173
  - app/controllers/renalware/events/investigations_controller.rb
1174
+ - app/controllers/renalware/events/lists_controller.rb
1174
1175
  - app/controllers/renalware/events/swabs_controller.rb
1175
1176
  - app/controllers/renalware/events/types_controller.rb
1176
1177
  - app/controllers/renalware/feeds/hl7_test_messages_controller.rb
@@ -1496,9 +1497,11 @@ files:
1496
1497
  - app/models/renalware/events/biopsy.rb
1497
1498
  - app/models/renalware/events/create_event.rb
1498
1499
  - app/models/renalware/events/event.rb
1500
+ - app/models/renalware/events/event_list_query.rb
1499
1501
  - app/models/renalware/events/event_query.rb
1500
1502
  - app/models/renalware/events/investigation.rb
1501
1503
  - app/models/renalware/events/line_change_event_query.rb
1504
+ - app/models/renalware/events/lists/form.rb
1502
1505
  - app/models/renalware/events/simple.rb
1503
1506
  - app/models/renalware/events/swab.rb
1504
1507
  - app/models/renalware/events/type.rb
@@ -2365,6 +2368,10 @@ files:
2365
2368
  - app/views/renalware/events/events/toggled_cell/_swab.html.slim
2366
2369
  - app/views/renalware/events/investigations/_list.html.slim
2367
2370
  - app/views/renalware/events/investigations/edit.html.slim
2371
+ - app/views/renalware/events/lists/_filters.html.slim
2372
+ - app/views/renalware/events/lists/_table.html.slim
2373
+ - app/views/renalware/events/lists/_tabs.html.slim
2374
+ - app/views/renalware/events/lists/show.slim
2368
2375
  - app/views/renalware/events/swabs/_list.html.slim
2369
2376
  - app/views/renalware/events/swabs/edit.html.slim
2370
2377
  - app/views/renalware/events/swabs/new.html.slim
@@ -2444,6 +2451,8 @@ files:
2444
2451
  - app/views/renalware/hd/scheduling/diary_slots/update.js.erb
2445
2452
  - app/views/renalware/hd/session_forms/batches/_create.html.slim
2446
2453
  - app/views/renalware/hd/session_forms/batches/create.js.erb
2454
+ - app/views/renalware/hd/sessions/_administered_drugs_row.html.slim
2455
+ - app/views/renalware/hd/sessions/_administered_drugs_thead.html.slim
2447
2456
  - app/views/renalware/hd/sessions/_empty_row.html.slim
2448
2457
  - app/views/renalware/hd/sessions/_form.html.slim
2449
2458
  - app/views/renalware/hd/sessions/_form_actions.html.slim
@@ -2454,9 +2463,11 @@ files:
2454
2463
  - app/views/renalware/hd/sessions/_show.html.slim
2455
2464
  - app/views/renalware/hd/sessions/_table.html.slim
2456
2465
  - app/views/renalware/hd/sessions/_thead.html.slim
2466
+ - app/views/renalware/hd/sessions/closed/_administered_drugs_row.html.slim
2457
2467
  - app/views/renalware/hd/sessions/closed/_form.html.slim
2458
2468
  - app/views/renalware/hd/sessions/closed/_row.html.slim
2459
2469
  - app/views/renalware/hd/sessions/closed/_show.html.slim
2470
+ - app/views/renalware/hd/sessions/dna/_administered_drugs_row.html.slim
2460
2471
  - app/views/renalware/hd/sessions/dna/_form.html.slim
2461
2472
  - app/views/renalware/hd/sessions/dna/_row.html.slim
2462
2473
  - app/views/renalware/hd/sessions/dna/_show.html.slim
@@ -2464,6 +2475,7 @@ files:
2464
2475
  - app/views/renalware/hd/sessions/form/_drugs_to_be_administered.html.slim
2465
2476
  - app/views/renalware/hd/sessions/index.html.slim
2466
2477
  - app/views/renalware/hd/sessions/new.html.slim
2478
+ - app/views/renalware/hd/sessions/open/_administered_drugs_row.html.slim
2467
2479
  - app/views/renalware/hd/sessions/open/_form.html.slim
2468
2480
  - app/views/renalware/hd/sessions/open/_hd_prescriptions.html.slim
2469
2481
  - app/views/renalware/hd/sessions/open/_row.html.slim
@@ -3706,6 +3718,7 @@ files:
3706
3718
  - db/migrate/20191029095202_add_deleted_at_to_problem_notes.rb
3707
3719
  - db/migrate/20191105095304_update_views_to_exclude_deleted_sessions.rb
3708
3720
  - db/migrate/20191108105923_add_named_consultant_to_patients.rb
3721
+ - db/migrate/20191203112310_add_pg_stat_statements_extension.rb
3709
3722
  - db/seeds.rb
3710
3723
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
3711
3724
  - db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb