mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
* FIX merchant regression * Add logo support for family merchants * Update family_merchant.rb
37 lines
1.7 KiB
Plaintext
37 lines
1.7 KiB
Plaintext
<%# locals: (family_merchant:) %>
|
|
|
|
<div data-controller="color-avatar">
|
|
<%= styled_form_with model: family_merchant, url: family_merchant.persisted? ? family_merchant_path(family_merchant) : family_merchants_path, class: "space-y-4" do |f| %>
|
|
<section class="space-y-4">
|
|
<% 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>
|
|
<div class="flex gap-2 items-center justify-center">
|
|
<% FamilyMerchant::COLORS.each do |color| %>
|
|
<label class="relative">
|
|
<%= f.radio_button :color, color, class: "sr-only peer", data: { action: "change->color-avatar#handleColorChange" } %>
|
|
<div class="w-6 h-6 rounded-full cursor-pointer peer-checked:ring-2 peer-checked:ring-offset-2 peer-checked:ring-blue-500" style="background-color: <%= color %>"></div>
|
|
</label>
|
|
<% end %>
|
|
</div>
|
|
<div class="relative flex items-center border border-secondary rounded-lg text-subdued">
|
|
<%= f.text_field :name, placeholder: t(".name_placeholder"), autofocus: true, required: true, data: { color_avatar_target: "name" } %>
|
|
</div>
|
|
<% if family_merchant.is_a?(FamilyMerchant) %>
|
|
<div class="relative flex items-center border border-secondary rounded-lg text-subdued">
|
|
<%= f.text_field :website_url, placeholder: t(".website_placeholder") %>
|
|
</div>
|
|
<p class="text-xs text-subdued"><%= t(".website_hint") %></p>
|
|
<% end %>
|
|
</section>
|
|
|
|
<section>
|
|
<%= f.submit %>
|
|
</section>
|
|
<% end %>
|
|
</div>
|