2024-04-09 16:08:58 +04:00
<h1 class="text-3xl font-semibold font-display"><%= t(".title") %></h1>
2024-02-08 10:46:05 -06:00
<%= modal do %>
2024-05-02 07:24:31 -06:00
<div class="flex flex-col min-h-[530px] w-screen max-w-xl" data-controller="list-keyboard-navigation">
2024-02-27 12:43:49 -05:00
<% if @account.accountable.blank? %>
<div class="border-b border-alpha-black-25 p-4 text-gray-400">
2024-04-09 16:08:58 +04:00
<%= t ".select_accountable_type" %>
2024-02-27 12:43:49 -05:00
</div>
<div class="flex flex-col p-2 text-sm grow">
<button hidden data-controller="hotkey" data-hotkey="k,K,ArrowUp,ArrowLeft" data-action="list-keyboard-navigation#focusPrevious">Previous</button>
<button hidden data-controller="hotkey" data-hotkey="j,J,ArrowDown,ArrowRight" data-action="list-keyboard-navigation#focusNext">Next</button>
2024-06-20 07:26:25 -04:00
<%= render "account_type", type: Depository.new, bg_color: "bg-blue-50", text_color: "text-blue-500", icon: "landmark" %>
<%= render "account_type", type: Investment.new, bg_color: "bg-green-50", text_color: "text-green-500", icon: "line-chart" %>
<%= render "account_type", type: Crypto.new, bg_color: "bg-green-50", text_color: "text-green-500", icon: "bitcoin" %>
<%= render "account_type", type: Property.new, bg_color: "bg-pink-50", text_color: "text-pink-500", icon: "home" %>
<%= render "account_type", type: Vehicle.new, bg_color: "bg-indigo-50", text_color: "text-indigo-500", icon: "car-front" %>
<%= render "account_type", type: CreditCard.new, bg_color: "bg-violet-50", text_color: "text-violet-500", icon: "credit-card" %>
<%= render "account_type", type: Loan.new, bg_color: "bg-yellow-50", text_color: "text-yellow-500", icon: "hand-coins" %>
<%= render "account_type", type: OtherAsset.new, bg_color: "bg-green-50", text_color: "text-green-500", icon: "plus" %>
<%= render "account_type", type: OtherLiability.new, bg_color: "bg-red-50", text_color: "text-red-500", icon: "minus" %>
2024-02-27 12:43:49 -05:00
</div>
<div class="border-t border-alpha-black-25 p-4 text-gray-500 text-sm flex justify-between">
<div class="flex space-x-5">
<div class="flex items-center space-x-2">
2024-06-13 09:16:00 -04:00
<span>Select</span>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-5 h-5 shrink-0 grow-0 items-center justify-center"><%= lucide_icon("corner-down-left", class: "inline w-3 h-3") %></kbd>
2024-02-27 12:43:49 -05:00
</div>
<div class="flex items-center space-x-2">
2024-06-13 09:16:00 -04:00
<span>Navigate</span>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-5 h-5 shrink-0 grow-0 items-center justify-center"><%= lucide_icon("arrow-up", class: "inline w-3 h-3") %></kbd>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-5 h-5 shrink-0 grow-0 items-center justify-center"><%= lucide_icon("arrow-down", class: "inline w-3 h-3") %></kbd>
2024-02-27 12:43:49 -05:00
</div>
2024-02-08 10:46:05 -06:00
</div>
<div class="flex items-center space-x-2">
2024-06-13 09:16:00 -04:00
<button data-action="modal#close">Close</button>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-8 h-5 shrink-0 grow-0 items-center justify-center text-xs">ESC</kbd>
2024-02-08 10:46:05 -06:00
</div>
</div>
2024-02-27 12:43:49 -05:00
<% elsif params[:step] == 'method' && @account.accountable.present? %>
<div class="border-b border-alpha-black-25 p-4 text-gray-400 flex items-center space-x-3">
<%= link_to new_account_path, class: "flex w-8 h-8 shrink-0 grow-0 items-center justify-center rounded-lg bg-alpha-black-50 back focus:outline-gray-300 focus:outline" do %>
2024-04-09 16:08:58 +04:00
<%= lucide_icon("arrow-left", class: "text-gray-500 w-5 h-5") %>
2024-02-27 12:43:49 -05:00
<% end %>
<span>How would you like to add it?</span>
2024-02-08 10:46:05 -06:00
</div>
2024-02-27 12:43:49 -05:00
<div class="flex flex-col p-2 text-sm grow">
<button hidden data-controller="hotkey" data-hotkey="k,K,ArrowUp,ArrowLeft" data-action="list-keyboard-navigation#focusPrevious">Previous</button>
<button hidden data-controller="hotkey" data-hotkey="j,J,ArrowDown,ArrowRight" data-action="list-keyboard-navigation#focusNext">Next</button>
2024-04-09 16:08:58 +04:00
<%= render "entry_method", type: @account.accountable, text: "Enter account balance manually", icon: "keyboard" %>
<%= render "entry_method", type: @account.accountable, text: "Securely link bank account with data provider (coming soon)", icon: "link-2", disabled: true %>
<%= render "entry_method", type: @account.accountable, text: "Upload spreadsheet (coming soon)", icon: "sheet", disabled: true %>
2024-02-27 12:43:49 -05:00
</div>
<div class="border-t border-alpha-black-25 p-4 text-gray-500 text-sm flex justify-between">
<div class="flex space-x-5">
<div class="flex items-center space-x-2">
2024-06-13 09:16:00 -04:00
<span>Select</span>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-5 h-5 shrink-0 grow-0 items-center justify-center"><%= lucide_icon("corner-down-left", class: "inline w-3 h-3") %></kbd>
2024-02-27 12:43:49 -05:00
</div>
<div class="flex items-center space-x-2">
2024-06-13 09:16:00 -04:00
<span>Navigate</span>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-5 h-5 shrink-0 grow-0 items-center justify-center"><%= lucide_icon("arrow-up", class: "inline w-3 h-3") %></kbd>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-5 h-5 shrink-0 grow-0 items-center justify-center"><%= lucide_icon("arrow-down", class: "inline w-3 h-3") %></kbd>
2024-02-27 12:43:49 -05:00
</div>
2024-02-08 10:46:05 -06:00
</div>
<div class="flex items-center space-x-2">
2024-06-13 09:16:00 -04:00
<button data-action="modal#close">Close</button>
<kbd class="bg-alpha-black-50 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.1)] p-1 rounded-md flex w-8 h-5 shrink-0 grow-0 items-center justify-center text-xs">ESC</kbd>
2024-02-08 10:46:05 -06:00
</div>
</div>
2024-02-27 12:43:49 -05:00
<% else %>
<div class="border-b border-alpha-black-25 p-4 text-gray-800 flex items-center space-x-3">
2024-04-09 16:08:58 +04:00
<%= link_to new_account_path(step: "method", type: params[:type]), class: "flex w-8 h-8 shrink-0 grow-0 items-center justify-center rounded-lg bg-alpha-black-50 focus:outline-gray-300 focus:outline" do %>
<%= lucide_icon("arrow-left", class: "text-gray-500 w-5 h-5") %>
2024-02-27 12:43:49 -05:00
<% end %>
<span>Add <%= @account.accountable.model_name.human.downcase %></span>
2024-02-08 10:46:05 -06:00
</div>
2024-02-27 12:43:49 -05:00
<%= form_with model: @account, url: accounts_path, scope: :account, html: { class: "m-5 mt-1 flex flex-col justify-between grow", data: { turbo: false } } do |f| %>
2024-02-10 16:18:56 -06:00
<div class="space-y-4 grow">
<%= f.hidden_field :accountable_type %>
2024-05-16 21:57:21 +02:00
<%= f.text_field :name, placeholder: t(".name.placeholder"), required: "required", label: t(".name.label"), autofocus: true %>
2024-06-13 14:37:27 -04:00
<%= f.collection_select :institution_id, Current.family.institutions.alphabetically, :id, :name, { include_blank: t(".ungrouped"), label: t(".institution") } %>
2024-06-20 13:32:44 -04:00
<%= render "accounts/accountables/#{permitted_accountable_partial(@account.accountable_type)}", f: f %>
2024-06-13 09:16:00 -04:00
<%= f.money_field :balance_money, label: t(".balance"), required: "required" %>
<div>
<%= check_box_tag :add_start_values, class: "maybe-checkbox maybe-checkbox--light peer mb-1" %>
<%= label_tag :add_start_values, t(".optional_start_balance_message"), class: "pl-1 text-sm text-gray-500" %>
2024-06-13 14:37:27 -04:00
<div class="hidden peer-checked:flex items-center gap-2 mt-3 mb-6">
2024-07-08 14:53:45 +02:00
<div class="w-1/2"><%= f.date_field :start_date, label: t(".start_date"), max: Date.yesterday %></div>
2024-06-13 09:16:00 -04:00
<div class="w-1/2"><%= f.number_field :start_balance, label: t(".start_balance") %></div>
</div>
</div>
2024-02-27 12:43:49 -05:00
</div>
<%= f.submit "Add #{@account.accountable.model_name.human.downcase}" %>
<% end %>
2024-02-08 10:46:05 -06:00
<% end %>
2024-02-09 20:21:19 -05:00
</div>
2024-04-09 16:08:58 +04:00
<% end %>