tududi/app/views/projects/_list.erb
2024-09-06 21:53:21 +03:00

43 lines
1.5 KiB
Text

<table class="table-dark">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Project Name</th>
<th scope="col">Progress</th>
<th scope="col">Total Tasks</th>
<th scope="col">Tasks in Progress</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<% projects.each_with_index do |project, index| %>
<% counts = @task_status_counts[project.id] %>
<tr>
<th scope="row"><%= index + 1 %></th>
<td><%= project.name %></td>
<td>
<div class="progress" style="height: 2px;">
<div class="progress-bar" role="progressbar" style="width: <%= project.progress_percentage %>%;" aria-valuenow="<%= project.progress_percentage %>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<%= project.progress_percentage %>%
</td>
<td><%= counts[:total] %> Tasks</td>
<td>
<% if counts[:in_progress] > 0 %>
<i class="bi bi-circle-fill text-success" style="font-size: 0.5em; position: relative; top: -0.3em;"></i> <%= counts[:in_progress] %>
<% else %>
0
<% end %>
</td>
<td>
<a href="/project/<%= project.id %>" class="btn btn-primary btn-sm">View</a>
</td>
</tr>
<% end %>
</tbody>
</table>
<!-- Button to add new project -->
<div class="mt-3">
<a href="#" class="btn btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#newProjectModal">Add New Project</a>
</div>