Bug fixes for enable related fields.

This commit is contained in:
Scott Idem
2024-11-19 16:53:24 -05:00
parent fc8ee53724
commit fea392eff7
4 changed files with 132 additions and 52 deletions

View File

@@ -250,7 +250,10 @@ async function handle_submit_form(event: any) {
let event_do: key_val = {}; // Data out for API object
event_do['account_id_random'] = $ae_loc.account_id;
if (!$idaa_slct.event_id) {
event_do['account_id_random'] = $ae_loc.account_id;
event_do['enable'] = true;
}
event_do['name'] = event_meeting_fd.name;
@@ -415,8 +418,10 @@ async function handle_submit_form(event: any) {
} else {
event_do['group'] = null;
}
if (event_meeting_fd['enable']) {
event_do['enable'] = !!event_meeting_fd.enable;
// NOTE: We only want to set enable value if the input is defined.
if (typeof event_meeting_fd.enable !== 'undefined') {
event_do.enable = event_meeting_fd.enable;
}
// Check if the notes_new_html exists and is a string
@@ -1126,7 +1131,7 @@ async function handle_delete_event_obj(
{#if $ae_loc.trusted_access}
<button
type="button"
class="btn btn-sm variant-soft-secondary float-right"
class="btn btn-sm variant-soft-warning float-right"
on:click={() => {
$idaa_loc.recovery_meetings.show__admin_options = !$idaa_loc.recovery_meetings.show__admin_options;
}}
@@ -1135,10 +1140,11 @@ async function handle_delete_event_obj(
{$idaa_loc.recovery_meetings.show__admin_options ? 'Hide' : 'Show'} Admin
</button>
<!-- BEGIN: section event__admin_options -->
<section
class="ae_section event__admin_options border border-gray-200 rounded p-2 space-y-2"
class="ae_section event__admin_options border border-gray-200 rounded p-2 space-y-2 bg-red-100"
class:hidden={!$idaa_loc.recovery_meetings.show__admin_options}
> <!-- BEGIN: section event__admin_options -->
>
<h3 class="h3">
Admin Options
@@ -1147,42 +1153,98 @@ async function handle_delete_event_obj(
<span
class="flex flex-row flex-wrap items-center justify-between"
>
<label>Hide
<input
type="checkbox"
name="hide"
id="hide"
bind:checked={$idaa_slct.event_obj.hide}
class="checkbox"
>
</label>
<span
class="flex flex-row flex-wrap gap-2 items-center justify-evenly grow"
>
<fieldset class="flex flex-row gap-1 items-center justify-center">
<legend class="legend text-sm font-semibold">Hide</legend>
<div>
<input
type="radio"
id="hide_yes"
name="hide"
value={true}
bind:group={$idaa_slct.event_obj.hide}
class="radio"
>
<label for="hide_yes">Yes</label>
</div>
<div>
<input
type="radio"
id="hide_no"
name="hide"
value={false}
bind:group={$idaa_slct.event_obj.hide}
class="radio"
>
<label for="hide_no">No</label>
</div>
</fieldset>
<label>Priority
<input
type="checkbox"
name="priority"
id="priority"
bind:checked={$idaa_slct.event_obj.priority}
class="checkbox"
>
</label>
<fieldset class="flex flex-row gap-2">
<legend class="legend text-sm font-semibold">Priority</legend>
<div>
<input
type="radio"
id="priority_yes"
name="priority"
value={true}
bind:group={$idaa_slct.event_obj.priority}
class="radio"
>
<label for="priority_yes">Yes</label>
</div>
<div>
<input
type="radio"
id="priority_no"
name="priority"
value={false}
bind:group={$idaa_slct.event_obj.priority}
class="radio"
>
<label for="priority_no">No</label>
</div>
</fieldset>
</span>
<label>Sort <input type="number" name="sort" value={$lq__event_obj?.sort} class="input w-24" /></label>
<span class="flex flex-row flex-wrap gap-1 items-center justify-evenly grow">
<label class="legend text-sm font-semibold">Sort <input type="number" name="sort" value={$idaa_slct.event_obj.sort} class="input w-24" /></label>
<label>Group <input type="text" name="group" value={$lq__event_obj?.group ? $lq__event_obj?.group : ''} max="100" class="input w-40" /></label>
<label class="legend text-sm font-semibold">Group <input type="text" name="group" value={$idaa_slct.event_obj.group ?? ''} max="100" class="input w-40" /></label>
</span>
{#if $ae_loc.administrator_access}
<label>Enable
<input
type="checkbox"
name="enable"
id="enable"
bind:checked={$idaa_slct.event_obj.enable}
class="checkbox"
>
</label>
<span class="flex flex-row flex-wrap gap-1 items-center justify-evenly grow">
<fieldset class="flex flex-row gap-2">
<legend class="legend text-sm font-semibold">Enable</legend>
<div>
<input
type="radio"
id="enable_yes"
name="enable"
value={true}
bind:group={$idaa_slct.event_obj.enable}
class="radio"
>
<label for="enable_yes">Yes</label>
</div>
<div>
<input
type="radio"
id="enable_no"
name="enable"
value={false}
bind:group={$idaa_slct.event_obj.enable}
class="radio"
>
<label for="enable_no">No</label>
</div>
</fieldset>
</span>
{:else}
<input type="hidden" name="enable" value={$lq__event_obj?.enable} />
<input type="hidden" name="enable" value={$idaa_slct.event_obj.enable} />
{/if}
</span>