The personal finance app for everyone (by everyone)
Ruby
<div id="lunchflow-providers-panel" class="space-y-4">
<%
lf_link = link_to("Lunch Flow", "https://www.lunchflow.app/?atp=BiDIYS", target: "_blank", rel: "noopener noreferrer", class: "text-link underline")
%>
<%= render "settings/providers/setup_steps",
steps: [
t("settings.providers.lunchflow_panel.step_1_html", link: lf_link),
t("settings.providers.lunchflow_panel.step_2"),
t("settings.providers.lunchflow_panel.step_3")
] %>
<% error_msg = local_assigns[:error_message] || @error_message %>
<% if error_msg.present? %>
<%= render DS::Alert.new(message: error_msg, variant: :error) %>
<% end %>
<%
# Get or initialize a lunchflow_item for this family
lunchflow_item = Current.family.lunchflow_items.first_or_initialize(name: "Lunch Flow Connection")
is_new_record = lunchflow_item.new_record?
%>
<%= styled_form_with model: lunchflow_item,
url: is_new_record ? lunchflow_items_path : lunchflow_item_path(lunchflow_item),
scope: :lunchflow_item,
method: is_new_record ? :post : :patch,
data: { turbo: true },
class: "space-y-3" do |form| %>
<%= form.text_field :api_key,
label: t("settings.providers.lunchflow_panel.api_key_label"),
placeholder: is_new_record ? t("settings.providers.lunchflow_panel.api_key_placeholder_new") : t("settings.providers.lunchflow_panel.api_key_placeholder_update"),
type: :password %>
<%= form.text_field :base_url,
label: t("settings.providers.lunchflow_panel.base_url_label"),
placeholder: t("settings.providers.lunchflow_panel.base_url_placeholder"),
value: lunchflow_item.base_url %>
<%= form.date_field :sync_start_date,
label: t("settings.providers.lunchflow_panel.sync_start_date_label"),
value: lunchflow_item.sync_start_date&.to_date,
max: Date.current,
help_text: t("settings.providers.lunchflow_panel.sync_start_date_help") %>
<div class="flex justify-end">
<%= form.submit is_new_record ? t("settings.providers.lunchflow_panel.save_and_connect") : t("settings.providers.lunchflow_panel.update_connection") %>
</div>
<% end %>
</div>