aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-11-06 18:44:52 -0500
committerRaghuram Subramani <raghus2247@gmail.com>2025-11-06 18:44:52 -0500
commitfb7bb27fd04d8500d2aedcf21368584809b2bf6f (patch)
treefe3125829e618f13110c14a943a352fd2878e10a
parent6cc304bf59857f82cc6409402c2b244d9feb4fa5 (diff)
visits: index: link name and add address & size
-rw-r--r--app/controllers/visits_controller.rb2
-rw-r--r--app/views/visits/index.html.haml48
2 files changed, 32 insertions, 18 deletions
diff --git a/app/controllers/visits_controller.rb b/app/controllers/visits_controller.rb
index 926b9d7..57556a0 100644
--- a/app/controllers/visits_controller.rb
+++ b/app/controllers/visits_controller.rb
@@ -18,7 +18,7 @@ class VisitsController < ApplicationController
date = Date.today
end
- @visits = Visit.includes(:client)
+ @visits = Visit.includes(client: [ :household_members ])
.where(created_at: date.all_day)
.order(created_at: :desc)
end
diff --git a/app/views/visits/index.html.haml b/app/views/visits/index.html.haml
index d414fd8..746982d 100644
--- a/app/views/visits/index.html.haml
+++ b/app/views/visits/index.html.haml
@@ -1,25 +1,39 @@
+:css
+ @media print {
+ .no-print {
+ display: none !important;
+ }
+ }
+
%article
%header
%b Visit History
- = form_with url: url_for, method: :get do |f|
- .grid
- = f.date_field :date, value: (params[:date] or Date.today.strftime("%Y-%m-%d"))
- = f.submit 'Select'
+ .no-print
+ = form_with url: url_for, method: :get do |f|
+ .grid
+ = f.date_field :date, value: (params[:date] or Date.today.strftime("%Y-%m-%d"))
+ = f.submit 'Select'
- %article
- %h5
- Total Visits:
- = @visits.count
+ %h5
+ Date:
+ = params[:date] or Date.today.strftime("%Y-%m-%d")
+ %h5
+ Total Visits:
+ = @visits.count
- %table
- %thead
- %th Time
- %th Client
+ %table
+ %thead
+ %th Time
+ %th Name
+ %th Address
+ %th Household Size
- %tbody
+ %tbody
- - @visits.each do |visit|
- %tr
- %td= visit.created_at.strftime("%H:%M")
- %td= visit.client.name
+ - @visits.each do |visit|
+ %tr
+ %td= visit.created_at.strftime("%H:%M")
+ %td= link_to visit.client.name, show_clients_path(uuid: visit.client.uuid)
+ %td= visit.client.address
+ %td= visit.client.household_members.length