* 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
* amend ordering in scheme and location show pages to raise status towards top
implement a muted explanation text on schemes when they have complete details but no active locations to explain why they are incomplete
write tests to ensure this text is shown under the right conditions
* update ordering in spec files
* correct rebase change
# 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
* feat: assign simultaneously
* feat: assign simultaneously
* feat: revert
* feat: fix back persistence behaviour and update similar issues elsewhere, also remove redundant back text in govuk back links
* feat: add previous_page_redirect_paths to avoid infinite loops
* feat: leave here to avoid possible loops
* feat: leave here to avoid possible loops
* feat: add check answers page behaviour
* refactor: tweak
* feat: make tests pass, simplify code and incorporate tasklist/check answers back routing
* feat: update tests
* refactor: lint
* feat: remove redundant cols from locations table
* feat: add status col to locations table
* test: start adding status tag tests
* test: pick the simplest format for the tag helper tests
* feat: make the locations table (plus related content above & below) 2/3 width
* feat: add incomplete to location status method
* test: all status tag helpers
* test: update test text to match what's being tested
* test: update locations list test in locations_controller_spec.rb
* test: update locations list test in schemes feature tests
* test: that status=incomplete when mandatory info is missing
* feat: simplify logic for incomplete status
Co-authored-by: James Rose <james@jbpr.net>
* feat: hide new locations table layout behind feature flag
* feat: use route helpers to get scheme_location path
* feat: simplify "scheme_id: @scheme.id" to "@scheme"
* feat: reference location, not @location, in scheme_location_path
* feat: reorder postcode and code in locations table
* feat: change ' ' to "" in location_spec
* feat: update wording and ordering for 'view location details' page
* test: re-add tests for locations page when new layout not enabled
* test: check for mobility_type and location_admin_district in locations_controller as support user
* test: update locations helper test to match new field naming and ordering
* feat: always scale locations list by 2/3, not just when new layout used
* feat: scale the scheme details page by 2/3 to match the locations list page
* feat: only make scheme details and locations pages 2/3 scale if feature toggle on
* test: mock new locations layout feature toggle in tests
* feat: use the existing location_toggle_enabled instead of new_locations_table_layout_enabled
* refactor: don't use html inside ruby in locations index page
* refactor: use Rails routes in all places in locations index page
* style: lint
* feat: move logic from views/schemes/show into schemes_helper
* refactor: make consistent the removal of fields from SchemeHelper base_attributes
* test: improvements to tests
* test: make 'returns correct display attributes' tests sensible
* test: check scheme toggle off => no scheme status shown
* style: correct indentation in spec/helpers/schemes_helper_spec.rb
* test: that when owning = managing, "Organisation providing support" hidden
* style: lint code
* test: don't set scheme id explicitly in schemes_helper_spec
* style: reorder tag helper spec to match tag helper
* refactor: ensure display_scheme_attributes always takes user type
* test: make location incomplete status depend on location.confirmed
* test: add missing location validations for nil postcode & mobility type
Co-authored-by: James Rose <james@jbpr.net>
* feat: add scheme reactivation behaviour
* test: add tests
* refactor: linting
* fix: find deactivation periods by scheme/location ids rather than just the first
* feat: add activating_soon status to location (not to schemes as they have no startdate field)
* feat: fix logic and add tests fo activating soon
* fix: check for startdate presence
* feat: wip update scheme summary page
* feat: wip deactivate scheme schemes page
* feat: wip toggle active page
* feat: wip set deactivation_date to a datetime (to be more specific times later_
* Change conditional question controller to accommodate all models
* feat: add specific datetimes for deactivation
* feat: correct date and add notice
* feat: wip error behaviour
* feat: wip errors
* feat: wip errors refactoring
* feat: wip errors more refactoring
* refactor: linting
* feat: add second error in correct position and wip date range error
* feat: remove unneccessary db field
* feat: change type values to strings
* refactor: tidy up controller logic
* refactor: use same structure as locations deactivation
* feat: add general partially missing date input error
* feat: add tests ("updates existing scheme with valid deactivation date and renders scheme page" still wip) and add new partially nil date behaviour to locations controller
* feat: fix tests, add status tag behaviour and remove unnecessary nils
* refactor: linting
* refactor: erblinting
* refactor: remove redundant line
* refactor: respond to PR comments 1
* refactor: respond to PR comments 2
* refactor: respond to PR comments 3
* refactor: respond to PR comments 3 (locations side)
* fix: remove @locations in location model
* fix: remove @locations in location model
* fix: update status names
* feat: wip validation update
* feat: add validation to model layer
* feat: further separate scheme deactivation behaviour
* test: update tests to new flow
* feat: respond to pr comments and add dynamic success text
* feat: duplicate behaviour schemes -> locations (+ tests)
* refactor: linting
* refactor: typo and remove unnecessary line for this PR
* refactor: feature toggle simplification
* Refactor locations and schemes controller actions
- Rename confirmation partials to `deactivate_confirm.html.erb` so that they match the actions in which they belong to
- Make all deactivation date comparision UTC time
* feat: update deactivation_date validation and add tests
* refactor: linting
Co-authored-by: Kat <katrina@kosiak.co.uk>
Co-authored-by: James Rose <james@jbpr.net>
* feature to test editing a scheme
* adding editing buttons
* adding scheme_edit_name route
* controller tests for editing name
* edit-name template missing
* edit-name controller action
* edit-name controller action - leftovers
* padding for checkbox fieldset
* added Which organisation owns the housing stock for this scheme? to the check
* testing editing name via controller
* last test
* lint
* wrong button name
* legend is gone
* Save changes
* failing test for having service and location tabs on the show page
* links on the page
* asking for locations in the link
* created locations
* linked locations to schemes
* locations migration and model
* testing seeing locations
* rubocop
* failing feature to see locations on the page
* route to locations
* controller action plus other bits
* added facatory and view for locations
* supported housing to schemes
* supported housing to schemes - part 2
* supported housing to schemes - part 3
* correct route
* controller test for locations
* added view for locations
* correct and compact view for locations
* testing all attributes on the page
* testing heading
* testing title
* refactored views
* refactored views
* fixed county
* testing pagination
* testing and coding pagy bits for locations
* testing and coding pagy bits for locations page 2
* added tests for support user
* small refactoring of before actions and tests for 401 and 404
* small refactoring
* Trigger WF
* simplified return
* fixing spec failures
* fixed names
* testing back link
* oops
* required changes from comments
* required changes from comments
* renums
* fixed failing tests
* typo
* Managing agent to by
* tests for scheme_items
* added steps to view links to indiividual schemes
* testing there are links to the schemes not just names
* testing there are links to the schemes not just names -2
* added links failing due to no route
* looks per spec
* failing spec for tab helper
* added new attributes to the scheme
* added test for scheme.primary_client_group
* testing clicking to individual scheme
* empty template for show
* testing users not signed in
* testing I can see scheme details on the page
* converting int to strings in scheme model
* better view, seeds and factory
* highlight supported housing for support user
* simplified and extended sab nab logic
* rubocop and redundant check removed
* tests and code to make sure users are highlighted
* tests and code to make sure supported housing is highlighted
* full feature for support user to visit scheme show page
* extended features and filing feature when coordinator viewing scheme for a different org
* returning not found if coordinator user tries to see unrelated scheme
* rubocop
* fixed typos etc
* fixed types for schemes
* Trigger WF
* correct expectation