* feat: allow data coordinators to create, edit and view stock owners' schemes
* feat: only show data coordinators their org and stock owners in scheme owner select, update location policy
* feat: update some tests
* feat: update tests
* feat: use zero? where appropriate and lint
* feat: update tests
* refactor: lint
* feat: use helper for answer options
* feat: move ordering after filtering to avoid ORDER BY using expressions not in SELECT DISTINCT list
* feat: add multiple schemes so tests will fail if this bug appears again
* create helper module to find all logs for a given user that have duplicates
write associated tests
update methods on user model to retrieve logs related to a given user
create a scope on logs to retrieve logs created by a given user
* check for duplicates and display notification banner on the index page where appropriate
tests to cover the desired behaviour
* alter duplicate logs helper to return duplicates in a format that can be passed through the params
update associated tests
* create user journey to view duplicate sets adn navigate to a given set
create a new route and add it to the link from the logs index page
create controller method and related view file
* update path for duplicate logs in routes, update factories, refactor duplicates scope to eliminate raw sql
* write tests for the duplicate logs index page
* correct linting errors
* minor amendments from code review.
* temp
* Refactor
* Create a scope for duplicate groups
* fixes
* lint
* Update controller specs
* Put duplicate sets count behind a feature flag
* refactor index
* Update duplicate_sets_count
* Update scopes
* tests
* pass in original log id
* tests
* Add duplicate index page content
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
* Add availability to the merged org options
* Do not delete merged organisation relationships
* displays managing agents of merged organisation selected as owning org
* Add absorbing org dates, fix copy
* set managing org as owning org it is being absorbed by the users org
* Update check answers to use the correct logs
* Display different link when correcting duplicates
* allow deduplicating logs by changing the answers
* Route back to the initial log if it still has duplicates
* Update back to log button
* Add banner
* Update success banner
* Fix a flaky test
* Rename param and update conditionals
* Add owning organisation to deduplication fields, only return back to the original log if it still belongs to the org
* Send notification to old email address when changing it
* send email changed notification to old email
* Add specs
* send both emails
* Only send required confirmation emails
* Show flash notice
* Use reconfirmable template only if not confirmed
* Don't commit .env.development
* new email flow also when updating own email
* Add location filters to the controller
* Display the status filter and clear filters
* refactor status filter into scope
* Update incomplete, make reactivated scope work in conjunction with other scopes. Lint
* specs
* styling
* Update test name
* uncomment a test
* Move filters under navigation
* Filter schemes
* Add status filter to schemes pages
* Filter schemes deactivating in more than 6 monts as active
* Always serialize session filters for schemes
* Remove ordering in search, fix tests
* Update incomplete scope
* Add user status filters
* Add filters to the pages
* only show unconfirmed and deactivated logs as deactivated
* Look at last signed in at to determine unconfirmed users
* CLDC-2494: WIP
* CLDC-2494: wip
* CLDC-2494: page work in progress
* cleanup
* Add a path for duplicate logs
* Display all duplicate logs
* Move a test
* Display duplicate check answers for logs
* Add buttons to delete duplicates
* Add a route for sales logs duplicates
* Update duplicated page to work for sales logs
* lint
* Add auth
* Rebase updates
* Update displayed questions
* Add delete duplicates page
* Update page content for when there are multiple duplicates
* Add auth to the path
* Update delete button to use delete controller
* Update page for sales logs
* Update styling
* Update success banner for deleting duplicates
* Typo
* Render not found if there are no duplicate logs
* rebase changes
* Rebase changes
* Update back and cancel links
* Update the duplicate journey after deleting logs
* Update change button routing
* Refactor tests
* Add content for no duplicates
* Update params
* Refactor tests and paths
* Update params to include original_log_id from the beginning
* Rename file
* lint
* Add full stop after deletion messages
* Add caption and update duplicate log IDs in the banner
* lint
* Styling
---------
Co-authored-by: Aaron Spencer <aaron.spencer@softwire.com>
* Remove new_data_protection_confirmation? flag
* Update schema
- drop index
- add org and user data to dpc table
* Persist org and user data at import
* Do not show invalid emails
* Persist user and org data while signing agreement
* Add migration to persist org and user data on DPC
* Rebase fix
* fix typo
* CLDC-2494: WIP
* CLDC-2494: wip
* CLDC-2494: page work in progress
* cleanup
* Add a path for duplicate logs
* Display all duplicate logs
* Move a test
* Display duplicate check answers for logs
* Add buttons to delete duplicates
* Add a route for sales logs duplicates
* Update duplicated page to work for sales logs
* Update styling
* lint
* Add auth
* Rebase updates
* Remove propcode from dedulication checks
* Update fields to work with supported housing
* Trigger duplicate log check on buyer 1 age not known
* compare correct charges
* Update displayed questions
* BU test
* Put redirect to duplicate logs path behind a feature flag
* More BU tests
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
* Do not allow adding stock owners as data providers
* Do not allow removing stock owners as data providers
* Do not allow adding managing agents as data providers
* Do not allow removing managing agents as data providers and fix remove_stock_owner
* Authorise add managing agent/stock owner pages
* Refactor organisation_relationship_policy
* Update test names
* Refactor policy and remove headers from tests
* Redirect lettings log to review page if the collection year is closed for editing
* Redirect sales log to review page if the collection year is closed for editing
* Update location default deactivation date
* Update location default deactivation date
* Do not display resources for a closed collection year
* lint
* Extract a method
* tests
* Update breadcrumbs for closed period
* Renme end_date to new_logs_end_date
* Display change buttons in CYA if the collection is still open for editing
* Allow navigating to question if the collection is still open for editing
* Allow logs to be edited if the date is before edit end date
* Update sales validation to allow editing existing logs
* update tests
* Update edit_end_date
* Update some test wording
* Update new logs end date
* tests
* Change number validation to allow 0 at the beginning
* Update valid_phone_number?
* Move tests to request
* Make phone required for new users
* Allow + in the numbers
* Feature test
* persist how to fix choice
* fix choice decision persisted
* set no cache headers
* add chosen to sales journey
* set no cache headers for sales
* fix linting
* Add chosen journey for sales soft validations
* Add chosen journey for lettings soft validations
* Update copy
* Also redirect fix inline and confirm if soft validations are chosen to be bulk fixed
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
* Display active status is location/scheme deactivation is in more than 6 months
* Override existing location deactivation period with new deactivation
* Override existing scheme deactivation period with new deactivation
* add reactivate to policy
* Change status tag method
* Update instance double in test
* Update deactivates_in_a_long_time? method
* Uncoment a test
* 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
* Remove bulk_upload_lettings_logs flag
* Add spacing above actions in data sharing agreement
* Add banner
* Add model validation
* fix log component
* Fix factory
* Put validation behind feature flag
* start adapting to data protection confirmation
* Make tests more generic
* Add tests for display_organisation_attributes
* Use data_protection_confirmed? method
* Address code review
* rubocop
* Prevent access to bulk upload pages when DPC not signed
* Address PO review
* Add data sharing agreement
* Add data sharing agreement view
* Add controller actions
* Update details page
* Rubocop fix
* Fill in placeholders and persist data in table
* Update agreement template
# Context
- https://digital.dclg.gov.uk/jira/browse/CLDC-1732
- data providers are given read-only able access to schemes and locations
# Changes
- introduce `pundit` policies to schemes and locations. the old scope mechanism has been removed
- apply policies at view level so hide write access based functionality from data providers
* Update permissions and scheme/location views
* Display parent organisation's schemes in the list
* Hide toggle scheme button from child organisation
* Update show location to use user_can_edit_scheme?
* Refactor user_allowed_action?
* remove redundant return
* Sends a correct email if there are only soft validations
* Add soft errors valid page
* Add soft errors confirm page
* Confirm the soft validations
* Reuse the how to fix template for check soft validations email
* Update email link
* Move soft validation confirmation to processor
* Correctly set the log status, remove redundant confirm_soft_validations
* Redirect successful upload to logs index and display a success banner
* Implement the soft validations only journey for sales logs
* Display the soft validation errors on the soft-errors-valid page
* Fix page alignment
* Fix tests by mapping housingneeds in csv hepler
* Add the sales soft validations to unpend_and_confirm_soft_validations
* Change naming
* Update method names
* refactor
* undo typo
* Only set the existing soft validations for correct types
* Fix path name
* Add missing error mappings for location fields
* Add missing tests and cancel button
* Change some wording
* Typos
# Context
- https://digital.dclg.gov.uk/jira/browse/CLDC-2361
- When fixing inline for sales bulk uploads users need to be able to show only logs related to the bulk upload therefore have the bulk upload filter applied
# Changes
- After a sales bulk upload the session is set with bulk upload filter
- When viewing sales log ensure we extract this apply as a filter
# Issues
- The current implementation is globally shared between lettings and sales therefore there are issues when switching between the 2 areas
- There is a backlog ticket to refactor the filter and recommend fixing this issue then
# Context
- https://digital.dclg.gov.uk/jira/browse/CLDC-2316
- Implement bulk upload sales for new collection year 2023
- This is a first pass implementation and will probably have some bugs in it and we can address over time
# Changes
- Add CSV parser for sales 2023 to handle CSV structure
- Tweak collection window validation so error now contextual to year selected for upload
- Handle arbitrary ordering of CSV columns
- Fix ordering of errors in report and now ordered by cell
- Added `Upload your file again` link styled as button on error report to match lettings experience
- Update tooling to convert logs to 2023 csv rows with support for random column ordering
# Known issues
- There seem to be some issues with how UPRN is handled if the UPRN cannot be validated.
- For the above I think there is dependency on https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data/pull/1570 which should clear any errored fields so users can continue to create logs and fix within the service
* create a method on the FormHandler that returns the sales form questions for all years in the order that they appear in the form
* update csv email job to accomodate sales log export as well as lettings
add to tests to reflec the changes made
* write tests to cover the desired functionality of the SalesLogCsvService
* create the SalesLogCsvService
create a necessary method on the log to enable submission method to be included on the csv
derive values for the two halves of previous postcode for export
* add relevant links in the UI and pipe everything together in controllers
amend organisations controller to have flexibility to download logs of either type
add necessary methods to sales log controller, raising shared method to logs controller
update routing for amendments and additions
extract helper method to build urls for downloading logs within an organisation
* correct various linter complaints and tech review suggestions
* minor amendment to add old_id and reorder early columns
* undo my 'clever' refactor that broke things
* refactoring of csv service after some tech review and some UI testing in review app
* update tests to include a test of a full export and all values in teh csv
* correct minor routing error to ensure correct url is shown and tab selected after requesting csv email
* update organisations controller requests spec file to cover new functionality and make a minor amendment to authentication scope in the controller after error found in testing
* write request tests for the new functionality in the sales log controller, define authorisation in the controller
* minor correction after rubocop's kind suggestion'
* various corrections from first pass at PO, tech review, linter, etc
* refactor :ordered_sales_questions_for_all_years
* first pass at implementing flexible code-based form fixtures for testing
* second pass
* refactor all tests of :ordered_sales_questions_for_all_years to use new factories
* some refactoring in the testing of the csv service
* use that fact that params is always available in controllers and don't pass it around, inline some methods calls
* correct minor bug to ensure that "Return to logs" link returns to the correct index page
* remove reminder comments
* write further tests on the manipulation of questions into the csv headers, update factories of form constituents to allow the creation of forms with richer questions
* fix linter complaints
* minor alterations after rebase to account for changes made on other branches
* refactor after code review
* tweak fixtures after rebase containing alterations to the factory defaults