medic / cht-user-management

GNU Affero General Public License v3.0
3 stars 1 forks source link

add age widget #122

Closed freddieptf closed 6 months ago

freddieptf commented 6 months ago

This PR adds an age input that only supports integers. It doesn't completely fix #59 and only provides a way to config the app to accept either one of Calendar or Age integer input @jonathanbataire and convert that to a date of birth at upload. I couldn't find a clean way to hack this one in as it would require having a switch that can dynamically update an input's type. Did you have any ideas here @inromualdo?

freddieptf commented 6 months ago

I've updated the PR to add support for a plain date string, the calendar widget will not be shown on the UI. Does this work for you @jonathanbataire?

freddieptf commented 6 months ago

While doing this i felt like we might benefit from introducing new property types e.g an "OR" type that can dynamically switch between two input types and correctly handle this in the presentation, validation and data layer. I'm not sure how much of a rewrite we'd need to do this but it might be worth it if we want dynamic inputs on the UI at least.

freddieptf commented 6 months ago

Why can't we just have UI for the dob type which allows both inputs?

the calendar widget will not be shown on the UI

Is this change pending? I personally think we should leave UI as-is. Or what is your reason to remove the calendar widget?

Because the dob type opens the browser's calendar widget, it's not a normal text input so we can't support both.

kennsippell commented 6 months ago

We could add like a checkbox or something like we do in cht?

This is what the UI looks like today for the UG config. It has both a place for calendar widget and numeric input.

image image

freddieptf commented 6 months ago

I couldn't find a clean way to hack this one in as it would require having a switch that can dynamically update an input's type

It comes back to this, I've pushed changes to effect the changes requested for further discussions

kennsippell commented 6 months ago

Completing this PR for Fred since he is on holiday for a week or so.