Recidiviz / justice-counts

Technical infrastructure for the Justice Counts initiative
GNU General Public License v3.0
2 stars 0 forks source link

[Publisher] Require completion of free text description when "Other" breakdown is enabled #1426

Closed nichelle-hall closed 2 months ago

nichelle-hall commented 4 months ago

In Metric Settings, there are breakdowns that have the "Other" option, but no direct way to capture a free text description of what the "Other" option consists of. In order to add those details, a user has to go to the Define Metrics tab, click on the "Other ..." definition, and enter details in the free text field.

Now the tricky part...

Now, CSG would like to require completion of the free text description if an agency marks the "Other" option in any metric. One way we can accomplish this is by adding custom logic wherever there is an "Other" type selected within a breakdown and that opens a modal with a free text input that allows users to describe what is included in the "Other" category.

This text field should sync both-ways with the text field for that definition (if you go to Define Metrics and select the "Other" definition, the text field should show what the user input in the earlier modal). If the entry is blank (either user doesn't input any information, doesn't save, or deletes previous information, the "Other" should uncheck.

Example: Screenshot 2024-07-25 at 11 48 19 AM

When you select "Other Expenses", a modal should pop up similar to the one for the definitions (reference below screenshot), where a user MUST enter a value in order for the "Other Expenses" to be checked and saved. If they don't, the "Other Expenses" will remain unchecked - and if they enter a value, it will be checked.

Screenshot 2024-07-25 at 11 48 29 AM

Now, if the user goes to Define Metrics, and clicks on the "Other Expenses" definition, and removes what they entered in the text field and save, this should automatically uncheck and save the "Other Expenses".

Let me (@mxosman) know if there's anything that would be helpful to clarify or talk through. This is a tricky one too, so happy to help think through how best to accomplish this.