diff --git a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte index 71ba2ee3..4293d8c6 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/ae_idaa_comp__event_obj_qry.svelte @@ -65,21 +65,22 @@ function prevent_default(fn: (event: T) => void) { }; } -function set_sort_mode(mode: string) { - $idaa_loc.recovery_meetings.qry__order_by = mode; - if (mode === 'updated_on') { - $idaa_loc.recovery_meetings.qry__order_by_li = { - priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC', name: 'ASC' - }; - } else if (mode === 'name_asc') { - $idaa_loc.recovery_meetings.qry__order_by_li = { - priority: 'DESC', sort: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' - }; - } else if (mode === 'name_desc') { - $idaa_loc.recovery_meetings.qry__order_by_li = { - priority: 'DESC', sort: 'DESC', name: 'DESC', updated_on: 'DESC', created_on: 'DESC' - }; - } +const sort_modes = [ + { mode: 'updated_on', label: 'Last Updated', icon: 'fa-clock', order_by_li: { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC', name: 'ASC' } }, + { mode: 'name_asc', label: 'Name A→Z', icon: 'fa-sort-alpha-down', order_by_li: { priority: 'DESC', sort: 'DESC', name: 'ASC', updated_on: 'DESC', created_on: 'DESC' } }, + { mode: 'name_desc', label: 'Name Z→A', icon: 'fa-sort-alpha-up-alt', order_by_li: { priority: 'DESC', sort: 'DESC', name: 'DESC', updated_on: 'DESC', created_on: 'DESC' } } +]; + +let sort_cycle_idx = $derived.by(() => { + const idx = sort_modes.findIndex(m => m.mode === $idaa_loc.recovery_meetings.qry__order_by); + return idx >= 0 ? idx : 0; +}); +let current_sort = $derived(sort_modes[sort_cycle_idx]); + +function cycle_sort() { + const next = sort_modes[(sort_cycle_idx + 1) % sort_modes.length]; + $idaa_loc.recovery_meetings.qry__order_by = next.mode; + $idaa_loc.recovery_meetings.qry__order_by_li = next.order_by_li; handle_search_trigger(); } @@ -186,9 +187,29 @@ function set_sort_mode(mode: string) { - +
+ class="border-surface-300-700 flex w-full max-w-2xl flex-row flex-wrap items-center justify-center gap-x-4 gap-y-1 border-b p-1"> + + + {#if $idaa_loc.novi_uuid} + + {/if}
@@ -225,7 +246,7 @@ function set_sort_mode(mode: string) { ['IDAA', 'IDAA', 'Open to IDAA members only'], ['Caduceus', 'Caduceus', 'Open to all healthcare workers including those who do not qualify for IDAA'], ['Family Recovery', 'Family Recovery', 'Open to spouses, parents, and children of medical professionals in recovery'] - ] as [val, label, tip]} + ] as [val, label, tip] (val)} {@const active = val === '' ? !$idaa_loc.recovery_meetings.qry__type : $idaa_loc.recovery_meetings.qry__type === val}
- -
- - +
+ +
+ Sort: + +
- -
- Sort: - {#each [ - ['updated_on', 'Last Updated', 'fa-clock'], - ['name_asc', 'Name A–Z', 'fa-sort-alpha-down'], - ['name_desc', 'Name Z–A', 'fa-sort-alpha-up-alt'] - ] as [mode, label, icon]} - {@const active = $idaa_loc.recovery_meetings.qry__order_by === mode} - - {/each} -
+ +
+ Max results: + + + {$idaa_loc.recovery_meetings.qry__limit} + + +
- -
- Max results: - - - {$idaa_loc.recovery_meetings.qry__limit} - - -
+ + {#if $ae_loc.edit_mode && $ae_loc.trusted_access && (!$idaa_loc.recovery_meetings.qry__hidden || $idaa_loc.recovery_meetings.qry__hidden == 'not_hidden')} + + {:else if $ae_loc.trusted_access && $idaa_loc.recovery_meetings.qry__hidden != 'not_hidden'} + + {/if} - + + {#if $ae_loc.edit_mode && $ae_loc.manager_access && (!$idaa_loc.recovery_meetings.qry__enabled || $idaa_loc.recovery_meetings.qry__enabled == 'enabled')} + + {:else if $ae_loc.edit_mode && $ae_loc.manager_access && $idaa_loc.recovery_meetings.qry__enabled != 'enabled'} + + {/if} - - {#if $ae_loc.edit_mode && $ae_loc.trusted_access && (!$idaa_loc.recovery_meetings.qry__hidden || $idaa_loc.recovery_meetings.qry__hidden == 'not_hidden')} - - {:else if $ae_loc.trusted_access && $idaa_loc.recovery_meetings.qry__hidden != 'not_hidden'} - - {/if} + + {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid} + - {:else if $ae_loc.edit_mode && $ae_loc.manager_access && $idaa_loc.recovery_meetings.qry__enabled != 'enabled'} - - {/if} - - - - {#if $idaa_loc.novi_uuid} - - {/if} - - {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid} - - {/if} + goto( + `/idaa/recovery_meetings/${results.event_id}` + ); + } + }) + .catch((error) => { + console.error('Error creating event:', error); + alert('Failed to create new event.'); + }); + }} + class="novi_btn btn-tertiary btn btn-sm preset-tonal-warning + preset-outlined-warning-200-800 hover:preset-filled-warning-200-800 text-xs transition" + disabled={!$ae_loc.authenticated_access}> + Create New Meeting + + {/if} - {#if $ae_loc.edit_mode && $ae_loc.trusted_access} - - {/if} - -
+ + {#if $ae_loc.edit_mode && $ae_loc.trusted_access} + + {/if} +
+