Files
Reem-Notas/app/views/admin/configuracoes/edit.html.erb

59 lines
2.6 KiB
Plaintext

<%# app/views/configuracoes/edit.html.erb %>
<div class="max-w-lg mx-auto space-y-6">
<div>
<h1 class="text-2xl font-bold text-white">
<%= @configuracao.icone %> Editar: <%= @configuracao.tipo_label %>
</h1>
<p class="text-gray-400 text-sm mt-0.5">Atualize o valor do pilar de preço</p>
</div>
<%= render 'shared/flash' %>
<%= form_with(model: @configuracao, url: admin_configuracao_path(@configuracao), method: :patch,
class: 'bg-[#1a1a1a] rounded-2xl border border-white/5 p-8 space-y-6') do |f| %>
<% if @configuracao.errors.any? %>
<div class="p-4 bg-red-900/30 border border-red-500/40 rounded-xl">
<ul class="list-disc list-inside space-y-1">
<% @configuracao.errors.full_messages.each do |msg| %>
<li class="text-red-300 text-sm"><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= f.label :valor, 'Valor (R$)', class: 'block text-sm font-medium text-gray-300 mb-1.5' %>
<div class="relative">
<span class="absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 font-medium">R$</span>
<%= f.number_field :valor,
step: 0.01,
min: 0,
class: 'w-full pl-10 pr-4 py-3 bg-[#0a0a0a] border border-white/10 rounded-xl
text-white text-xl font-bold focus:outline-none focus:border-[#f97316]
focus:ring-1 focus:ring-[#f97316] transition-colors',
placeholder: '0.00' %>
</div>
<p class="text-gray-500 text-xs mt-1.5">Valor atual: <%= moeda(@configuracao.valor) %></p>
</div>
<div>
<%= f.label :descricao, 'Descrição (opcional)', class: 'block text-sm font-medium text-gray-300 mb-1.5' %>
<%= f.text_area :descricao, rows: 2,
class: 'w-full px-4 py-3 bg-[#0a0a0a] border border-white/10 rounded-xl text-white
placeholder-gray-600 focus:outline-none focus:border-[#f97316] focus:ring-1
focus:ring-[#f97316] transition-colors resize-none',
placeholder: 'Ex: Entrega padrão para UBS e EMAD' %>
</div>
<div class="flex items-center justify-between pt-2 border-t border-white/5">
<%= link_to 'Cancelar', admin_configuracoes_path,
class: 'px-6 py-3 text-gray-400 hover:text-white border border-white/10
hover:border-white/20 rounded-xl transition-colors' %>
<%= f.submit 'Salvar Preço',
class: 'px-8 py-3 bg-[#f97316] hover:bg-orange-500 text-white font-semibold
rounded-xl transition-colors cursor-pointer min-h-[48px]' %>
</div>
<% end %>
</div>