Submit social housing lettings and sales data (CORE)
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.

85 lines
3.7 KiB

<% item_label = format_label(@pagy.count, "logs") %>
<% title = format_title(@searched, "Logs", current_user, item_label, @pagy.count, nil) %>
<% content_for :title, title %>
<%= render DataProtectionConfirmationBannerComponent.new(
user: current_user,
organisation: @organisation,
) %>
<% if @duplicate_sets_count&.positive? %>
<%= govuk_notification_banner(title_text: "Important", text: govuk_link_to("Review logs", duplicate_logs_path(referrer: "duplicate_logs_banner"))) do |banner| %>
<% banner.with_heading(text: I18n.t("notification.duplicate_sets", count: @duplicate_sets_count)) %>
<% end %>
<% end %>
Cldc 1662 add housing provider (#954) * wip * Rename managing_agents column * add managing relationship * f * feat: add my features branched off managing agents branch * feat: update nav behaviour * feat: simplify housing_providers view * feat: fix pluralise to default to plural rather than singular * feat: remove managing agent related code so can be merged directly * tests: update tests and add new ones for housing_providers * refactor: rubocop conciliation * tests: fix failing navigation tests * tests: one more plural test * refactor: erb linting * refactor: erb linting * feat: right-align "Remove" text * feat: update nokogiri to pass bundler-audit * feat: grey out search button * feat: remove section-break * feat: add housing provider page with details and button * feat: tidy up routing * feat: add wip housing provider behaviour without functioning search * feat: wip add housing provider functionality hard coded to add FooBar LTD as provider to DLUHC * feat: remove redundant code * feat: add data passing behaviour without accessible autocomplete * feat: use accessible autocomplete (not working) * feat: use accessible autocomplete (now working) * feat: wip commit error messages * feat: add banner always * feat: add conditional banner behaviour, back link and update logs titles * feat: add search icon to accessible autocomplete, make hint text aligned correctly * feat: use pluck not all * tests: add initial test * feat: refactor create logic * feat: add sub org title * feat: add correct no housing providers text * feat: add correct no housing providers text * tests: add tests for add housing provider page * feat: remove unnecessary line from controller * fet: simplify controller args * fet: update schema * feat: update schema * feat: remove create_managing_agent * test: add support user tests * test: add create_housing_provider tests * refactor: rubocop autocorrect * refactor: erblinting * test: fix tests * refactor: erblinting * feat: don't use !important tag Co-authored-by: Jack S <jacopo.scotti@softwire.com>
2 years ago
<% if current_page?(controller: 'lettings_logs', action: 'index') %>
<% if @unresolved_count > 0 %>
<%= govuk_notification_banner(
title_text: "Important",
title_heading_level: 3,
title_id: "impacted-logs-banner",
) do |notification_banner| %>
<% notification_banner.heading(text: "A scheme has changed and it has affected #{@unresolved_count} #{'log'.pluralize(@unresolved_count)}") %>
<div class="govuk-notification-banner__heading">
<%= govuk_link_to "Update logs", update_logs_lettings_logs_path, class: "govuk-notification-banner__link" %>
</div>
<% end %>
<% end %>
Cldc 1662 add housing provider (#954) * wip * Rename managing_agents column * add managing relationship * f * feat: add my features branched off managing agents branch * feat: update nav behaviour * feat: simplify housing_providers view * feat: fix pluralise to default to plural rather than singular * feat: remove managing agent related code so can be merged directly * tests: update tests and add new ones for housing_providers * refactor: rubocop conciliation * tests: fix failing navigation tests * tests: one more plural test * refactor: erb linting * refactor: erb linting * feat: right-align "Remove" text * feat: update nokogiri to pass bundler-audit * feat: grey out search button * feat: remove section-break * feat: add housing provider page with details and button * feat: tidy up routing * feat: add wip housing provider behaviour without functioning search * feat: wip add housing provider functionality hard coded to add FooBar LTD as provider to DLUHC * feat: remove redundant code * feat: add data passing behaviour without accessible autocomplete * feat: use accessible autocomplete (not working) * feat: use accessible autocomplete (now working) * feat: wip commit error messages * feat: add banner always * feat: add conditional banner behaviour, back link and update logs titles * feat: add search icon to accessible autocomplete, make hint text aligned correctly * feat: use pluck not all * tests: add initial test * feat: refactor create logic * feat: add sub org title * feat: add correct no housing providers text * feat: add correct no housing providers text * tests: add tests for add housing provider page * feat: remove unnecessary line from controller * fet: simplify controller args * fet: update schema * feat: update schema * feat: remove create_managing_agent * test: add support user tests * test: add create_housing_provider tests * refactor: rubocop autocorrect * refactor: erblinting * test: fix tests * refactor: erblinting * feat: don't use !important tag Co-authored-by: Jack S <jacopo.scotti@softwire.com>
2 years ago
<% end %>
<% if @bulk_upload.blank? %>
<%= render partial: "organisations/headings", locals: current_user.support? ? { main: "#{log_type_for_controller(controller).capitalize} logs", sub: nil } : { main: "#{log_type_for_controller(controller).capitalize} logs", sub: current_user.organisation.name } %>
<% else %>
<%= render partial: "organisations/headings",
locals: {
main: "Fix the errors from this bulk upload",
sub: "#{log_type_for_controller(controller).capitalize} logs (#{@bulk_upload.year_combo})",
} %>
<div class="app-card govuk-!-margin-bottom-9">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<p class="govuk-body-l">
You have uploaded <%= pluralize(@bulk_upload.logs.count, "log") %>. There are errors in <%= pluralize(@bulk_upload.logs_with_errors_count, "log") %>, and <%= pluralize(@bulk_upload.bulk_upload_errors.count, "error") %> in total. Select the log to fix the errors.
</p>
<p class="govuk-body">
<strong>Bulk Upload details:</strong><br>
File: <%= @bulk_upload.filename %><br>
Uploaded on <%= @bulk_upload.created_at.to_fs(:govuk_date_and_time) %><br>
</p>
</div>
</div>
</div>
<% end %>
<div class="app-filter-layout" data-controller="filter-layout">
<%= render CreateLogActionsComponent.new(
bulk_upload: @bulk_upload,
user: current_user,
log_type: log_type_for_controller(controller),
) %>
<%= render partial: "log_filters" %>
<div class="app-filter-layout__content">
<%= render SearchComponent.new(current_user:, search_label: search_label_for_controller(controller), value: @searched) %>
<%= govuk_section_break(visible: true, size: "m") %>
CLDC-1826 lettings log codes only download (#1268) * update seeds to add self in review env, change spec to reflect this, update config yml to allow csv exports in review * update interface of relevant methods EmailCsvJob, LettingsLog.to_csv and LettingsLogCsvService consume codes_only flag * update tests including adding a new csv file to test against * update LettingsLogCsvService to output codes only csv * correct minor error and linting * enable codes only download in UI - add link on lettings log index page - pass codes_only flag through params in relevant links and methods - convert flag to boolean in controller methods * ensure link displayed successfully for all renderings of logs_list and params passed through relevant methods in organisations controller * fix existing tests * correct linting thing * correct linting error * update tests for lettings log controller * correct linting errors * update organisations controller tests * make minor changes after code review * remove changes made for testing on review app * make codes only download visible to support users only * change variable names throughout after info on rauby/rails naming conventions, update tests for change in who can view codes only download link * rework csv service for readability, remove delegating methods from lettings log to keep all code to do with mapping between our domain and desired export format in one place * update test name * correct a small typo and remove a duplicated method after clever git merge conflict suggestion * point review app at staging csv bucket for csv download * change variables named codes_only_export to codes_only to avoid inconsistency * write tests to ensure that differetn user roles have the correct permissions around csv download * ensure that non support users may not download codes only exports * correct a small error in a previous commit * correct minor linting error
2 years ago
<%= render partial: "log_list",
locals: {
logs: @logs,
title: "Logs",
pagy: @pagy,
searched: @searched,
item_label:,
total_count: @total_count,
CLDC-2290 implement delete multiple logs story (#1657) * add a button to the logs list to delete multiple logs style and position of button helpers for displaying the button conditionally depending on user role and what filters and search are active * correct indentation from 4 spaces to 2 in view file * test appearance of delete logs button on index page for lettings logs * write a happy path feature test for the entire journey * create basic tests for the view component for listing logs to delete * create request tests for the GET delete-logs path * create request tests for the GET delete-logs-confirmation path * create request tests for the DELETE delete-logs path * comprehensive reworking after code review ensure that we are not passing lists of ids through params in the query string, risking overflowing the maximum URL length, adjust tests accordingly, do not attempt to reuse the same table for sales and lettings * alter config to allow creating controllers from the command line with associated spec files that matches how we test * extract controller methods and associated tests to do with the delete logs feature into their own controller, amend routes accordingly * implement same work for sales as for lettings * implement the story for lettings and sales logs under the organisation tab routing and controller methods testing for deleting sales logs, lettings or sales logs for an organisation move storage of relevant routes inside the form object as a comprehensive view model * merge the delete pages for lettings logs and sales logs, add to the tests for the lettings page to test sales specific content * minor refactor to delete logs controller: ensure session filters are only fetched from teh session when needed and extract discard logs method to private method * extract tables for lettings and sales to own partials * refactor delete logs controller after tech review improve the private method that builds the form object so that it has the flexibility to do so for all controller methods ensure that the search term is passed to the delete logs controller when navigating through the organisations tab ensure that noly logs for that organisation are displayed when navigating to delete logs through the organisations tab * remove unnecessary untested arguments * test new helper methods * implement dirty fiddle to get the checkboxes smaller and also not misaligned * ensure delete logs button is always visible on log lists when in the organisations tab * minor linting corrections * revert change, causing errors and outside the scope of this ticket * simplify tests for whether delete logs button appears on index page * replicate request specs from lettings for sales and organisations controllers * minor refactor of lettings log feature spec setup, replicate happy path for sales * minor refactors after rebasing onto Nat's work * temp * write tests for the delete logs form object * lint: add new line at end of file * respond to PO feedback the log id in the delte logs table should be a link to the log the delete logs button should be visible when the user is in a bulk upload journey updated associated tests
1 year ago
csv_download_url: csv_download_url_for_controller(controller:, search: @searched, codes_only: false),
csv_codes_only_download_url: csv_download_url_for_controller(controller:, search: @searched, codes_only: true),
delete_logs_path: @delete_logs_path,
filter_type: @filter_type,
CLDC-1826 lettings log codes only download (#1268) * update seeds to add self in review env, change spec to reflect this, update config yml to allow csv exports in review * update interface of relevant methods EmailCsvJob, LettingsLog.to_csv and LettingsLogCsvService consume codes_only flag * update tests including adding a new csv file to test against * update LettingsLogCsvService to output codes only csv * correct minor error and linting * enable codes only download in UI - add link on lettings log index page - pass codes_only flag through params in relevant links and methods - convert flag to boolean in controller methods * ensure link displayed successfully for all renderings of logs_list and params passed through relevant methods in organisations controller * fix existing tests * correct linting thing * correct linting error * update tests for lettings log controller * correct linting errors * update organisations controller tests * make minor changes after code review * remove changes made for testing on review app * make codes only download visible to support users only * change variable names throughout after info on rauby/rails naming conventions, update tests for change in who can view codes only download link * rework csv service for readability, remove delegating methods from lettings log to keep all code to do with mapping between our domain and desired export format in one place * update test name * correct a small typo and remove a duplicated method after clever git merge conflict suggestion * point review app at staging csv bucket for csv download * change variables named codes_only_export to codes_only to avoid inconsistency * write tests to ensure that differetn user roles have the correct permissions around csv download * ensure that non support users may not download codes only exports * correct a small error in a previous commit * correct minor linting error
2 years ago
} %>
<%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "logs" } %>
</div>
</div>