You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
3.8 KiB
88 lines
3.8 KiB
<div class="govuk-grid-row"> |
|
<div class="govuk-grid-column-one-quarter"> |
|
<div class="app-filter"> |
|
<div class="app-filter__header"> |
|
<h2 class="govuk-heading-m">Filters</h2> |
|
</div> |
|
<div class="app-filter__content"> |
|
<div class="govuk-form-group app-filter__group"> |
|
<%= form_with url: "/logs/filter", html: { method: :post }, builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> |
|
<%= f.govuk_check_boxes_fieldset :status do %> |
|
<% statuses = {in_progress: "In progress", submitted: "Completed", archived: "Not started"} %> |
|
<% statuses.map do |key, option| %> |
|
<%= f.govuk_check_box "status", "#{key}", |
|
label: { text: option }, |
|
checked: filter_selected?(key), |
|
class: "govuk-checkboxes govuk-checkboxes--small" %> |
|
<% end %> |
|
<% end %> |
|
<%= f.govuk_submit "Apply filters"%> |
|
<% end %> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="govuk-grid-column-three-quarters"> |
|
<figure class="app-figure"> |
|
<figcaption id="<%= title.dasherize %>" class="app-figure__caption"> |
|
<span class="govuk-!-margin-right-4"> |
|
<strong><%= pagy.count %></strong> total <%= title.downcase %> |
|
</span> |
|
<a class="govuk-link" download href="/logs.csv" type="text/csv">Download (CSV)</a> |
|
</figcaption> |
|
<section class="app-table-group" tabindex="0" aria-labelledby="<%= title.dasherize %>"> |
|
<table class="govuk-table"> |
|
<thead class="govuk-table__head"> |
|
<tr class="govuk-table__row"> |
|
<th class="govuk-table__header" scope="col">Log</th> |
|
<th class="govuk-table__header" scope="col">Tenant</th> |
|
<th class="govuk-table__header" scope="col">Property</th> |
|
<th class="govuk-table__header" scope="col">Tenancy starts</th> |
|
<th class="govuk-table__header" scope="col">Log created</th> |
|
<th class="govuk-table__header" scope="col">Completed</th> |
|
<% if current_user.support? %> |
|
<th class="govuk-table__header" scope="col">Owning organisation</th> |
|
<th class="govuk-table__header" scope="col">Managing organisation</th> |
|
<% end %> |
|
</tr> |
|
</thead> |
|
<tbody class="govuk-table__body"> |
|
<% case_logs.map do |log| %> |
|
<tr class="govuk-table__row"> |
|
<th class="govuk-table__header" scope="row"> |
|
<%= govuk_link_to log.id, case_log_path(log) %> |
|
</th> |
|
<td class="govuk-table__cell app-!-font-tabular"> |
|
<%= log.tenant_code? ? log.tenant_code : '–' %> |
|
</td> |
|
<td class="govuk-table__cell app-!-font-tabular"> |
|
<%= log.propcode? ? log.propcode : '–' %> |
|
</td> |
|
<td class="govuk-table__cell"> |
|
<%= log.startdate.present? ? log.startdate.to_formatted_s(:govuk_date) : '–' %> |
|
</td> |
|
<td class="govuk-table__cell"> |
|
<%= log.created_at.to_formatted_s(:govuk_date) %> |
|
</td> |
|
<td class="govuk-table__cell"> |
|
<%= govuk_tag( |
|
colour: log.status == 'completed' ? 'blue' : 'grey', |
|
text: log.status.humanize |
|
) %> |
|
</td> |
|
<% if current_user.support? %> |
|
<td class="govuk-table__cell"> |
|
<%= log.owning_organisation.name %> |
|
</td> |
|
<td class="govuk-table__cell"> |
|
<%= log.managing_organisation.name %> |
|
</td> |
|
<% end %> |
|
</tr> |
|
<% end %> |
|
</tbody> |
|
</table> |
|
</section> |
|
</figure> |
|
</div> |
|
</div>
|
|
|