WIP: Add formatter and some other stuff

This commit is contained in:
2025-11-29 14:33:15 +09:00
parent d70f5bb389
commit 6a8c4fe1e1
3 changed files with 286 additions and 40 deletions
+7 -6
View File
@@ -17,6 +17,7 @@
-include_lib("wx/include/wx.hrl").
-include("$zx_include/zx_logger.hrl").
-include("gd.hrl").
-record(s,
{frame = none :: none | wx:wx_object(),
@@ -232,7 +233,7 @@ done(#s{frame = Frame, caller = Caller,
case clean_spend(TX) of
{ok, CleanTX} ->
end,
Result =
case wxTextCtrl:getValue(NameTx) of
"" ->
@@ -246,10 +247,12 @@ done(#s{frame = Frame, caller = Caller,
ok = wxFrame:destroy(Frame),
zxw_modal:done(Caller, Result).
clean_spend(TX) ->
clean_spend(TX, []).
clean_spend(#spend_tx{recipient_id = ""}) ->
ok;
clean_spend( TX = #spend_tx{amount = S}) when is_list(S) ->
clean_spend(TX = #spend_tx{recipient_id = ""}, Errors) ->
clean_spend(TX#spend_tx{recipient_id = none}, [recipient_id | Errors]);
clean_spend(TX = #spend_tx{amount = S}, Errors) when is_list(S) ->
case string_to_price(S) of
{ok, Amount} -> clean_spend(TX#spend_tx{amount = Amount});
{error, _} -> ok
@@ -270,5 +273,3 @@ clean_spend(TX) ->
{ok, CleanTX}.
is_int(S) ->
lists:all(fun(C) -> $0 =< C andalso C =< $9 end, S).