mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
100 lines
4.6 KiB
Text
100 lines
4.6 KiB
Text
|
|
<div class="container mx-auto px-4 py-8">
|
||
|
|
<div class="max-w-2xl mx-auto">
|
||
|
|
<div class="bg-white shadow rounded-lg p-6">
|
||
|
|
<div class="flex items-center justify-between mb-6">
|
||
|
|
<h1 class="text-2xl font-bold text-gray-900">
|
||
|
|
<%= t('families.edit.title', default: 'Edit Family') %>
|
||
|
|
</h1>
|
||
|
|
<%= link_to family_path(@family),
|
||
|
|
class: "text-gray-600 hover:text-gray-800 font-medium" do %>
|
||
|
|
<%= t('families.edit.back', default: '← Back to Family') %>
|
||
|
|
<% end %>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<%= form_with model: @family, local: true, class: "space-y-6" do |form| %>
|
||
|
|
<% if @family.errors.any? %>
|
||
|
|
<div class="bg-red-50 border border-red-200 rounded-md p-4">
|
||
|
|
<div class="flex">
|
||
|
|
<div class="ml-3">
|
||
|
|
<h3 class="text-sm font-medium text-red-800">
|
||
|
|
<%= t('families.edit.error_title', default: 'There were problems with your submission:') %>
|
||
|
|
</h3>
|
||
|
|
<div class="mt-2 text-sm text-red-700">
|
||
|
|
<ul class="list-disc pl-5 space-y-1">
|
||
|
|
<% @family.errors.full_messages.each do |message| %>
|
||
|
|
<li><%= message %></li>
|
||
|
|
<% end %>
|
||
|
|
</ul>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<% end %>
|
||
|
|
|
||
|
|
<div>
|
||
|
|
<%= form.label :name, t('families.form.name', default: 'Family Name'), class: "block text-sm font-medium text-gray-700 mb-2" %>
|
||
|
|
<%= form.text_field :name,
|
||
|
|
class: "w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
||
|
|
placeholder: t('families.form.name_placeholder', default: 'Enter your family name') %>
|
||
|
|
<p class="mt-1 text-sm text-gray-500">
|
||
|
|
<%= t('families.edit.name_help', default: 'Choose a name that all family members will recognize.') %>
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="bg-gray-50 p-4 rounded-md">
|
||
|
|
<h3 class="text-sm font-medium text-gray-900 mb-2">
|
||
|
|
<%= t('families.edit.family_info', default: 'Family Information') %>
|
||
|
|
</h3>
|
||
|
|
<dl class="grid grid-cols-1 gap-x-4 gap-y-2 sm:grid-cols-2">
|
||
|
|
<div>
|
||
|
|
<dt class="text-sm font-medium text-gray-500">
|
||
|
|
<%= t('families.edit.creator', default: 'Created by') %>
|
||
|
|
</dt>
|
||
|
|
<dd class="text-sm text-gray-900"><%= @family.creator.email %></dd>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<dt class="text-sm font-medium text-gray-500">
|
||
|
|
<%= t('families.edit.created_on', default: 'Created on') %>
|
||
|
|
</dt>
|
||
|
|
<dd class="text-sm text-gray-900"><%= @family.created_at.strftime('%B %d, %Y') %></dd>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<dt class="text-sm font-medium text-gray-500">
|
||
|
|
<%= t('families.edit.members_count', default: 'Members') %>
|
||
|
|
</dt>
|
||
|
|
<dd class="text-sm text-gray-900">
|
||
|
|
<%= pluralize(@family.members.count, 'member') %>
|
||
|
|
</dd>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<dt class="text-sm font-medium text-gray-500">
|
||
|
|
<%= t('families.edit.last_updated', default: 'Last updated') %>
|
||
|
|
</dt>
|
||
|
|
<dd class="text-sm text-gray-900"><%= @family.updated_at.strftime('%B %d, %Y') %></dd>
|
||
|
|
</div>
|
||
|
|
</dl>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="flex items-center justify-between pt-4">
|
||
|
|
<div class="flex space-x-3">
|
||
|
|
<%= form.submit t('families.edit.save_changes', default: 'Save Changes'),
|
||
|
|
class: "bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-md font-medium transition-colors duration-200" %>
|
||
|
|
<%= link_to family_path(@family),
|
||
|
|
class: "bg-gray-300 hover:bg-gray-400 text-gray-700 px-6 py-2 rounded-md font-medium transition-colors duration-200" do %>
|
||
|
|
<%= t('families.edit.cancel', default: 'Cancel') %>
|
||
|
|
<% end %>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<% if policy(@family).destroy? %>
|
||
|
|
<%= link_to family_path(@family),
|
||
|
|
method: :delete,
|
||
|
|
confirm: t('families.edit.delete_confirm', default: 'Are you sure you want to delete this family? This action cannot be undone and will remove all members.'),
|
||
|
|
class: "text-red-600 hover:text-red-800 font-medium" do %>
|
||
|
|
<%= t('families.edit.delete_family', default: 'Delete Family') %>
|
||
|
|
<% end %>
|
||
|
|
<% end %>
|
||
|
|
</div>
|
||
|
|
<% end %>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|