mirror of
https://github.com/we-promise/sure.git
synced 2026-06-05 18:59:04 +00:00
* First pass of Akahu * fix up sync all * conflicts * fix db migration issue? - fix auto selection of akahu account type * Address Akahu PR feedback * Complete provider metadata * Fix PR 1921 CI tests * PR feedback * PR feedback * post merge --------- Co-authored-by: failing <failing@users.noreply.github.com> Co-authored-by: Juan José Mata <jjmata@jjmata.com> Co-authored-by: sure-admin <sure-admin@splashblot.com>
136 lines
5.9 KiB
Plaintext
136 lines
5.9 KiB
Plaintext
<div id="akahu-providers-panel" class="space-y-4">
|
|
<% active_items = local_assigns[:akahu_items] || @akahu_items || Current.family.akahu_items.active.ordered %>
|
|
|
|
<%= render "settings/providers/setup_steps",
|
|
steps: [
|
|
t("settings.providers.akahu_panel.step_1_html", link: link_to(t("providers.akahu.name"), "https://my.akahu.nz/developers", target: "_blank", rel: "noopener noreferrer", class: "text-primary font-medium underline")),
|
|
t("settings.providers.akahu_panel.step_2"),
|
|
t("settings.providers.akahu_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 %>
|
|
|
|
<% if active_items.any? %>
|
|
<div class="space-y-3">
|
|
<% active_items.each do |item| %>
|
|
<%= render DS::Disclosure.new(variant: :card) do |disclosure| %>
|
|
<% disclosure.with_summary_content do %>
|
|
<div class="flex items-center justify-between gap-2 w-full">
|
|
<div class="flex items-center gap-3">
|
|
<div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">
|
|
<p class="text-primary text-xs font-medium"><%= item.name.to_s.first.to_s.upcase %></p>
|
|
</div>
|
|
<div>
|
|
<p class="font-medium text-primary"><%= item.name %></p>
|
|
<p class="text-xs text-secondary"><%= item.sync_status_summary %></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="mt-4 space-y-4">
|
|
<div class="flex items-center gap-2">
|
|
<%= render DS::Button.new(
|
|
text: t("akahu_items.provider_panel.sync"),
|
|
icon: "refresh-cw",
|
|
variant: :outline,
|
|
size: :sm,
|
|
href: sync_akahu_item_path(item),
|
|
method: :post,
|
|
disabled: item.syncing?
|
|
) %>
|
|
<%= render DS::Button.new(
|
|
text: t("akahu_items.provider_panel.disconnect"),
|
|
icon: "trash-2",
|
|
variant: :outline_destructive,
|
|
size: :sm,
|
|
href: akahu_item_path(item),
|
|
method: :delete,
|
|
data: { turbo_confirm: t("akahu_items.provider_panel.disconnect_confirm", name: item.name) }
|
|
) %>
|
|
</div>
|
|
|
|
<%= styled_form_with model: item,
|
|
url: akahu_item_path(item),
|
|
scope: :akahu_item,
|
|
method: :patch,
|
|
data: { turbo: true },
|
|
class: "space-y-3" do |form| %>
|
|
<%= form.text_field :name,
|
|
label: t("akahu_items.provider_panel.connection_name_label"),
|
|
placeholder: t("akahu_items.provider_panel.connection_name_placeholder") %>
|
|
|
|
<%= form.text_field :app_token,
|
|
label: t("akahu_items.provider_panel.app_token_label"),
|
|
placeholder: t("akahu_items.provider_panel.keep_app_token_placeholder"),
|
|
type: :password,
|
|
value: nil %>
|
|
|
|
<%= form.text_field :user_token,
|
|
label: t("akahu_items.provider_panel.user_token_label"),
|
|
placeholder: t("akahu_items.provider_panel.keep_user_token_placeholder"),
|
|
type: :password,
|
|
value: nil %>
|
|
|
|
<div class="flex flex-wrap justify-end gap-2">
|
|
<%= render DS::Link.new(
|
|
text: t("akahu_items.provider_panel.setup_accounts"),
|
|
icon: "settings",
|
|
variant: "secondary",
|
|
href: setup_accounts_akahu_item_path(item),
|
|
frame: :modal
|
|
) %>
|
|
<%= render DS::Button.new(
|
|
text: t("akahu_items.provider_panel.update_connection"),
|
|
type: "submit"
|
|
) %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% akahu_item = Current.family.akahu_items.build(name: t("akahu_items.provider_panel.default_connection_name")) %>
|
|
<% if active_items.any? %>
|
|
<h3 class="flex items-center gap-2 text-sm font-medium text-primary mt-4">
|
|
<%= icon "plus", size: "sm" %>
|
|
<%= t("akahu_items.provider_panel.add_connection") %>
|
|
</h3>
|
|
<% end %>
|
|
|
|
<%= styled_form_with model: akahu_item,
|
|
url: akahu_items_path,
|
|
scope: :akahu_item,
|
|
method: :post,
|
|
data: { turbo: true },
|
|
class: "space-y-3" do |form| %>
|
|
<%= form.text_field :name,
|
|
label: t("akahu_items.provider_panel.connection_name_label"),
|
|
placeholder: t("akahu_items.provider_panel.connection_name_placeholder") %>
|
|
|
|
<%= form.text_field :app_token,
|
|
label: t("akahu_items.provider_panel.app_token_label"),
|
|
placeholder: t("akahu_items.provider_panel.app_token_placeholder"),
|
|
type: :password,
|
|
value: nil %>
|
|
|
|
<%= form.text_field :user_token,
|
|
label: t("akahu_items.provider_panel.user_token_label"),
|
|
placeholder: t("akahu_items.provider_panel.user_token_placeholder"),
|
|
type: :password,
|
|
value: nil %>
|
|
|
|
<div class="flex justify-end">
|
|
<%= render DS::Button.new(
|
|
text: t("akahu_items.provider_panel.add_connection"),
|
|
type: "submit"
|
|
) %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|