+ {#if form?.errors} + {#each form?.errors as error (error.id)} +

+ {$t(error.field) + ': ' + $t(error.key)} +

+ {/each} + {/if} + {#if activeSection === 'users'}

{$t('users')}

@@ -139,10 +155,38 @@ {$t('edit')} - +
{ + return async ({ result }) => { + if (result.type === 'success' || result.type === 'redirect') { + await applyAction(result); + } + }; + }} + on:submit|preventDefault={(/** @type {SubmitEvent} */ e) => { + if ( + !confirm( + $t('dialog.user_deletion', { + values: { + firstname: user.first_name || '', + lastname: user.last_name || '' + } + }) + ) + ) { + e.preventDefault(); // Cancel form submission if user declines + } + }} + > + + + +
@@ -152,7 +196,7 @@

{$t('subscription.subscriptions')}

{#if user.role_id == 8} - @@ -211,10 +255,42 @@ {$t('edit')} {#if !users.some(/** @param{App.Locals['user']} user */ (user) => user.membership?.subscription_model?.id === subscription.id)} - +
{ + return async ({ result }) => { + if (result.type === 'success' || result.type === 'redirect') { + await applyAction(result); + } else { + document + .querySelector('.accordion-content') + ?.scrollTo({ top: 0, behavior: 'smooth' }); + await applyAction(result); + } + }; + }} + on:submit|preventDefault={(/** @type {SubmitEvent} */ e) => { + if ( + !confirm( + $t('dialog.subscription_deletion', { + values: { + name: subscription.name || '' + } + }) + ) + ) { + e.preventDefault(); // Cancel form submission if user declines + } + }} + > + + + +
{/if}
{/if} @@ -252,26 +328,26 @@ -{#if showModal} +{#if showUserModal} - {#if selectedUser} - - {:else if selectedSubscription} - - {/if} + + +{:else if showSubscriptionModal} + + {/if}