mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 13:35:21 +02:00
Stock filter (#1376)
* Initial pass at stock filtering * Rough in filter * Cleaning up security listing * Tweak to search function * Combobox tweaks * Clean up search query * Update trades test with combobox * Update securities.yml
This commit is contained in:
parent
c2561b5fb4
commit
7d8028b505
15 changed files with 104 additions and 7 deletions
|
@ -7,10 +7,12 @@
|
|||
<div class="space-y-2">
|
||||
<%= form.select :type, options_for_select([%w[Buy buy], %w[Sell sell], %w[Deposit transfer_in], %w[Withdrawal transfer_out], %w[Interest interest]], "buy"), { label: t(".type") }, { data: { "trade-form-target": "typeInput" } } %>
|
||||
<div data-trade-form-target="tickerInput">
|
||||
<%= form.text_field :ticker, value: nil, label: t(".holding"), placeholder: t(".ticker_placeholder") %>
|
||||
<div class="form-field combobox">
|
||||
<%= form.combobox :ticker, securities_account_trades_path(entry.account), label: t(".holding"), placeholder: t(".ticker_placeholder"), autocomplete: :list, free_text: true %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= form.date_field :date, label: true %>
|
||||
<%= form.date_field :date, label: true, value: Date.current %>
|
||||
|
||||
<div data-trade-form-target="amountInput" hidden>
|
||||
<%= form.money_field :amount, label: t(".amount"), disable_currency: true %>
|
||||
|
|
7
app/views/account/trades/_tickers.turbo_stream.erb
Normal file
7
app/views/account/trades/_tickers.turbo_stream.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div class="flex items-center">
|
||||
<%= image_tag("https://logo.synthfinance.com/ticker/#{tickers&.ticker}", class: "rounded-full h-8 w-8 inline-block mr-2") %>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-sm font-medium"><%= tickers&.name.presence || tickers&.ticker %></span>
|
||||
<span class="text-xs text-gray-500"><%= "#{tickers&.ticker} (#{tickers&.exchange_acronym})" %></span>
|
||||
</div>
|
||||
</div>
|
3
app/views/account/trades/securities.turbo_stream.erb
Normal file
3
app/views/account/trades/securities.turbo_stream.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%= async_combobox_options @securities,
|
||||
render_in: { partial: "account/trades/tickers" },
|
||||
next_page: @pagy.next %>
|
Loading…
Add table
Add a link
Reference in a new issue