Membership Fee 6 - UI Components & LiveViews closes #280 #304
1 changed files with 1 additions and 6 deletions
|
|
@ -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
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue
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.