mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 13:35:21 +02:00
Fix merchant editing (#2349)
This commit is contained in:
parent
0063921de9
commit
9afc50a146
5 changed files with 12 additions and 41 deletions
|
@ -6,6 +6,7 @@
|
|||
<% if family_merchant.errors.any? %>
|
||||
<%= render "shared/form_errors", model: family_merchant %>
|
||||
<% end %>
|
||||
|
||||
<div class="w-fit m-auto mb-4">
|
||||
<%= render partial: "shared/color_avatar", locals: { name: family_merchant.name, color: family_merchant.color } %>
|
||||
</div>
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
</header>
|
||||
|
||||
<div class="bg-container rounded-xl shadow-border-xs p-4">
|
||||
<% if @merchants.any? %>
|
||||
<% if @family_merchants.any? %>
|
||||
<div class="rounded-xl bg-container-inset space-y-1 p-1">
|
||||
<div class="flex items-center gap-1.5 px-4 py-2 text-xs font-medium text-secondary uppercase">
|
||||
<p><%= t(".title") %></p>
|
||||
<span class="text-subdued">·</span>
|
||||
<p><%= @merchants.count %></p>
|
||||
<p><%= @family_merchants.count %></p>
|
||||
</div>
|
||||
|
||||
<div class="bg-container rounded-lg shadow-border-xs">
|
||||
<div class="overflow-hidden rounded-lg">
|
||||
<%= render partial: "family_merchants/family_merchant", collection: @merchants, spacer_template: "shared/ruler" %>
|
||||
<%= render partial: "family_merchants/family_merchant", collection: @family_merchants, spacer_template: "shared/ruler" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%= render DialogComponent.new do |dialog| %>
|
||||
<% dialog.with_header(title: t(".title")) %>
|
||||
<% dialog.with_body do %>
|
||||
<%= render "form", family_merchant: @merchant %>
|
||||
<%= render "form", family_merchant: @family_merchant %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<%# locals: (merchant:) %>
|
||||
|
||||
<div class="flex justify-between items-center p-4 bg-container">
|
||||
<div class="flex w-full items-center gap-2.5">
|
||||
<% if merchant.icon_url %>
|
||||
<div class="w-8 h-8 rounded-full flex justify-center items-center">
|
||||
<%= image_tag merchant.icon_url, class: "w-8 h-8 rounded-full" %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render partial: "shared/color_avatar", locals: { name: merchant.name, color: merchant.color } %>
|
||||
<% end %>
|
||||
|
||||
<p class="text-primary text-sm truncate">
|
||||
<%= merchant.name %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="justify-self-end">
|
||||
<%= render MenuComponent.new do |menu| %>
|
||||
<% menu.with_item(variant: "link", text: t(".edit"), href: edit_merchant_path(merchant), icon: "pencil", data: { turbo_frame: "modal" }) %>
|
||||
<% menu.with_item(
|
||||
variant: "button",
|
||||
text: t(".delete"),
|
||||
href: merchant_path(merchant),
|
||||
icon: "trash-2",
|
||||
method: :delete,
|
||||
confirm: CustomConfirm.for_resource_deletion(merchant.name)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue