* 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
* 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
* 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: update scheme status so incomplete unless has active locations
* feat: update scheme typeahead text
* feat: reject incomplete locations
* feat: show completed/incomplete locations and validate when completed == 0
* feat: improve copy
* feat: change active -> completed
* feat: update scheme typeahead text
* feat: reject incomplete locations
* feat: show completed/incomplete locations and validate when completed == 0
* feat: improve copy
* feat: change to confirmed to add clarification in code
* feat: update scheme typeahead text
* feat: reject incomplete locations
* feat: show completed/incomplete locations and validate when completed == 0
* feat: improve copy
* feat: update scheme typeahead text
* feat: reject incomplete locations
* feat: only confirm locations if complete (old) AND save button clicked (new)
* feat: add unconfirmed scope
* refactor: complete -> confirm
* feat: fix tests
* feat: update scheme typeahead text
* feat: reject incomplete locations
* feat: show completed/incomplete locations and validate when completed == 0
* feat: improve copy
* feat: update scheme typeahead text
* feat: reject incomplete locations
* feat: only confirm locations if complete (old) AND save button clicked (new)
* feat: add unconfirmed scope
* refactor: complete -> confirm
* feat: fix tests
* feat: fix more tests
* feat: fix more tests
* refactor: rubocop
* refactor: rubocop
* refactor: rubocop
* feat: add tests for incomplete schemes
* refactor: linting
* feat: test incomplete count too
* feat: test unconfirmed locations aren't options in location_id
* feat: test validation
* feat: test when scheme is confirmed
* feat: test when scheme is confirmed for support user
* feat: test when location is confirmed
* refactor: linting
* refactor: consistent use of factorybot or not within a file
* feat: confirm locations when complete even if save button not clicked, and update tests
* refactor: simplify
* refactor: simplify
* refactor: move location helper methods to helpers
* refactor: move scheme helper methods to helpers
* refactor: formatting
* refactor: po response
* refactor: review response
* Add local authority links
* Display all local authorities for location
* set correct LA for log based on year
* Format local authorities for locations
* Rename variable
* Add import task for la links
* look at form start date because log start date might not be given
* Update app/models/lettings_log.rb
Co-authored-by: James Rose <james@jbpr.net>
* Update app/helpers/locations_helper.rb
Co-authored-by: James Rose <james@jbpr.net>
* Refactor
* Seed review app
* Change dates format
* Update the local authority link data
* Typo
* update mapping in Lettings logs
---------
Co-authored-by: James Rose <james@jbpr.net>
* Update LAs for 23/24 sales questions
* Update LAs for 23/24 lettings questions
* Update LAs for 23/24 location
* Remove redundant assignments
* Update question files to use the local authorities from db
* Update locations to use local authorities from db
* Rebase changes
* Replace hardcoded date
* feat: wip postcode page
* feat: wip add new flow
* feat: add check answers page, continue updating flow
* feat: add back behaviour
* feat: more flow work
* feat: further flow work and flash notice, name tidying
* feat: add check_answers referrer linking
* feat: add controller and details linking and lint
* refactor: erblinting
* feat: add local_authority page (currenlty separate from edit_local_authority to avoid conflict with add location to newly created scheme path, to be fixed later). also copy and routing updates
* feat: add validations to controller (could later be added to model)
* fix: correct date order
* feat: validate on model (except startdate)
* feat: copy update
* refactor: railsification
* feat: add date model validation
* feat: add updated availability text in check_answers
* feat: more updated dynamic text and linking
* refactor: erblinting
* refactor: cleanup of redundant code
* refactor: remove redundant create
* feat: use rails route
* test: wip tests
* test: wip tests
* feat: add new back behaviour for new scheme path and tests wip
* feat: add more back behaviour for new scheme path and fix local auth validation
* feat: further linking behaviour with routes and referrers, don't add new location automatically to new schemes
* feat: if location with no details added, route to normal path rather than check answers
* test: update model and helper location tests
* test: more test updates
* test: more test updates and remove redundant files
* test: remove redundant tests, add postcode test
* test: add new #new tests
* test: add test for all new controller methods
* test: add more startdate tests
* refactor: erblinting
* test: fix failing tests
* test: update scheme test
* feat: respond to PR comments
* feat: make postcode clear only if changed
* feat: add _update methods
* refactor: simplify validation and location_edit_path method
* refactor: add helper method for action text
* refactor: remove redundant logic
* refactor: simplify routing
* refactor: reintroduce location_params
* refactor: use presence validation for postcode
* refactor: use presence validation for la
* feat: validate confirmed
* tests: make tests pass with new startdate validation
* WIP
* refactor: simplify display attributes helpers and update tests
* refactor: linting
* feat: design change to save behaviour
* test: fix failing tests
* feat: location code copy tweak
* refactor: remove redundant function
* refactor: remove add_another_location and new location page
* feat: simplify startdate validations to move to model, use scheme available_from date for in range validation
* test: fix failing tests
* refactor: linting
* feat: remove name validation as a result of PO review
* test: update tests
* refactor: remove redundant context
Co-authored-by: James Rose <james@jbpr.net>
* 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
* route deactivated scheme to reactivation page
* Render correct reactivate question content
* refactor into a helper
* display successful reactivation banner for default date
* Save reactivation date
* Add reactivation errors
* lint and fix url in tests
* make toggle translations generic
* Add reactivation status
* Reuse date validation messages
* Show deactivate this location when location is reactivating soon
* Display correct confirmation banner
* Add validation for reactivation date before deactivation date
* Improve availability label
* Use current collection start date if created at is later than that
* Update paths
* Fix controller and don't display the previous day if location availability start afterwards
* refactor availability label
* Filter out active periods
* lint
* Refactor active_period method into the model
* Allow deactivations and reactivations from available from date instead of start of the collection date
* Prevent deactivations during deactivated periods
* lint
* typo
* Remove active periods that last 1 day (because they get deactivated on the same day)
* Move the active_periods into helper
* extract remove_overlapping_and_empty_periods into a separate method
* Remove nested deactivation periods
* Make deactivate/reactvate location form use location_deactivation_period model
* refactor toggle date methods
* extract shared condition
* update validations
* refactor validations
* Update schemes deactivation form to use dectivation model
* Refactor
* lint
* remove redundant location_id and update scheme controller
* update active_periods
* 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>
* feat: add 2022 rent range data, update rake task for population of this
* feat: change file format so ranges_rent_id is recognised
* feat: add updated error messages and casing
* tests: make tests pass
* feat: ensure there is a location_code in all locations and use this (and beds = 0) for supported housing rent validations
* feat: fix general needs validation behaviour
* feat: add local authorities enum to location.rb
* feat: ensure case when beds > 4 is accounted for
* feat: add error messages on property postcode page as well as la page
* feat: add error messages on scheme_id and location_id as well as la page
* feat: add error messages on scheme_id and location_id as well as la page
* feat: null coalescing and validations on changing las to one that invalidates rent in supported housing
* feat: nil protection
* refactor: linting
* refactor: combining duplicated logic
* tests: add hard validation tests split by needstype
* feat: update validations when beds > 4
* feat: update validations when beds > 4
* refactor: simplification, use preivous la method
* refactor: response to PR comments, fixing beds.negative validation
* feat: remove dynamic local auth name text from interruption screens - to be added back in later if this becomes a priority, would need some work on adding local auth name to log for supported housing logs not just leaving it in the location
* Add mobility type question
* Remove wheelchair_adaptation, use mobility_type to infer wchair
* Add validatio to mobility type
* tests
* Rebase main
* CYA test
* extract selection methods into a helper