diff --git a/app/models/lottery_division.rb b/app/models/lottery_division.rb index c938d4a72..8fb97f26a 100644 --- a/app/models/lottery_division.rb +++ b/app/models/lottery_division.rb @@ -63,7 +63,8 @@ def withdrawn_entrants private def broadcast_lottery_draw_header - broadcast_replace_to self, :lottery_draw_header, target: "draw_tickets_header_lottery_division_#{id}", partial: "lottery_divisions/draw_tickets_header", locals: {division: self} + broadcast_replace_to self, :lottery_draw_header, target: "draw_tickets_header_lottery_division_#{id}", partial: "lottery_divisions/draw_tickets_header", locals: { division: self } + broadcast_replace_to self, :lottery_header, target: "lottery_header_lottery_division_#{id}", partial: "lottery_divisions/tickets_progress_bars", locals: { division: self, show_pre_selected: false } end def ordered_drawn_entrants diff --git a/app/views/lotteries/show.html.erb b/app/views/lotteries/show.html.erb index 4e7f4fba8..7f7c64a8b 100644 --- a/app/views/lotteries/show.html.erb +++ b/app/views/lotteries/show.html.erb @@ -110,6 +110,18 @@ <% end %> +
+
+ <% @presenter.ordered_divisions.each do |division| %> + <%= turbo_stream_from division, :lottery_header, class: "d-none" %> +
+
<%= division.name %>
+ <%= render partial: "lottery_divisions/tickets_progress_bars", locals: { division: division, show_pre_selected: false } %> +
+ <% end %> +
+
+
<%= render partial: "lottery_draws/lottery_draw", collection: @presenter.lottery_draws_ordered %>
diff --git a/app/views/lottery_divisions/_draw_tickets_header.html.erb b/app/views/lottery_divisions/_draw_tickets_header.html.erb index e65072359..f231d140f 100644 --- a/app/views/lottery_divisions/_draw_tickets_header.html.erb +++ b/app/views/lottery_divisions/_draw_tickets_header.html.erb @@ -28,41 +28,6 @@ -
-
-
-
-
Accepted
-
-
-
<%= "(#{division.accepted_entrants.count}/#{division.maximum_entries})" %>
-
-
-
- <%= bootstrap_progress_bar(min_value: 0, max_value: division.maximum_entries, current_value: division.accepted_entrants.count, color: "success") %> -
-
-
-
Wait List
-
-
-
<%= "(#{division.wait_list_entrants.count}/#{division.maximum_wait_list})" %>
-
-
-
- <%= bootstrap_progress_bar(min_value: 0, max_value: division.maximum_wait_list, current_value: division.wait_list_entrants.count, color: "warning") %> -
-
-
-
Pre-selected
-
-
-
<%= "(#{division.entrants.pre_selected.drawn.count}/#{division.entrants.pre_selected.count})" %>
-
-
-
- <%= bootstrap_progress_bar(min_value: 0, max_value: division.entrants.pre_selected.count, current_value: division.entrants.pre_selected.drawn.count, color: "secondary") %> -
-
-
+ <%= render partial: "lottery_divisions/tickets_progress_bars", locals: { division: division, show_pre_selected: true} %> + diff --git a/app/views/lottery_divisions/_tickets_progress_bars.html.erb b/app/views/lottery_divisions/_tickets_progress_bars.html.erb new file mode 100644 index 000000000..5484cac28 --- /dev/null +++ b/app/views/lottery_divisions/_tickets_progress_bars.html.erb @@ -0,0 +1,41 @@ +<%# locals: (division:, show_pre_selected:) -%> + +
+
+
+
+
Accepted
+
+
+
<%= "(#{division.accepted_entrants.count}/#{division.maximum_entries})" %>
+
+
+
+ <%= bootstrap_progress_bar(min_value: 0, max_value: division.maximum_entries, current_value: division.accepted_entrants.count, color: "success") %> +
+
+
+
Wait List
+
+
+
<%= "(#{division.wait_list_entrants.count}/#{division.maximum_wait_list})" %>
+
+
+
+ <%= bootstrap_progress_bar(min_value: 0, max_value: division.maximum_wait_list, current_value: division.wait_list_entrants.count, color: "warning") %> +
+ <% if show_pre_selected %> +
+
+
Pre-selected
+
+
+
<%= "(#{division.entrants.pre_selected.drawn.count}/#{division.entrants.pre_selected.count})" %>
+
+
+
+ <%= bootstrap_progress_bar(min_value: 0, max_value: division.entrants.pre_selected.count, current_value: division.entrants.pre_selected.drawn.count, color: "secondary") %> +
+ <% end %> +
+
\ No newline at end of file