budget/app/views/incomes/_income.html.erb

49 lines
2.8 KiB
Text

<div id="<%= dom_id income %>" class="bg-white rounded-lg shadow hover:shadow-md transition-shadow">
<div class="p-6">
<div class="flex justify-between items-start mb-4">
<h3 class="text-lg font-semibold text-gray-900"><%= income.description %></h3>
<% if income.included %>
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">included</span>
<% else %>
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-800">excluded</span>
<% end %>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4 mb-6">
<div class="flex items-center">
<div class="h-10 w-10 rounded-full bg-gradient-to-r from-blue-500 to-purple-600 flex items-center justify-center">
<span class="text-white text-sm font-medium"><%= income.member.name.first.upcase %></span>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-900"><%= income.member.name %></p>
<p class="text-xs text-gray-500">Member</p>
</div>
</div>
<div class="flex items-center justify-end sm:justify-start">
<div class="text-right sm:text-left">
<p class="text-2xl font-bold text-gray-900 font-mono"><%= number_to_currency(income.amount) %></p>
<p class="text-xs text-gray-500">Amount</p>
</div>
</div>
</div>
<% if action_name != "show" %>
<div class="flex gap-2 pt-4 border-t border-gray-200">
<%= link_to income, class: "flex-1 inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-blue-600 bg-blue-50 hover:bg-blue-100 rounded-md transition-colors" do %>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
</svg>
View
<% end %>
<%= link_to edit_income_path(income), class: "flex-1 inline-flex items-center justify-center px-4 py-2 text-sm font-medium text-indigo-600 bg-indigo-50 hover:bg-indigo-100 rounded-md transition-colors" do %>
<svg class="w-4 h-4 mr-2" 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>
Edit
<% end %>
</div>
<% end %>
</div>
</div>