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__enabled: 'enabled', // all, disabled, enabled
qry__hidden: 'not_hidden', // all, hidden, not_hidden qry__hidden: 'not_hidden', // all, hidden, not_hidden
qry__limit: 150, qry__limit: 150,
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'},
qry__offset: 0, qry__offset: 0,
qry__fulltext_str: null, 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"> <fieldset class="flex_row flex_gap_md flex_justify_around">
<label>Timezone <label>Timezone
{#if $ae_loc?.lu_time_zone_list && $ae_loc?.lu_time_zone_list.length > 0} {#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} {#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> <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} {/each}

View File

@@ -41,6 +41,7 @@ onMount(() => {
class="container recovery_meeting event_obj border border-1 rounded p-2 mb-2" class="container recovery_meeting event_obj border border-1 rounded p-2 mb-2"
class:dim={idaa_event_obj?.hide} class:dim={idaa_event_obj?.hide}
class:bg-warning-100={!idaa_event_obj?.enable} class:bg-warning-100={!idaa_event_obj?.enable}
class:text-warning-900={!idaa_event_obj?.enable}
> >
<header class="ae_header"> <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> <span class="badge badge-warning"><span class="fas fa-exclamation-triangle m-1"></span> Hidden</span>
{/if} {/if}
{#if $ae_loc.administrator_access && !idaa_event_obj?.enable} {#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} {/if}
</h3> </h3>
</header> </header>
@@ -251,7 +252,7 @@ onMount(() => {
{#if $ae_loc.administrator_access} {#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} <!-- {#if idaa_event_obj.location_address_json}
<span <span
class="event__location_address_json" 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_physical = $idaa_loc.recovery_meetings.qry__physical,
and_virtual = $idaa_loc.recovery_meetings.qry__virtual, and_virtual = $idaa_loc.recovery_meetings.qry__virtual,
and_type = $idaa_loc.recovery_meetings.qry__type, and_type = $idaa_loc.recovery_meetings.qry__type,
order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li,
search_delay = 0, search_delay = 0,
max_tries = 5, max_tries = 5,
params = { params = {
@@ -72,6 +73,7 @@ async function handle_qry__event(
and_physical?: null|boolean, and_physical?: null|boolean,
and_virtual?: null|boolean, and_virtual?: null|boolean,
and_type?: null|string, and_type?: null|string,
order_by_li?: key_val,
search_delay?: number, // In milliseconds search_delay?: number, // In milliseconds
max_tries?: number, max_tries?: number,
params?: key_val, params?: key_val,
@@ -128,7 +130,7 @@ async function handle_qry__event(
api_cfg: $ae_api, api_cfg: $ae_api,
for_obj_type: 'account', for_obj_type: 'account',
for_obj_id: $ae_loc.account_id, 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_conference: false,
qry_physical: and_physical, qry_physical: and_physical,
qry_virtual: and_virtual, qry_virtual: and_virtual,
@@ -187,7 +189,6 @@ async function handle_qry__event(
<!-- <div class="ae_info recovery_meetings_info note"> <!-- <div class="ae_info recovery_meetings_info note">
{@html $idaa_loc.recovery_meetings.ds.recovery_meetings_info} {@html $idaa_loc.recovery_meetings.ds.recovery_meetings_info}
</div> --> </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 <form
on:submit|preventDefault={() => { on:submit|preventDefault={() => {
@@ -205,10 +206,10 @@ async function handle_qry__event(
bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str} bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str}
> >
</div> --> </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 <button
type="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={() => { on:click={() => {
$idaa_loc.recovery_meetings.qry__fulltext_str = ''; $idaa_loc.recovery_meetings.qry__fulltext_str = '';
ae_trigger = 'load__event_obj_li'; ae_trigger = 'load__event_obj_li';
@@ -222,16 +223,17 @@ async function handle_qry__event(
</button> </button>
<input <input
type="search" type="search"
placeholder="Search (day of week, location, chair, etc.)" placeholder="Search: day of week, location, contacts, etc."
id="meeting_qry__fulltext_str" id="meeting_qry__fulltext_str"
name="qry__fulltext_str" name="qry__fulltext_str"
bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str} bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str}
style="width: 50%;" 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 <button
type="submit" 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> --> <!-- <span class="fas fa-search m-1"></span> -->
{#if $idaa_sess.recovery_meetings.qry__status == 'loading'} {#if $idaa_sess.recovery_meetings.qry__status == 'loading'}
@@ -285,6 +287,7 @@ async function handle_qry__event(
value="" value=""
bind:group={$idaa_loc.recovery_meetings.qry__type} bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}} on:change={() => {ae_trigger = 'load__event_obj_li';}}
class="radio"
title="Show all meeting types" title="Show all meeting types"
> >
</label> </label>
@@ -295,6 +298,7 @@ async function handle_qry__event(
value="IDAA" value="IDAA"
bind:group={$idaa_loc.recovery_meetings.qry__type} bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}} on:change={() => {ae_trigger = 'load__event_obj_li';}}
class="radio"
title="Open to IDAA members only" title="Open to IDAA members only"
> >
</label> </label>
@@ -305,6 +309,7 @@ async function handle_qry__event(
value="Caduceus" value="Caduceus"
bind:group={$idaa_loc.recovery_meetings.qry__type} bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}} on:change={() => {ae_trigger = 'load__event_obj_li';}}
class="radio"
title="Open to all healthcare workers including those who do not qualify for IDAA" title="Open to all healthcare workers including those who do not qualify for IDAA"
> >
</label> </label>
@@ -315,6 +320,7 @@ async function handle_qry__event(
value="Family Recovery" value="Family Recovery"
bind:group={$idaa_loc.recovery_meetings.qry__type} bind:group={$idaa_loc.recovery_meetings.qry__type}
on:change={() => {ae_trigger = 'load__event_obj_li';}} 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." title="Open to spouses, parents, and children of medical professionals who have substance use disorder."
> >
</label> </label>
@@ -349,7 +355,7 @@ async function handle_qry__event(
<div>Error: {error.message}</div> <div>Error: {error.message}</div>
{/await} --> {/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 --> <!-- Max events select options -->
<span <span
@@ -358,12 +364,13 @@ async function handle_qry__event(
<label <label
class="text-sm w-32 text-right" class="text-sm w-32 text-right"
for="qry_limit__events"> for="qry_limit__events">
Max events: Max results:
</label> </label>
<select <select
id="qry_limit__events" id="qry_limit__events"
bind:value={$idaa_loc.recovery_meetings.qry__limit} bind:value={$idaa_loc.recovery_meetings.qry__limit}
on:change={() => { on:change={() => {
ae_trigger = 'load__event_obj_li';
// search__event_presenter({ // search__event_presenter({
// api_cfg: $ae_api, // api_cfg: $ae_api,
// event_id: $events_slct.event_id, // event_id: $events_slct.event_id,
@@ -388,9 +395,41 @@ async function handle_qry__event(
<option value={200}>200</option> <option value={200}>200</option>
<option value={500}>500</option> <option value={500}>500</option>
</select> </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> </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 <button
on:click={() => { on:click={() => {
$idaa_loc.recovery_meetings.qry__hidden = 'all'; $idaa_loc.recovery_meetings.qry__hidden = 'all';
@@ -414,7 +453,7 @@ async function handle_qry__event(
</button> </button>
{/if} {/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 <button
on:click={() => { on:click={() => {
$idaa_loc.recovery_meetings.qry__hidden = 'all'; $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 <span class="fas fa-eye-slash m-1"></span> Hide Disabled Events
</button> </button>
{/if} {/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} {#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
<button <button
on:click={() => { on:click={() => {
@@ -463,7 +506,7 @@ async function handle_qry__event(
</button> </button>
{/if} {/if}
{#if $ae_loc.trusted_access} {#if ($ae_loc.edit_mode && $ae_loc.trusted_access)}
<button <button
type="button" type="button"
on:click={() => { on:click={() => {
@@ -480,7 +523,7 @@ async function handle_qry__event(
return_file: true, return_file: true,
filename: `${$ae_loc.account_code}_IDAA_Recovery_Meetings_export_${ae_util.iso_datetime_formatter()}.xlsx`, filename: `${$ae_loc.account_code}_IDAA_Recovery_Meetings_export_${ae_util.iso_datetime_formatter()}.xlsx`,
auto_download: true, auto_download: true,
log_lvl: 2 log_lvl: 1
}); });
}} }}
@@ -499,6 +542,7 @@ async function handle_qry__event(
Export All Data Export All Data
</button> </button>
{/if} {/if}
</span>
</div> </div>