mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
168 lines
7.5 KiB
Text
168 lines
7.5 KiB
Text
<div class="container mx-auto px-4 py-8">
|
|
<div class="max-w-4xl mx-auto">
|
|
<!-- Header -->
|
|
<div class="bg-white dark:bg-gray-800 shadow dark:shadow-gray-700 rounded-lg p-6 mb-6">
|
|
<div class="flex items-center justify-between">
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-gray-900 dark:text-gray-100">
|
|
Family Members
|
|
</h1>
|
|
<p class="text-gray-600 dark:text-gray-400 mt-1">
|
|
Manage members of <%= @family.name %>
|
|
</p>
|
|
</div>
|
|
|
|
<%= link_to family_path(@family),
|
|
class: "bg-gray-200 hover:bg-gray-300 dark:bg-gray-600 dark:hover:bg-gray-500 text-gray-700 dark:text-gray-200 px-4 py-2 rounded-md font-medium transition-colors duration-200" do %>
|
|
← Back to Family
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Members List -->
|
|
<div class="bg-white dark:bg-gray-800 shadow dark:shadow-gray-700 rounded-lg overflow-hidden">
|
|
<div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700">
|
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
All Members (<%= @members.count %>)
|
|
</h2>
|
|
</div>
|
|
|
|
<div class="divide-y divide-gray-200 dark:divide-gray-700">
|
|
<% @members.each do |member| %>
|
|
<div class="px-6 py-4 hover:bg-gray-50 dark:hover:bg-gray-700">
|
|
<div class="flex items-center justify-between">
|
|
<!-- Member Info -->
|
|
<div class="flex items-center space-x-4">
|
|
<div class="flex-shrink-0">
|
|
<div class="h-10 w-10 rounded-full bg-gray-300 dark:bg-gray-600 flex items-center justify-center">
|
|
<span class="text-sm font-medium text-gray-700 dark:text-gray-200">
|
|
<%= member.email.first.upcase %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="min-w-0 flex-1">
|
|
<div class="flex items-center space-x-2">
|
|
<p class="text-sm font-medium text-gray-900 dark:text-gray-100 truncate">
|
|
<%= member.email %>
|
|
</p>
|
|
|
|
<% if member.family_membership.role == 'owner' %>
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 dark:bg-yellow-900 text-yellow-800 dark:text-yellow-200">
|
|
Owner
|
|
</span>
|
|
<% else %>
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200">
|
|
<%= member.family_membership.role.humanize %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<% if member == current_user %>
|
|
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200">
|
|
You
|
|
</span>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="flex items-center space-x-4 mt-1">
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
Joined <%= member.family_membership.created_at.strftime('%B %d, %Y') %>
|
|
</p>
|
|
|
|
<% if member.family_membership.role == 'owner' %>
|
|
<p class="text-sm text-gray-500 dark:text-gray-400">
|
|
Created this family
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions -->
|
|
<div class="flex items-center space-x-3">
|
|
<%= link_to family_member_path(@family, member.family_membership),
|
|
class: "text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300 text-sm font-medium" do %>
|
|
View
|
|
<% end %>
|
|
|
|
<% if policy(member.family_membership).destroy? %>
|
|
<% if !member.family_membership.owner? %>
|
|
<%= link_to family_member_path(@family, member.family_membership),
|
|
method: :delete,
|
|
confirm: "Are you sure you want to remove #{member.email} from the family?",
|
|
class: "text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300 text-sm font-medium" do %>
|
|
Remove
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Family Statistics -->
|
|
<div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-6">
|
|
<div class="bg-white dark:bg-gray-800 shadow dark:shadow-gray-700 rounded-lg p-6">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-8 w-8 text-blue-600 dark:text-blue-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
|
|
</svg>
|
|
</div>
|
|
<div class="ml-5 w-0 flex-1">
|
|
<dl>
|
|
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400 truncate">
|
|
Total Members
|
|
</dt>
|
|
<dd class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
<%= @members.count %>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white dark:bg-gray-800 shadow dark:shadow-gray-700 rounded-lg p-6">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-8 w-8 text-green-600 dark:text-green-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
</svg>
|
|
</div>
|
|
<div class="ml-5 w-0 flex-1">
|
|
<dl>
|
|
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400 truncate">
|
|
Active Members
|
|
</dt>
|
|
<dd class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
<%= @members.count %>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white dark:bg-gray-800 shadow dark:shadow-gray-700 rounded-lg p-6">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-8 w-8 text-yellow-600 dark:text-yellow-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
</svg>
|
|
</div>
|
|
<div class="ml-5 w-0 flex-1">
|
|
<dl>
|
|
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400 truncate">
|
|
Family Age
|
|
</dt>
|
|
<dd class="text-lg font-medium text-gray-900 dark:text-gray-100">
|
|
<%= time_ago_in_words(@family.created_at) %>
|
|
</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|