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

Issue #1326: Refact mobile view of staff dashboard #1332

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 57 additions & 37 deletions app/views/organizations/staff/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,6 @@
<% c.with_header_title { t("dashboard.index.header_title") } %>
<% c.with_body do %>
<div class="row g-4">
<div class="col-xl-3 col-lg-6 col-md-12 col-12">
<div class="task-card">
<%= render DataCardComponent.new(title_size: :medium, icon_color: "text-primary") do |card| %>
<% card.with_title { "Tasks" } %>
<% card.with_icon_name { "list" } %>
<% card.with_value do %>
<div class="fs-4 ms-1">
<div>
<%= link_to pets_with_incomplete_tasks_staff_dashboard_index_path,
data: { turbo_frame: "tasks-frame" },
class: "text-decoration-none text-gray-500 fw-normal" do %>
<i class="fe fe-alert-circle text-primary me-1"></i>
<%= "#{@not_completed_not_overdue_tasks_count} Incomplete" %>
<% end %>
</div>
<div>
<%= link_to pets_with_overdue_tasks_staff_dashboard_index_path,
data: { turbo_frame: "tasks-frame" },
class: "text-decoration-none text-gray-500 fw-normal" do %>
<i class="fe fe-clock text-primary me-1"></i>
<%= "#{@not_completed_overdue_tasks_count} Overdue" %>
<% end %>
</div>
</div>
<% end %>
<% end %>
</div>
</div>

<div class="col-xl-3 col-lg-6 col-md-12 col-12">
<div class="application-card">
<%= render DataCardComponent.new(title_size: :medium, icon_color: "text-success") do |card| %>
Expand Down Expand Up @@ -86,14 +57,27 @@
</div>

<div class="col-xl-3 col-lg-6 col-md-12 col-12">
<div class="rescue-card">
<%= render DataCardComponent.new(title_size: :medium, icon_color: "text-gray-500") do |card| %>
<% card.with_title { t(:rescues) } %>
<% card.with_icon_name { "star" } %>
<div class="task-card">
<%= render DataCardComponent.new(title_size: :medium, icon_color: "text-primary") do |card| %>
<% card.with_title { "Tasks" } %>
<% card.with_icon_name { "list" } %>
<% card.with_value do %>
<div class="text-muted text-decoration-none text-gray-500 fw-normal">
<div class="fs-4 ms-1">
TBD
<div class="fs-4 ms-1">
<div>
<%= link_to pets_with_incomplete_tasks_staff_dashboard_index_path,
data: { turbo_frame: "tasks-frame" },
class: "text-decoration-none text-gray-500 fw-normal" do %>
<i class="fe fe-alert-circle text-primary me-1"></i>
<%= "#{@not_completed_not_overdue_tasks_count} Incomplete" %>
<% end %>
</div>
<div>
<%= link_to pets_with_overdue_tasks_staff_dashboard_index_path,
data: { turbo_frame: "tasks-frame" },
class: "text-decoration-none text-gray-500 fw-normal" do %>
<i class="fe fe-clock text-primary me-1"></i>
<%= "#{@not_completed_overdue_tasks_count} Overdue" %>
<% end %>
</div>
</div>
<% end %>
Expand All @@ -103,7 +87,43 @@
</div>

<div class="mt-5">
<%= render 'pets_with_incomplete_or_overdue_tasks' %>
jasonwang7517 marked this conversation as resolved.
Show resolved Hide resolved
<turbo-frame id="tasks-frame">
<h3 class = "text-capitalize"><%= @header_title %></h3>
<div class="card">
<table class="table mb-0 text-nowrap table-hover table-centered">
<thead>
<tr>
<th scope="col"><%= t('name') %></th>
<th class="text-center" scope="col"><%= @column_name %></th>
</tr>
</thead>
<tbody>
<% @pets.each do |pet| %>
<tr>
<td>
<div class="d-flex align-items-center">
<%= render PetAvatarComponent.new(pet)%>
<div class="ms-3">
<h4 class="mb-0">
<%= link_to pet.name, staff_pet_path(pet, active_tab: 'tasks'), class: 'text-inherit', data: { turbo: false } %>
</h4>
</div>
</div>
</td>
<td>
<div class="d-flex justify-content-center">
<%= link_to pet.incomplete_tasks_count, staff_pet_path(pet, active_tab: 'tasks'), class: 'text-inherit', data: { turbo: false } %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="d-flex justify-content-center align-items-center mt-2">
<%== pagy_bootstrap_nav(@pagy) if @pagy.pages > 1 %>
</div>
</turbo-frame>
</div>
<% end %>
<% end %>
Loading