Better permissions. Ability to sort the meeting results. Other clean up.

This commit is contained in:
Scott Idem
2024-11-12 13:15:19 -05:00
parent 5d8a3a782e
commit 1e1a4f1016
4 changed files with 62 additions and 16 deletions

View File

@@ -62,6 +62,7 @@ let idaa_local_data_struct: key_val = {
qry__enabled: 'enabled', // all, disabled, enabled
qry__hidden: 'not_hidden', // all, hidden, not_hidden
qry__limit: 150,
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'},
qry__offset: 0,
qry__fulltext_str: null,

View File

@@ -885,7 +885,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
<fieldset class="flex_row flex_gap_md flex_justify_around">
<label>Timezone
{#if $ae_loc?.lu_time_zone_list && $ae_loc?.lu_time_zone_list.length > 0}
<select name="timezone" required class="select w-40">
<select name="timezone" required class="select w-56">
{#each $ae_loc?.lu_time_zone_list as lu_timezone}
<option value="{lu_timezone.name}" selected={((($lq__event_obj?.timezone && lu_timezone.name == $lq__event_obj?.timezone) || lu_timezone.name == $ae_loc?.current_timezone) ? 'selected' : '')}>{lu_timezone.name}</option>
{/each}

View File

@@ -41,6 +41,7 @@ onMount(() => {
class="container recovery_meeting event_obj border border-1 rounded p-2 mb-2"
class:dim={idaa_event_obj?.hide}
class:bg-warning-100={!idaa_event_obj?.enable}
class:text-warning-900={!idaa_event_obj?.enable}
>
<header class="ae_header">
@@ -63,7 +64,7 @@ onMount(() => {
<span class="badge badge-warning"><span class="fas fa-exclamation-triangle m-1"></span> Hidden</span>
{/if}
{#if $ae_loc.administrator_access && !idaa_event_obj?.enable}
<span class="badge badge-warning"><span class="fas fa-exclamation-triangle m-1"></span> Not enabled</span>
<span class="badge badge-warning variant-glass-warning"><span class="fas fa-exclamation-triangle m-1"></span> Not enabled</span>
{/if}
</h3>
</header>
@@ -251,7 +252,7 @@ onMount(() => {
{#if $ae_loc.administrator_access}
<section class="ae_section ae_footer ae_meta event__meta">
<section class="ae_section ae_footer ae_meta event__meta text-sm text-gray-500">
<!-- {#if idaa_event_obj.location_address_json}
<span
class="event__location_address_json"

View File

@@ -58,6 +58,7 @@ async function handle_qry__event(
and_physical = $idaa_loc.recovery_meetings.qry__physical,
and_virtual = $idaa_loc.recovery_meetings.qry__virtual,
and_type = $idaa_loc.recovery_meetings.qry__type,
order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li,
search_delay = 0,
max_tries = 5,
params = {
@@ -72,6 +73,7 @@ async function handle_qry__event(
and_physical?: null|boolean,
and_virtual?: null|boolean,
and_type?: null|string,
order_by_li?: key_val,
search_delay?: number, // In milliseconds
max_tries?: number,
params?: key_val,
@@ -128,7 +130,7 @@ async function handle_qry__event(
api_cfg: $ae_api,
for_obj_type: 'account',
for_obj_id: $ae_loc.account_id,
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'},
order_by_li: order_by_li,
qry_conference: false,
qry_physical: and_physical,
qry_virtual: and_virtual,
@@ -187,7 +189,6 @@ async function handle_qry__event(
<!-- <div class="ae_info recovery_meetings_info note">
{@html $idaa_loc.recovery_meetings.ds.recovery_meetings_info}
</div> -->
<!-- <div class="note">Note: The state/province filter only includes states and provinces that are set for at least one meeting. Many virtual/online meetings do not have a state/province set. Some in-person meetings also do not have a state/province set. Please ask one of the meeting contacts to update this information if it is missing.</div> -->
<form
on:submit|preventDefault={() => {
@@ -205,10 +206,10 @@ async function handle_qry__event(
bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str}
>
</div> -->
<div class="ae_group flex flex-row w-full items-center justify-center">
<div class="ae_group flex flex-row gap-2 w-full items-center justify-center">
<button
type="button"
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition-all mx-1"
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition-all"
on:click={() => {
$idaa_loc.recovery_meetings.qry__fulltext_str = '';
ae_trigger = 'load__event_obj_li';
@@ -222,16 +223,17 @@ async function handle_qry__event(
</button>
<input
type="search"
placeholder="Search (day of week, location, chair, etc.)"
placeholder="Search: day of week, location, contacts, etc."
id="meeting_qry__fulltext_str"
name="qry__fulltext_str"
bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str}
style="width: 50%;"
class="bs-input input text-1xl hover:text-2xl font-bold font-mono w-80 transition-all mx-1"
class="bs-input input text-sm hover:text-2xl font-bold font-mono w-80 transition-all"
>
<button
type="submit"
class="btn btn-lg variant-ghost-success hover:variant-filled-success text-2xl font-bold w-48 transition-all mx-1"
class="btn btn-lg variant-ghost-success hover:variant-filled-success text-2xl font-bold w-48 transition-all"
title="Search for meetings by day of week, location, contacts, etc."
>
<!-- <span class="fas fa-search m-1"></span> -->
{#if $idaa_sess.recovery_meetings.qry__status == 'loading'}
@@ -285,6 +287,7 @@ async function handle_qry__event(
value=""
bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}}
class="radio"
title="Show all meeting types"
>
</label>
@@ -295,6 +298,7 @@ async function handle_qry__event(
value="IDAA"
bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}}
class="radio"
title="Open to IDAA members only"
>
</label>
@@ -305,6 +309,7 @@ async function handle_qry__event(
value="Caduceus"
bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}}
class="radio"
title="Open to all healthcare workers including those who do not qualify for IDAA"
>
</label>
@@ -315,6 +320,7 @@ async function handle_qry__event(
value="Family Recovery"
bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}}
class="radio"
title="Open to spouses, parents, and children of medical professionals who have substance use disorder."
>
</label>
@@ -349,7 +355,7 @@ async function handle_qry__event(
<div>Error: {error.message}</div>
{/await} -->
<div class="ae_group ae_row flex flex-row flex-wrap gap-1 w-full items-center justify-center">
<div class="ae_group ae_row flex flex-row flex-wrap gap-2 w-full items-center justify-center">
<!-- Max events select options -->
<span
@@ -358,12 +364,13 @@ async function handle_qry__event(
<label
class="text-sm w-32 text-right"
for="qry_limit__events">
Max events:
Max results:
</label>
<select
id="qry_limit__events"
bind:value={$idaa_loc.recovery_meetings.qry__limit}
on:change={() => {
ae_trigger = 'load__event_obj_li';
// search__event_presenter({
// api_cfg: $ae_api,
// event_id: $events_slct.event_id,
@@ -388,9 +395,41 @@ async function handle_qry__event(
<option value={200}>200</option>
<option value={500}>500</option>
</select>
<!-- </span> -->
<!-- Sort by last updated date or by name -->
<!-- <span
class="flex flex-row gap-1 items-center justify-around"
> -->
<label
class="text-sm w-32 text-right"
for="qry_order_by__events">
Sort by:
</label>
<select
id="qry_order_by__events"
bind:value={$idaa_loc.recovery_meetings.qry__order_by}
on:change={() => {
if ($idaa_loc.recovery_meetings.qry__order_by == 'updated_on') {
$idaa_loc.recovery_meetings.qry__order_by = 'updated_on';
$idaa_loc.recovery_meetings.qry__order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'};
} else {
$idaa_loc.recovery_meetings.qry__order_by = 'name';
$idaa_loc.recovery_meetings.qry__order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
}
ae_trigger = 'load__event_obj_li';
}}
class="select w-40 text-sm"
>
<option value="updated_on">Last Updated</option>
<option value="name">Meeting Name</option>
</select>
</span>
{#if $ae_loc.trusted_access && !$idaa_loc.recovery_meetings.qry__hidden || $idaa_loc.recovery_meetings.qry__hidden == 'not_hidden'}
<span
class="flex flex-row gap-1 items-center justify-around"
>
{#if ($ae_loc.edit_mode && $ae_loc.trusted_access) && (!$idaa_loc.recovery_meetings.qry__hidden || $idaa_loc.recovery_meetings.qry__hidden == 'not_hidden')}
<button
on:click={() => {
$idaa_loc.recovery_meetings.qry__hidden = 'all';
@@ -414,7 +453,7 @@ async function handle_qry__event(
</button>
{/if}
{#if $ae_loc.administrator_access && !$idaa_loc.recovery_meetings.qry__enabled || $idaa_loc.recovery_meetings.qry__enabled == 'enabled'}
{#if ($ae_loc.edit_mode && $ae_loc.administrator_access) && (!$idaa_loc.recovery_meetings.qry__enabled || $idaa_loc.recovery_meetings.qry__enabled == 'enabled')}
<button
on:click={() => {
$idaa_loc.recovery_meetings.qry__hidden = 'all';
@@ -437,7 +476,11 @@ async function handle_qry__event(
<span class="fas fa-eye-slash m-1"></span> Hide Disabled Events
</button>
{/if}
</span>
<span
class="flex flex-row gap-1 items-center justify-around"
>
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
<button
on:click={() => {
@@ -463,7 +506,7 @@ async function handle_qry__event(
</button>
{/if}
{#if $ae_loc.trusted_access}
{#if ($ae_loc.edit_mode && $ae_loc.trusted_access)}
<button
type="button"
on:click={() => {
@@ -480,7 +523,7 @@ async function handle_qry__event(
return_file: true,
filename: `${$ae_loc.account_code}_IDAA_Recovery_Meetings_export_${ae_util.iso_datetime_formatter()}.xlsx`,
auto_download: true,
log_lvl: 2
log_lvl: 1
});
}}
@@ -499,6 +542,7 @@ async function handle_qry__event(
Export All Data
</button>
{/if}
</span>
</div>