implantação da fase 2 e 3
This commit is contained in:
58
app/views/configuracoes/edit.html.erb
Normal file
58
app/views/configuracoes/edit.html.erb
Normal file
@@ -0,0 +1,58 @@
|
||||
<%# 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: 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', 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>
|
||||
64
app/views/configuracoes/index.html.erb
Normal file
64
app/views/configuracoes/index.html.erb
Normal file
@@ -0,0 +1,64 @@
|
||||
<%# app/views/configuracoes/index.html.erb %>
|
||||
<div class="space-y-6">
|
||||
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-white">Configurações</h1>
|
||||
<p class="text-gray-400 text-sm mt-0.5">Pilares de preço e parâmetros do sistema</p>
|
||||
</div>
|
||||
|
||||
<%= render 'shared/flash' %>
|
||||
|
||||
<%# Pilares de preço %>
|
||||
<div>
|
||||
<h2 class="text-lg font-semibold text-white mb-4">💰 Pilares de Preço</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<% @configuracoes.each do |cfg| %>
|
||||
<div class="bg-[#1a1a1a] rounded-2xl border border-white/5 p-6 group relative">
|
||||
<div class="flex items-start justify-between mb-4">
|
||||
<div class="text-3xl"><%= cfg.icone %></div>
|
||||
<% if policy(cfg).edit? %>
|
||||
<%= link_to edit_configuracao_path(cfg),
|
||||
class: 'opacity-0 group-hover:opacity-100 transition-opacity p-1.5
|
||||
text-gray-500 hover:text-white hover:bg-white/10 rounded-lg' do %>
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
|
||||
</svg>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<p class="text-gray-400 text-sm mb-1"><%= cfg.tipo_label %></p>
|
||||
<p class="text-3xl font-bold text-white"><%= moeda(cfg.valor) %></p>
|
||||
<% if cfg.descricao.present? %>
|
||||
<p class="text-gray-500 text-xs mt-2"><%= cfg.descricao %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%# Informações do banco externo %>
|
||||
<div class="bg-[#1a1a1a] rounded-2xl border border-white/5 p-6">
|
||||
<h2 class="text-lg font-semibold text-white mb-4">🗄️ Banco de Dados Externo</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||||
<div class="p-4 bg-[#0a0a0a] rounded-xl border border-white/5">
|
||||
<p class="text-gray-400 text-xs mb-1">Tabela monitorada</p>
|
||||
<p class="text-white font-mono text-sm">db_reem_simplerout_2026</p>
|
||||
</div>
|
||||
<div class="p-4 bg-[#0a0a0a] rounded-xl border border-white/5">
|
||||
<p class="text-gray-400 text-xs mb-1">Account ID</p>
|
||||
<p class="text-white font-mono text-sm">95907 (Gade Hospitalar)</p>
|
||||
</div>
|
||||
<div class="p-4 bg-[#0a0a0a] rounded-xl border border-white/5">
|
||||
<p class="text-gray-400 text-xs mb-1">Atualização</p>
|
||||
<p class="text-white font-mono text-sm">A cada 1 hora</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-yellow-500/80 text-xs mt-4 flex items-center gap-1.5">
|
||||
<svg class="w-3.5 h-3.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
|
||||
</svg>
|
||||
Somente leitura — nunca alterar, deletar ou truncar esta tabela.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user