66 lines
3.4 KiB
Text
66 lines
3.4 KiB
Text
<%= form_with(model: member, class: "space-y-8") do |form| %>
|
|
<% if member.errors.any? %>
|
|
<div id="error_explanation" class="bg-red-50 border border-red-200 text-red-600 px-4 py-3 rounded-lg">
|
|
<div class="flex items-center mb-2">
|
|
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<h3 class="text-sm font-medium"><%= pluralize(member.errors.count, "error") %> prohibited this member from being saved:</h3>
|
|
</div>
|
|
<ul class="list-disc list-inside text-sm space-y-1">
|
|
<% member.errors.each do |error| %>
|
|
<li><%= error.full_message %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
|
|
<!-- Basic Information -->
|
|
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-6">Basic Information</h3>
|
|
|
|
<div class="grid grid-cols-1 gap-6">
|
|
<div>
|
|
<%= form.label :name, class: "block text-sm font-medium text-gray-700 mb-2" %>
|
|
<%= form.text_field :name,
|
|
class: "block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",
|
|
placeholder: "Enter member name..." %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Budget Settings -->
|
|
<div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-6">Budget Role</h3>
|
|
|
|
<div class="flex items-center justify-between">
|
|
<div class="flex-1">
|
|
<%= form.label :pays, "Contributing Member", class: "block text-sm font-medium text-gray-700" %>
|
|
<p class="text-sm text-gray-500 mt-1">Whether this member contributes financially to the household budget</p>
|
|
</div>
|
|
<div class="ml-6">
|
|
<%= form.check_box :pays, class: "toggle-checkbox sr-only" %>
|
|
<label for="member_pays" class="toggle-label relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus-within:outline-none focus-within:ring-2 focus-within:ring-blue-500 focus-within:ring-offset-2 bg-gray-200">
|
|
<span class="toggle-switch pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out translate-x-0"></span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Form Actions -->
|
|
<div class="flex justify-end space-x-3 pt-6 border-t border-gray-200">
|
|
<%= link_to members_path, class: "inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" do %>
|
|
Cancel
|
|
<% end %>
|
|
<%= form.submit class: "inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 cursor-pointer" %>
|
|
</div>
|
|
|
|
<style>
|
|
.toggle-checkbox:checked + .toggle-label {
|
|
background-color: #3B82F6;
|
|
}
|
|
.toggle-checkbox:checked + .toggle-label .toggle-switch {
|
|
transform: translateX(1.25rem);
|
|
}
|
|
</style>
|
|
<% end %>
|