Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(income-plan): add year #15847

Merged
merged 68 commits into from
Sep 2, 2024
Merged

feat(income-plan): add year #15847

merged 68 commits into from
Sep 2, 2024

Conversation

karenbjorg
Copy link
Member

@karenbjorg karenbjorg commented Sep 2, 2024

What

Add the year for which TR is currently accepting income plans to description.

Why

Because there can be a period (sometime in dec) when the applicant is not submitting income plan for the current year and instead for the next year.

Screenshots / Gifs

Screenshot 2024-09-02 at 14 35 09 Screenshot 2024-09-02 at 14 35 27

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Enhanced the income plan form with dynamic descriptions based on the applicant's current income plan status, improving contextual relevance.
    • Introduced a new message structure that includes a dynamic year placeholder for clearer communication regarding income plans.
  • Bug Fixes

    • Updated messaging to ensure users receive accurate descriptions related to their specific income plans.

ylfahfa and others added 30 commits May 16, 2024 12:35
* fix:add scopes

* fix: use type

* chore: add to codeowners

* fix: codewners

* WIP table

* feat: update client

* fix: handle 404

* fix: write applciation

* Seeder file for adding scopes to @island.is/clients/api

* chore: nx format:write update dirty files

* use application and active field for options in table repeater, populate categories and types in income plan with info from TR, add readonly for fields in table repeater

* get currencies from TR and populate dropdown, format input fields that display something regarding income, call withholding tax api from TR and implement some rules when adding income to the income plan

* WIP call withholdind income plan api from TR

* validation when adding income, wip tooltip on fields in table repeater, format number showed in income table

* mock withholding tax and populate table, add readonly to table fields, change tooltip for checkbox and format

* add review screen

---------

Co-authored-by: Þorkell Máni Þorkelsson <mani@hugsmidjan.is>
Co-authored-by: Þorkell Máni Þorkelsson <wowthorkell@gmail.com>
Co-authored-by: ori.jonab <Jon.Arnar.Briem@origo.is>
Co-authored-by: andes-it <builders@andes.is>
* text changes

* format

* make open application button texts editable

* format

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>
* WIP send income plan to TR

* send income plan

* remove
* add unit tests for state transitions

* add unit tests for utils

* format

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>
veronikasif and others added 6 commits August 30, 2024 13:06
* call income plan conditions api

* Add incomePlanConditions to getApplicationExternalData

* Add AlertMessage when no available prerequisites for temporary calculation

* change income year

* Update dataSchema

* Update sendApplication and temporary calculation query input

* Update unsetIncomePlan template action and added unit test

---------

Co-authored-by: karenbjorg <khalldorsdottir@deloitte.is>
* move Item component and remove FC

* remove

* move Item component
@karenbjorg karenbjorg requested a review from a team as a code owner September 2, 2024 14:36
Copy link
Contributor

coderabbitai bot commented Sep 2, 2024

Walkthrough

The changes involve updating the IncomePlanForm.ts file to provide a dynamic description for the income plan table field based on the application's state. This is achieved by replacing a static description with a function that retrieves relevant data from the Application object. Additionally, the messages.ts file is modified to include a dynamic year placeholder in the income plan description and to add a new property for the current income plan description.

Changes

File Change Summary
libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts Updated description from a static string to a function that generates a dynamic description based on the Application object. Modified import statements to include Application.
libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts Enhanced incomePlanFormMessage with a dynamic year placeholder in the default message and added a new property currentIncomePlanDescription for the active income plan.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Tip

Early access features: enabled

We are currently testing the following features in early access:

  • Anthropic claude-3-5-sonnet for code reviews: Anthropic claims that the new Claude model has stronger code understanding and code generation capabilities than their previous models. Note: Our default code review model was also updated late last week. Please compare the quality of the reviews between the two models by toggling the early access feature.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues on the discussion post.

@karenbjorg karenbjorg added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 2, 2024
Copy link

codecov bot commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.94%. Comparing base (f7dc690) to head (c446a3b).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #15847   +/-   ##
=======================================
  Coverage   36.94%   36.94%           
=======================================
  Files        6680     6680           
  Lines      136459   136459           
  Branches    38745    38745           
=======================================
  Hits        50409    50409           
  Misses      86050    86050           
Flag Coverage Δ
api 3.39% <ø> (ø)
api-domains-communications 40.62% <ø> (ø)
application-system-api 41.75% <ø> (ø)
application-template-api-modules 23.66% <ø> (-0.02%) ⬇️
application-ui-shell 21.17% <ø> (ø)
cms 0.43% <ø> (ø)
cms-translations 39.78% <ø> (ø)
judicial-system-api 18.26% <ø> (ø)
judicial-system-backend 56.20% <ø> (ø)
services-user-notification 47.75% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...nce-administration/income-plan/src/lib/messages.ts 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7dc690...c446a3b. Read the comment docs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b1c86d5 and 98aa8ad.

Files selected for processing (2)
  • libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts (2 hunks)
  • libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts (1 hunks)
Additional context used
Path-based instructions (2)
libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Additional comments not posted (4)
libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts (3)

146-148: Improved dynamic messaging for income plan description

The description property has been updated to include a dynamic year placeholder {incomePlanYear}. This change enhances the context-awareness of the message, providing users with more specific information about the year for which the income plan is applicable.

To ensure the incomePlanYear placeholder is correctly used throughout the codebase, run the following script:

Verification successful

Consistent usage of incomePlanYear placeholder verified

The incomePlanYear placeholder is consistently used across multiple files in the codebase, ensuring that the dynamic messaging enhancements are well-integrated and context-aware. This confirms that the changes made to the description property in messages.ts are effectively supported throughout the application.

  • libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts
  • libs/application/templates/social-insurance-administration/income-plan/src/fields/TemporaryCalculationTable/index.tsx
  • libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts
  • libs/application/template-api-modules/src/lib/modules/templates/social-insurance-administration/social-insurance-administration-utils.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of incomePlanYear placeholder
# Test: Search for incomePlanYear usage. Expect: Consistent usage across relevant files.

rg --type typescript "incomePlanYear"

Length of output: 72


Script:

#!/bin/bash
# Description: Verify the usage of incomePlanYear placeholder
# Test: Search for incomePlanYear usage. Expect: Consistent usage across relevant files.

rg --type ts "incomePlanYear"

Length of output: 2150


149-152: New property added for current income plan description

A new property currentIncomePlanDescription has been added to provide a specific message for the currently active income plan. This addition improves the user experience by offering clearer and more targeted information about the current year's income plan.

To ensure the new property is correctly implemented and used, run the following script:

Verification successful

Property currentIncomePlanDescription is correctly implemented and used

The currentIncomePlanDescription property is defined and utilized appropriately within the codebase, specifically in the IncomePlanForm.ts component. This confirms that the property is correctly implemented and used as intended.

  • Definition: libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts
  • Usage: libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the implementation and usage of currentIncomePlanDescription
# Test: Search for currentIncomePlanDescription usage. Expect: Proper implementation and usage in relevant components.

rg --type typescript "currentIncomePlanDescription"

Length of output: 86


Script:

#!/bin/bash
# Description: Verify the implementation and usage of currentIncomePlanDescription
# Test: Search for currentIncomePlanDescription usage. Expect: Proper implementation and usage in relevant components.

rg "currentIncomePlanDescription" --glob "*.ts"

Length of output: 328


146-152: Verify adherence to library code guidelines

The changes appear to follow the guidelines for files in the libs directory. However, let's verify the following aspects:

  1. Reusability: The messages are defined in a modular way, promoting reusability across different NextJS apps.
  2. TypeScript usage: The MessageDir type is used for defining props and exporting types.
  3. Tree-shaking and bundling: The use of defineMessages facilitates effective tree-shaking.

To ensure full compliance with the guidelines, run the following script:

Verification successful

Code adheres to library code guidelines

The code in messages.ts adheres to the library code guidelines by ensuring reusability through export statements, using TypeScript for type definitions, and supporting tree-shaking with react-intl.

  • Reusability: Multiple export statements are present, promoting modularity.
  • TypeScript Usage: The MessageDir type is defined and used.
  • Tree-shaking: defineMessages from react-intl is used.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify adherence to library code guidelines
# Test 1: Check for export statements to ensure reusability
# Test 2: Verify TypeScript usage for props and types
# Test 3: Check for potential tree-shaking issues

echo "Checking export statements:"
rg --type typescript "export const" libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts

echo "\nVerifying TypeScript usage:"
rg --type typescript "MessageDir" libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts

echo "\nChecking for potential tree-shaking issues:"
rg --type typescript "import \{.*\} from 'react-intl'" libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts

Length of output: 747


Script:

#!/bin/bash
# Description: Verify adherence to library code guidelines
# Test 1: Check for export statements to ensure reusability
# Test 2: Verify TypeScript usage for props and types
# Test 3: Check for potential tree-shaking issues

echo "Checking export statements:"
rg --type ts "export const" libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts

echo "\nVerifying TypeScript usage:"
rg --type ts "MessageDir" libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts

echo "\nChecking for potential tree-shaking issues:"
rg --type ts "import \{.*\} from 'react-intl'" libs/application/templates/social-insurance-administration/income-plan/src/lib/messages.ts

Length of output: 1045

libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts (1)

14-19: LGTM: Import statement updated correctly.

The import statement has been appropriately updated to include the Application type, which is necessary for the new description function.

@karenbjorg karenbjorg removed the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 2, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 98aa8ad and 7af1a1b.

Files selected for processing (1)
  • libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/application/templates/social-insurance-administration/income-plan/src/forms/IncomePlanForm.ts

@karenbjorg karenbjorg added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 2, 2024
@karenbjorg karenbjorg added the deploy-feature Deploys features to dev label Sep 2, 2024
@kodiakhq kodiakhq bot merged commit 47779ce into main Sep 2, 2024
78 checks passed
@kodiakhq kodiakhq bot deleted the feat/income-plan-year branch September 2, 2024 16:01
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
* set up payment plan template

* change application name to income plan

* add instructions page

* implement conclusion screen

* Change some texts after review

* feat(tr): income plan table (#15340)

* fix:add scopes

* fix: use type

* chore: add to codeowners

* fix: codewners

* WIP table

* feat: update client

* fix: handle 404

* fix: write applciation

* Seeder file for adding scopes to @island.is/clients/api

* chore: nx format:write update dirty files

* use application and active field for options in table repeater, populate categories and types in income plan with info from TR, add readonly for fields in table repeater

* get currencies from TR and populate dropdown, format input fields that display something regarding income, call withholding tax api from TR and implement some rules when adding income to the income plan

* WIP call withholdind income plan api from TR

* validation when adding income, wip tooltip on fields in table repeater, format number showed in income table

* mock withholding tax and populate table, add readonly to table fields, change tooltip for checkbox and format

* add review screen

---------

Co-authored-by: Þorkell Máni Þorkelsson <mani@hugsmidjan.is>
Co-authored-by: Þorkell Máni Þorkelsson <wowthorkell@gmail.com>
Co-authored-by: ori.jonab <Jon.Arnar.Briem@origo.is>
Co-authored-by: andes-it <builders@andes.is>

* remove fake form steppers and call latest income plan

* foreign income + populate table with latest income plan

* format

* add history logs and corresponding messages

* feat(income-plan): text changes (#15636)

* text changes

* format

* eligible and update after withholding tax and latest income plan outputs was changed

* [TS-839] Calculate income per year (#15682)

* update read me and add flow chart (#15669)

* feat(income-plan): make more application card texts editable  (#15754)

* text changes

* format

* make open application button texts editable

* format

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>

* [TS-848] Jafnar tekjur á mánuði (#15733)

* [TS-849] uneven income (#15701)

* feat(income-plan): send income plan (#15777)

* WIP send income plan to TR

* send income plan

* remove

* update eligible

* default IKR

* ts-853 change bottom button link

* clean up

* feat(income-plan): Add unit tests (#15778)

* add unit tests for state transitions

* add unit tests for utils

* format

* chore: nx format:write update dirty files

---------

Co-authored-by: andes-it <builders@andes.is>

* [TS-847] start application at the first page when table has been filled (#15793)

* add review and complete state to income plan + feature flag

* validation was triggered

* remove mock data

* clean

* feat(income-plan): Temporary calculation table (#15642)

* set up temporary calculation page and data

* add print screen custom component and messages

* fix input and add to temporary calculation screen

* [TS-823] temporary calculation plan page

* Add validation to incomePlanTable - nonempty

* Fixed query input

* Added AlertMessage when no payments

* Update temporary calculation query input

* chore: nx format:write update dirty files

---------

Co-authored-by: ylfahfa <yhafsteinsdottir@deloitte.is>
Co-authored-by: karenbjorg <khalldorsdottir@deloitte.is>
Co-authored-by: andes-it <builders@andes.is>

* [TS-889] fix validation for currency (#15803)

* if selected employment income and register uneven income, changing to other type of income then months still showed

* foreign income per year where not validated

* chore: nx format:write update dirty files

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Fixed typo in dataProviders externalDataId

* Memoize the rows array to improve performance

* Improve useEffect dependency array for better performance.

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update libs/application/templates/social-insurance-administration/income-plan/README.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* use Int instead of Number for number decorator

* remove commented out code and nullable (#15812)

* feat(income-plan): income plan conditions (#15820)

* call income plan conditions api

* Add incomePlanConditions to getApplicationExternalData

* Add AlertMessage when no available prerequisites for temporary calculation

* change income year

* Update dataSchema

* Update sendApplication and temporary calculation query input

* Update unsetIncomePlan template action and added unit test

---------

Co-authored-by: karenbjorg <khalldorsdottir@deloitte.is>

* fix(table-repeater): move Item component and remove FC (#15830)

* move Item component and remove FC

* remove

* move Item component

* add variables to useEffect dependency array

* add the year for which TR is currently accepting income plans

* different description if applicant has accepted income plan

* simplify

---------

Co-authored-by: ylfahfa <yhafsteinsdottir@deloitte.is>
Co-authored-by: Þorkell Máni Þorkelsson <mani@hugsmidjan.is>
Co-authored-by: Þorkell Máni Þorkelsson <wowthorkell@gmail.com>
Co-authored-by: ori.jonab <Jon.Arnar.Briem@origo.is>
Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: Ylfa <55542991+ylfahfa@users.noreply.github.com>
Co-authored-by: veronikasif <54938148+veronikasif@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Veronika Sif <veronikasif@hotmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-feature Deploys features to dev deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants