* Refactor working situation to take in person index
* Refactor age to take in person index
* Remove unused methods
* Cleanup
* Change person_index to a named argument
* extract details_known_question_id
* Fix answer options
* Add field_for_person methods
* Add person1 working situation question
* Add ecstat3 column to the sales log
* migration
* Add the rest of ecstat questions
* Update schema
* tests
* Reuse pages and questions
* Reuse the same page
* refactor indexes
* Add other ecstat columns
* Extract person methods to parent class
* Validate that the user belongs to either the managing or owning organisation
* do not reset created_by and remove user_organisation_chosen?
* Do not default managing organisation to owning organisation
* validate user belongs to organisation
* update tests to specify created_by
* clear create_by for support users
* refactor
* typo
* rebase lint
* Add `updated_by` to logs to track who was the last person to update a log
- Reset `created_by` automatically when a form is updated and the owner does not belong to the managing or owning organisation
* move reset_invalidated_dependent_fields!, update schema file and fix tests
Co-authored-by: James Rose <james@jbpr.net>
* Add income1_value_check column
* Use dynamic ids for pages
* Display Buyer1IncomeValueCheck twice
* Use id argument and pass in full IDs
* Remove accidental migration
* Include shared validations in sales log model and run validate_numeric_min_max method
* Add non london hard max income validation
* Add london income validation
* Remove child vlidation because buyer cannot be a child
* Add income1_value_check column
* Add buyer_1_income_value_check question and page
* Update income1_under_soft_min?
* Add mortgage and value check column
* Add mortgage value check page
* Update mortgage_over_soft_max? in soft validateions
* Remove unused error message
- It's possible that we import rent periods for an organisation that we haven't yet defined on the new service
- In this instance an organisation as `rent_period` of 10, which correspondsto 'Weekly for 53' in the previous service
- Until we decide how to manage that rent period we should safely generate the rent labels
* Display person 2, 3, 4 age question if their details are known
* Infer check answers value for age questions as 'Not known'
* Hide age known question in check answers if it is answered yes or no
* Add card numbers to household characteristics question
* Update gender identity depends on
* lint
* Add a field to completed sales log in factory
* Update person 1 gender identity to depend on the people count
* Do not show buyer 2 questions if it is not a joint purchase
* Add a test to clear the voiddate for unresolved logs
* feat: add reset_voiddate method
* feat: only reset voiddate if log is unresolved
* test: check voiddate not cleared if log is resolved
* feat: remove redundant check for startdate and voiddate being non-nil
* feat: make reset_voiddate into a bang method
* test: add tests for clearing mrcdate
* feat: create reset_mcrdate! method
* refactor
* reset rent values when rent validation triggers
* refactor tests
* Test for checking that other validations aren't impacted
Co-authored-by: Sam Seed <sam.seed@softwire.com>
* CLDC-1688 Affected logs mailer
* CLDC-1688 Correct update_logs path
* CLDC-1688 Review markups
Co-authored-by: James Rose <james@jbpr.net>
Update app/controllers/schemes_controller.rb
Co-authored-by: James Rose <james@jbpr.net>
Update app/controllers/locations_controller.rb
Co-authored-by: James Rose <james@jbpr.net>
* Refactor to queue messages
* Update test
* remove irrelevant test
Co-authored-by: James Rose <james@jbpr.net>
Co-authored-by: Kat <katrina@kosiak.co.uk>
* add start of bulk upload logs journey
* split upload controller into 2
* add year page to bulk upload journey
* bulk upload years now dynamic
* add placeholder for upload your file page
* handle bulk upload when not in crossover
* add bulk upload csv user journey
* bulk upload now persists and sends to S3
* swap ruby-filemagic for file command
* match csv or text file for validation
* in_crossover_period? now uses overlap of forms
- also moved from Form to FormHandler
* add production env var for CSV bucket
* stub kernel call methods
* remove duplicate env var
* hardcode env var for review apps
* move feature toggle to FeatureToggle
* crossover period checks now specific to the form
* fix typo in bulk upload journey
* feat: start adding scheme validation for when owning org doesn't hold stock
* feat: don't set owning_organisation = nil in validate_owning_organisation
* style: line code
* test: remove redundant test for missing owning org
* test: add test for invalid owning org id (invalid as doesn't hold stock)
* test: add test that including owning org does nothing when user is coordinator
* test: standardise missing params test descriptions in schemes_controller_spec
* test: remove owning org id from required params list for data coordinators
* test: write "support user", not just "support"
* test: fix incorrect test descriptions
* test: test validation raised when updating model with non-stock-owning org
* config: set dummy_org in seeds as holding own stock
* test: test for actual validation string, not the validation lookup
* refactor: change owning_organisation_id: organisation.id to owning_organisation: organisation
* test: move scheme params def onto 1 line
* style: move "validate :validate_owning_organisation" onto new line
* Add gender identity 3 comumn to the sales table
* Add gender identity for person 1
* Add gender identity for person 1 when there is only 1 buyer
* Add person 1 gender identity page to subsection
* Rename questions and pages
* fix tests
* Conditionally display a correct review log text
* do not allow the aswers from previous collection windows to be changed
* does not let the user navigate to questions for previous collection year logs
* Fix tests
* Add some docs
* Extract collection period check into a before_action and change path to rails route
* update the tasklist message
* Add sorting per org
* Pull out confirmed set to null because they're also not marked as confirmed
* Create relevant tests
* Extract scopes and remove wrong test
* Mark log as impacted by deactivation when location is deactivated
* Display affected logs in the table
* Route affected logs to tenancy start date question
* Update routes to get the tenancy start date page from form
* update next_page_redirect_path
* rename column
* Fix tests
* Add next_unresolved_page_id to pages
* Update unresulved when the log is corrected
* Mark logs as unresolved when scheme gets deactivated
* display correct content when there are no unresolved logs
* mark logs resolved after the user leaves check answers page
* Display link in success banner and reset banner when the link is clicked
* display inset hint text for unresolved log questions
* Display unresolved logs banner
* update banner message
* Persist the link in the banner
* update inset text
* Update success banner text
* Add unresolved and created_by scopes
* rename method
* add unresolved_log_redirect_page_id to form + typo and route
* Add UnresolvedLogHelper and extract flack notice message
* pluralize and return early
* remove flash[:notice] = nil
* to keep it consistent for sales log
* Extract unresolved path and fix a link
* extract resolve method and fix attribute nme
* update path
* typo
* add start of bulk upload logs journey
* split upload controller into 2
* add year page to bulk upload journey
* bulk upload years now dynamic
* bulk upload journey: add copy for prepare file
* add link to bulk upload template
* add placeholder for upload your file page
* handle bulk upload when not in crossover
* fix tests around bulk upload redirect
* fix typos in bulk upload jouney
* 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>
* Update affected logs count and skip the confirmation page if no logs are affected for locations
* Update affected logs count and skip the confirmation page if no logs are affected for schemes
* refactor
* Add a default ordering for schemes
* Move ordering back to the controller
* Update app/controllers/schemes_controller.rb
Co-authored-by: James Rose <james@jbpr.net>
Co-authored-by: James Rose <james@jbpr.net>
* remove Organisation#relationship_type
* add indexes and fk constraints to org relations
* remove relationship_type from seeds
- as these have now been removed
* seeding is now idempotent
* 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
* Bugfix provider_type on nil
* Do not infer managing org
* Always show 'your org' to non support users
* Never show created_by_id in CYA
* Show HousingProvider in CYA when not inferred
* Always show ManagingOrganisation
* Spec fix
* Show ManagingOrganisation if managing agents >=1
* typo
* 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