manager-ui icon indicating copy to clipboard operation
manager-ui copied to clipboard

Schema: Currency Field - Users can set default currency

Open zcolah opened this issue 1 year ago • 1 comments

Problem

Users are unable to save a currency value

When a user creates a currency field in a model, they see the following input for it's corresponding content items. This input allows them to enter a numeric value and to select a currency from a list of dropdown options selected. However the currency selected from this list of dropdown options is never stored and hence it always appears as "$" even if the user tries to update it to another currency symbol. Even when the user changes the currency value in the dropdown field, the user cannot save the item.

image

Users wish to set one specific currency value to be used for a field

The currency field is usually used for fields that store prices, costs, monetary amounts, etc. Specifically these prices should all be in the same currency, and administrators would like the default currency value to be set at a model level so as to ensure all prices are in the correct currency always.

Users cannot search currencies by their currency code (e.g. USD, INR) or by country name (e.g. United States)

The current dropdown list only lists symbols and the currency name. This hence does not allow for a user to search for a currency by it's currency code or country name. Which makes it very important for the user to know the currency name or symbol before coming into the system.

CleanShot 2024-01-16 at 14 47 13

Solution

We will now allow users to set the currency for a currency field at a model level, instead of at the content item level.

image

This currency value will then be displayed in the currency field of a content item and will not be editable at a content item level. See example below.

image

Improved Dropdown

The dropdown menu now displays a Flag Image, Currency Code, and Country Name in addition to the currency name and symbol. It can also be filtered by the same.

image

Developer Notes

  1. This currency symbol should be stored in the field settings and can be accessed via the API or a Parsley call. Please ask @shrunyan for more direction on the same.
  2. For all past currency fields created, please set the currency as "USD $ United States Dollar". This is because the current currency that we display for all currency fields has always been this even after a user tries to update the value in the dropdown.
  3. The Currency input should be an auto-complete input.
  • A currency field cannot be created without a currency being selected.
  • Each dropdown menu option has a Flag Image, Currency Code, Currency Symbol, Country Name, Currency Name. All the dropdown options with this information can be found here: https://gist.github.com/manishtiwari25/d3984385b1cb200b98bcde6902671599
  • The user should be able to use the autocomplete input to filter the dropdown options by Currency Code, Currency Symbol, Country Name, Currency Name.
  • If the user types in an invalid value, and changes to the next input, then revert back to the field’s previous value.

Figma

https://www.figma.com/file/zOI7oSH3fG1XDmmPzsP6PX/Zesty-3.0-Revamp?type=design&node-id=3615%3A9908&mode=dev&t=CnknsGlvcax4i2WL-1

zcolah avatar Jan 16 '24 09:01 zcolah

@shrunyan wouldn't this need some kind of backend change in order for the users to determine what currency this field value has when they try to access the value via api or parsley? This is because the user-defined currency will only be stored on the model's field setting level.

finnar-bin avatar Jul 08 '24 02:07 finnar-bin