Membership Fee 6 - UI Components & LiveViews closes #280 #304

Open
moritz wants to merge 65 commits from feature/280_membership_fee_ui into main
Showing only changes of commit 0ab6a75377 - Show all commits

View file

@ -46,9 +46,6 @@ defmodule MvWeb.MembershipFeeTypeLive.Form do
label={gettext("Amount")} label={gettext("Amount")}
step="0.01" step="0.01"
min="0" min="0"
pattern="[0-9]+(\.[0-9]{1,2})?"
phx-debounce="blur"
oninput="this.setCustomValidity(''); if (!this.validity.valid) { this.setCustomValidity('Please enter a valid number'); }"
required required
moritz marked this conversation as resolved

Interval is neccessary to create a fee type, but it is not marked as required. So when I leave it out there is no error message but my fee type is not created.

Interval is neccessary to create a fee type, but it is not marked as required. So when I leave it out there is no error message but my fee type is not created.
/> />
@ -210,9 +207,6 @@ defmodule MvWeb.MembershipFeeTypeLive.Form do
@impl true @impl true
def handle_event("validate", %{"membership_fee_type" => params}, socket) do def handle_event("validate", %{"membership_fee_type" => params}, socket) do
# Validate amount format if present
params = validate_amount_format(params)
# Merge with existing form values to preserve unchanged fields # Merge with existing form values to preserve unchanged fields
# Extract values directly from form fields to get current state # Extract values directly from form fields to get current state
existing_values = get_existing_form_values(socket.assigns.form) existing_values = get_existing_form_values(socket.assigns.form)
@ -231,6 +225,7 @@ defmodule MvWeb.MembershipFeeTypeLive.Form do
merged_params merged_params
end end
# Let Ash handle validation automatically - it will validate Decimal format
validated_form = AshPhoenix.Form.validate(socket.assigns.form, merged_params) validated_form = AshPhoenix.Form.validate(socket.assigns.form, merged_params)
# Check if amount changed on edit # Check if amount changed on edit