pelmered / filament-money-field

Money field powered by Money PHP
MIT License
37 stars 17 forks source link

How to remove decimal part when fill data #38

Open kohaku1907 opened 1 month ago

kohaku1907 commented 1 month ago

Hi bro. I m trying to create an edit form . I m using MoneyInput inside Repeater and fill json data to this Repeater with integer . Ex: {'amount': 1000000} But it always add ",00" to end of input . Ex: 1.000.000,00 My code :

MoneyInput::make('amount') ->label(__('Amount')) ->minValue(0) ->currency('VND') ->locale('vi_VN') ->required()

My .env file:

MONEY_DEFAULT_LOCALE=vi_VN MONEY_DEFAULT_CURRENCY=VND MONEY_USE_INPUT_MASK=true MONEY_UNIT_PLACEMENT=after

pelmered commented 1 month ago

Do you want to set this globally, or for just the field?

To set it globally you can try to set this in your .env file:

MONEY_FRACTION_DIGITS=0

Setting it on an individual field is currently not supported, but that would be a great addition. I will add that.

kohaku1907 commented 1 month ago

I think your release version 1.3.2 is not latest source . I checked the config file and there is not exists MONEY_FRACTION_DIGITS .

pelmered commented 1 month ago

I think your release version 1.3.2 is not latest source . I checked the config file and there is not exists MONEY_FRACTION_DIGITS .

Ah, yes. You are right. Sorry about that. I will try to get a new version out this weekend.

kohaku1907 commented 3 weeks ago

I hope you release a full updated . Thanks a lot