Rework of the IDAA Recovery Meetings search. Other related updates and bug fixes. Added preventDefault()
This commit is contained in:
@@ -121,7 +121,7 @@ let idaa_session_data_struct: key_val = {
|
||||
|
||||
recovery_meetings: {
|
||||
qry__status: null,
|
||||
// qry__fulltext_str: null,
|
||||
qry__fulltext_str: null,
|
||||
status_qry__last_request_str: null,
|
||||
|
||||
show__modal_edit: false,
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
<script lang="ts">
|
||||
/** @type {import('./$types').PageData} */
|
||||
let log_lvl: number = 0;
|
||||
interface Props {
|
||||
/** @type {import('./$types').PageData} */
|
||||
data: any;
|
||||
log_lvl?: number;
|
||||
}
|
||||
|
||||
let {
|
||||
data,
|
||||
log_lvl = 0
|
||||
}: Props = $props();
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { browser } from '$app/environment';
|
||||
@@ -9,7 +17,7 @@ import { browser } from '$app/environment';
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||
import Comp_event_session_obj_li from '../ae_comp__event_session_obj_li.svelte';
|
||||
// import Comp_event_session_obj_li from '../ae_comp__event_session_obj_li.svelte';
|
||||
import Comp_event_session_obj_li_wrapper from '../ae_comp__event_session_obj_li_wrapper.svelte';
|
||||
|
||||
import { liveQuery } from "dexie";
|
||||
@@ -23,11 +31,6 @@ import Comp_event_files_upload from '../ae_comp__event_files_upload.svelte';
|
||||
import Element_manage_event_file_li_wrap from '$lib/element_manage_event_file_li_direct.svelte';
|
||||
import Event_page_menu from './event_page_menu.svelte';
|
||||
|
||||
interface Props {
|
||||
data: any;
|
||||
}
|
||||
|
||||
let { data }: Props = $props();
|
||||
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
// $slct.account_id = data.account_id;
|
||||
@@ -104,7 +107,7 @@ let event_session_id_random_li: Array<string> = $state([]);
|
||||
|
||||
let lq__event_location_obj_li = $derived(liveQuery(async () => {
|
||||
let results = await db_events.locations
|
||||
.where('event_id_random')
|
||||
.where('event_id')
|
||||
.equals($events_slct.event_id)
|
||||
.sortBy('name')
|
||||
;
|
||||
@@ -133,6 +136,13 @@ if (browser) {
|
||||
$events_trigger = 'load__event_session_obj_li';
|
||||
}
|
||||
|
||||
function preventDefault(fn) {
|
||||
return function (event) {
|
||||
event.preventDefault();
|
||||
fn.call(this, event);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-06-12 late
|
||||
$effect(() => {
|
||||
@@ -303,10 +313,12 @@ async function handle_search__event_session(
|
||||
}
|
||||
|
||||
if ($events_sess.pres_mgmt?.status_qry__search != null && $events_sess.pres_mgmt?.status_qry__search != 'done') {
|
||||
|
||||
let random_delay = Math.floor(Math.random() * 25);
|
||||
search_delay += 25+random_delay;
|
||||
console.log(`*** TEST SEARCH - $events_sess.pres_mgmt.status_qry__search == loading wait *** search_delay=${search_delay}`);
|
||||
// $events_sess.status_qry__last_request_str = lk_search_str;
|
||||
|
||||
} else {
|
||||
// console.log('*** TEST SEARCH - $events_sess.pres_mgmt.status_qry__search != loading ***');
|
||||
|
||||
@@ -483,9 +495,9 @@ max-w-max -->
|
||||
<div class="ae_container_actions">
|
||||
|
||||
<form
|
||||
onsubmit={() => {
|
||||
onsubmit={preventDefault(() => {
|
||||
$events_trigger = 'load__event_session_obj_li';
|
||||
}}
|
||||
})}
|
||||
autocomplete="off"
|
||||
class="form grow flex flex-row flex-wrap gap-1 justify-center items-center w-full"
|
||||
>
|
||||
@@ -539,7 +551,7 @@ max-w-max -->
|
||||
<!-- Clear text -->
|
||||
</button>
|
||||
|
||||
<!-- svelte-ignore a11y-autofocus -->
|
||||
<!-- svelte-ignore a11y_autofocus -->
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search for a session"
|
||||
@@ -566,9 +578,8 @@ max-w-max -->
|
||||
{#if $events_sess.pres_mgmt.status_qry__search == 'loading'}
|
||||
<span class="fas fa-spinner fa-spin"></span>
|
||||
{:else }
|
||||
<!-- Nothing -->
|
||||
<span class="fas fa-search mx-1"></span>
|
||||
{/if}
|
||||
<span class="fas fa-search mx-1"></span>
|
||||
Search
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
|
||||
|
||||
// *** Import Svelte specific
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
@@ -69,14 +68,14 @@ let ae_triggers: key_val = $state({});
|
||||
<!-- sm:border-red-200 md:border-yellow-200 lg:border-gray-100 -->
|
||||
<section
|
||||
class="
|
||||
ae_comp event_session_obj_li
|
||||
border-2 border-dashed border-x-red-500 border-y-white
|
||||
sm:border-x-red-400 md:border-x-yellow-400 lg:border-x-gray-100
|
||||
px-0.5 py-2 space-y-2
|
||||
min-w-full
|
||||
w-full
|
||||
container overflow-x-scroll {container_class_li}
|
||||
"
|
||||
ae_comp event_session_obj_li
|
||||
border-2 border-dashed border-x-red-500 border-y-white
|
||||
sm:border-x-red-400 md:border-x-yellow-400 lg:border-x-gray-100
|
||||
px-0.5 py-2 space-y-2
|
||||
min-w-full
|
||||
w-full
|
||||
container overflow-x-scroll {container_class_li}
|
||||
"
|
||||
>
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import { events_func } from '$lib/ae_events_functions';
|
||||
import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||
|
||||
import Comp__event_obj_qry from './ae_idaa_comp__event_obj_qry.svelte';
|
||||
import Comp__event_obj_li from './ae_idaa_comp__event_obj_li.svelte';
|
||||
import Comp__event_obj_li_wrapper from './ae_idaa_comp__event_obj_li_wrapper.svelte';
|
||||
// import Comp__event_obj_id_edit from './ae_idaa_comp__event_obj_id_edit.svelte';
|
||||
// import Comp__event_obj_id_view from './ae_idaa_comp__event_obj_id_view.svelte';
|
||||
|
||||
@@ -43,7 +43,7 @@ if (!event_id) {
|
||||
$idaa_trig.event_id = event_id;
|
||||
}
|
||||
|
||||
let event_id_random_li: Array<string> = $state();
|
||||
let event_id_random_li: Array<string> = $state([]);
|
||||
|
||||
// Functions and Logic
|
||||
let lq_new__event_obj_li = $derived(liveQuery(async () => {
|
||||
@@ -110,36 +110,36 @@ let lq_new__event_obj_li = $derived(liveQuery(async () => {
|
||||
|
||||
// This (event_li trigger for IDAA) is not currently being used.
|
||||
// Updated 2024-11-19
|
||||
$effect(() => {
|
||||
if ($idaa_trig.event_li) {
|
||||
$idaa_trig.event_li = false;
|
||||
// $effect(() => {
|
||||
// if ($idaa_trig.event_li) {
|
||||
// $idaa_trig.event_li = false;
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`Triggered: $idaa_trig.event_li`);
|
||||
}
|
||||
// if (log_lvl) {
|
||||
// console.log(`Triggered: $idaa_trig.event_li`);
|
||||
// }
|
||||
|
||||
if ($idaa_loc.recovery_meetings.qry__enabled !== 'all' || $idaa_loc.recovery_meetings.qry__hidden !== 'all') {
|
||||
console.log(`Deleting disabled or hidden event.`);
|
||||
let results = db_events.events
|
||||
.clear();
|
||||
console.log(`Deleted ${results} disabled event.`);
|
||||
// if ($idaa_loc.recovery_meetings.qry__enabled !== 'all' || $idaa_loc.recovery_meetings.qry__hidden !== 'all') {
|
||||
// console.log(`Deleting disabled or hidden event.`);
|
||||
// let results = db_events.events
|
||||
// .clear();
|
||||
// console.log(`Deleted ${results} disabled event.`);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
$idaa_prom.load__event_obj_li = events_func.load_ae_obj_li__event({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: $idaa_slct.account_id,
|
||||
qry_conference: false,
|
||||
enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
||||
hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||
limit: $idaa_loc.recovery_meetings.qry__limit,
|
||||
order_by_li: $idaa_loc.recovery_meetings.qry__order_by_li,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
}
|
||||
});
|
||||
// $idaa_prom.load__event_obj_li = events_func.load_ae_obj_li__event({
|
||||
// api_cfg: $ae_api,
|
||||
// for_obj_type: 'account',
|
||||
// for_obj_id: $idaa_slct.account_id,
|
||||
// qry_conference: false,
|
||||
// enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
||||
// hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||
// limit: $idaa_loc.recovery_meetings.qry__limit,
|
||||
// order_by_li: $idaa_loc.recovery_meetings.qry__order_by_li,
|
||||
// try_cache: true,
|
||||
// log_lvl: log_lvl,
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
// Updated 2024-11-19
|
||||
@@ -156,10 +156,10 @@ $effect(() => {
|
||||
let and_physical = $idaa_loc.recovery_meetings.qry__physical;
|
||||
let and_virtual = $idaa_loc.recovery_meetings.qry__virtual;
|
||||
let and_type = $idaa_loc.recovery_meetings.qry__type;
|
||||
let order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li;
|
||||
// let order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li;
|
||||
let search_delay = 15;
|
||||
let max_tries = 5;
|
||||
let try_cache = true;
|
||||
// let try_cache = true;
|
||||
|
||||
// let params = {
|
||||
// 'qry__enabled': $idaa_loc.recovery_meetings.qry__enabled ?? 'enabled',
|
||||
@@ -186,7 +186,7 @@ $effect(() => {
|
||||
search_delay += 50+random_delay;
|
||||
}
|
||||
|
||||
log_lvl = 0;
|
||||
log_lvl = 1;
|
||||
|
||||
let count = 0;
|
||||
let request_loop = setInterval(() => {
|
||||
@@ -200,10 +200,12 @@ $effect(() => {
|
||||
}
|
||||
|
||||
if ($idaa_sess.recovery_meetings?.qry__status != null && $idaa_sess.recovery_meetings?.qry__status != 'done') {
|
||||
|
||||
let random_delay = Math.floor(Math.random() * 25);
|
||||
search_delay += 25+random_delay;
|
||||
console.log(`*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status == loading wait *** search_delay=${search_delay}`);
|
||||
// $idaa_sess.status_qry__last_request_str = $idaa_loc.recovery_meetings.qry__fulltext_str;
|
||||
|
||||
} else {
|
||||
console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != loading ***');
|
||||
|
||||
@@ -233,31 +235,36 @@ $effect(() => {
|
||||
hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||
order_by_li: $idaa_loc.recovery_meetings.qry__order_by_li,
|
||||
limit: $idaa_loc.recovery_meetings.qry__limit,
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl,
|
||||
})
|
||||
.then(function (search_results) {
|
||||
// Processing the results from the search.
|
||||
$idaa_sess.recovery_meetings.qry__status = 'processing';
|
||||
$idaa_slct.event_obj_li = search_results;
|
||||
console.log(search_results);
|
||||
if (log_lvl) {
|
||||
console.log(`Found ${search_results.length} matching events.`);
|
||||
console.log('TEST SEARCH - Search done. Need to pull out the id_random list for bulk load.');
|
||||
}
|
||||
event_id_random_li = generate_id_random_li({event_obj_li: search_results});
|
||||
|
||||
|
||||
// $idaa_sess.recovery_meetings.qry__status = 'done';
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('TEST SEARCH - Search done. Pulling out the event_id_randoms.');
|
||||
}
|
||||
// if (log_lvl) {
|
||||
//
|
||||
// }
|
||||
// console.log(`TEST search: ${$lq_kv__event_obj_li}`);
|
||||
|
||||
// event_id_random_li = [];
|
||||
|
||||
// We need to loop through the array of objects and get the event_id_random from each object a new list of event_id_randoms. Then we can use this list to get the full objects from the database.
|
||||
let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
if (search_results && search_results.length) {
|
||||
for (let i = 0; i < search_results.length; i++) {
|
||||
tmp_li.push($idaa_slct.event_obj_li[i].event_id_random);
|
||||
}
|
||||
}
|
||||
event_id_random_li = tmp_li;
|
||||
// // We need to loop through the array of objects and get the event_id_random from each object a new list of event_id_randoms. Then we can use this list to get the full objects from the database.
|
||||
// let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
// if (search_results && search_results.length) {
|
||||
// for (let i = 0; i < search_results.length; i++) {
|
||||
// tmp_li.push($idaa_slct.event_obj_li[i].event_id_random);
|
||||
// }
|
||||
// }
|
||||
// event_id_random_li = tmp_li;
|
||||
})
|
||||
.finally(() => {
|
||||
|
||||
@@ -279,6 +286,48 @@ $effect(() => {
|
||||
}
|
||||
});
|
||||
|
||||
// $effect(() => {
|
||||
// if ($idaa_sess.recovery_meetings.qry__status == 'done') {
|
||||
// if (log_lvl) {
|
||||
// console.log(`*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status == done ***`);
|
||||
// }
|
||||
// // We are done with the search.
|
||||
// $idaa_sess.recovery_meetings.qry__status = null;
|
||||
|
||||
// // We need to loop through the array of objects and get the event_id_random from each object a new list of event_id_randoms. Then we can use this list to get the full objects from the database.
|
||||
// let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
// if ($idaa_slct.event_obj_li && $idaa_slct.event_obj_li.length) {
|
||||
// event_id_random_li = [];
|
||||
// // console.log(`TEST SEARCH - Get ids:`, $idaa_slct.event_obj_li);
|
||||
// for (let i = 0; i < $idaa_slct.event_obj_li.length; i++) {
|
||||
// tmp_li.push($idaa_slct.event_obj_li[i].event_id_random);
|
||||
// }
|
||||
// }
|
||||
// event_id_random_li = tmp_li;
|
||||
// // console.log(`TEST search: event_id_random_li`, $state.snapshot(event_id_random_li));
|
||||
// }
|
||||
// });
|
||||
|
||||
function generate_id_random_li({
|
||||
event_obj_li = $idaa_slct.event_obj_li
|
||||
}: {
|
||||
event_obj_li?: Array<any>,
|
||||
} = {}) {
|
||||
let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
|
||||
// We need to loop through the array of objects and get the id_random from each object a new list of id_randoms. Then we can use this list to get the full objects from the database.
|
||||
if (event_obj_li && event_obj_li.length) {
|
||||
for (let i = 0; i < event_obj_li.length; i++) {
|
||||
tmp_li.push(event_obj_li[i].event_id_random);
|
||||
}
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log(`generate_id_random_li:`, tmp_li);
|
||||
}
|
||||
|
||||
return tmp_li;
|
||||
}
|
||||
|
||||
|
||||
if (browser) {
|
||||
console.log('Browser environment detected.');
|
||||
@@ -402,8 +451,9 @@ function add_activity_log(
|
||||
"
|
||||
> -->
|
||||
|
||||
<!-- bind:event_id_random_li={event_id_random_li} -->
|
||||
<Comp__event_obj_qry
|
||||
bind:event_id_random_li={event_id_random_li}
|
||||
|
||||
/>
|
||||
|
||||
<Element_data_store
|
||||
@@ -418,9 +468,14 @@ function add_activity_log(
|
||||
show_edit_btn={true}
|
||||
/>
|
||||
|
||||
{#if $lq_new__event_obj_li && $lq_new__event_obj_li?.length}
|
||||
<Comp__event_obj_li
|
||||
lq__event_obj_li={lq_new__event_obj_li}
|
||||
<!-- {#if $lq_new__event_obj_li && $lq_new__event_obj_li?.length} -->
|
||||
<!-- lq__event_obj_li={lq_new__event_obj_li} -->
|
||||
{#if event_id_random_li}
|
||||
<Comp__event_obj_li_wrapper
|
||||
event_id_random_li={event_id_random_li}
|
||||
link_to_type={'account'}
|
||||
link_to_id={$slct.account_id}
|
||||
log_lvl={log_lvl}
|
||||
/>
|
||||
{:else}
|
||||
<p>No recovery meetings available to show.</p>
|
||||
|
||||
@@ -1,29 +1,40 @@
|
||||
<script lang="ts">
|
||||
/** @type {import('./$types').PageData} */
|
||||
export let data: any;
|
||||
let log_lvl: number = 0;
|
||||
interface Props {
|
||||
/** @type {import('./$types').PageData} */
|
||||
log_lvl?: number;
|
||||
data?: any;
|
||||
container_class_li?: string|Array<string>;
|
||||
link_to_type: null|string;
|
||||
link_to_id: null|string;
|
||||
lq__event_obj_li: any;
|
||||
}
|
||||
|
||||
// *** Import Svelte core
|
||||
let {
|
||||
log_lvl = 0,
|
||||
data,
|
||||
container_class_li = [],
|
||||
link_to_type = null,
|
||||
link_to_id = null,
|
||||
lq__event_obj_li
|
||||
}: Props = $props();
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { onMount } from 'svelte';
|
||||
import { Spinner } from 'flowbite-svelte';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
// *** Import Aether specific variables and functions
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig } from '$lib/ae_idaa_stores';
|
||||
|
||||
export let lq__event_obj_li: any;
|
||||
|
||||
onMount(() => {
|
||||
if (log_lvl) {
|
||||
console.log('** Component Mounted: ** List - Recovery Meeting (Event) Obj');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (browser) {
|
||||
if (log_lvl) {
|
||||
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||
}
|
||||
|
||||
add_activity_log(
|
||||
{
|
||||
action: 'idaa_meetings_page',
|
||||
@@ -89,7 +100,13 @@ function add_activity_log(
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_list event_obj_li list__event_obj recovery_meeting_list flex flex-col gap-2 items-center justify-center w-full">
|
||||
<section
|
||||
class="
|
||||
svelte_component ae_section ae_list event_obj_li list__event_obj recovery_meeting_list
|
||||
flex flex-col gap-2 items-center justify-center w-full
|
||||
{container_class_li}
|
||||
"
|
||||
>
|
||||
|
||||
{#if $lq__event_obj_li && $lq__event_obj_li.length}
|
||||
<div class="overflow-auto space-y-2">
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
// Exports
|
||||
container_class_li?: string|Array<string>;
|
||||
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||
event_id_random_li?: Array<string>;
|
||||
link_to_type: string;
|
||||
link_to_id: string;
|
||||
order_by?: string;
|
||||
hide?: string;
|
||||
enable?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
log_lvl?: number;
|
||||
}
|
||||
|
||||
let {
|
||||
container_class_li = '',
|
||||
event_id_random_li = [],
|
||||
link_to_type = 'account',
|
||||
link_to_id,
|
||||
order_by = 'updated_on',
|
||||
hide = 'not_hidden', // all, hidden, not_hidden
|
||||
enable = 'enabled', // all, disabled, enabled
|
||||
limit = 0,
|
||||
offset = 0,
|
||||
log_lvl = 0
|
||||
}: Props = $props();
|
||||
|
||||
// *** Import Svelte specific
|
||||
|
||||
// *** Import other supporting libraries
|
||||
import { liveQuery } from "dexie";
|
||||
import { db_events } from "$lib/ae_events/db_events";
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import Comp__event_obj_li from './ae_idaa_comp__event_obj_li.svelte';
|
||||
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`TEST event: link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||
}
|
||||
if (log_lvl > 1) {
|
||||
console.log(`TEST event: event_id_random_li: ${event_id_random_li}`);
|
||||
}
|
||||
|
||||
// Variables
|
||||
// let ae_promises: key_val = {};
|
||||
// let ae_tmp: key_val = {};
|
||||
// let ae_triggers: key_val = {};
|
||||
|
||||
let dq__where_type_id_val: string = `${link_to_type}_id`; // no more "xyz_id_random"
|
||||
let dq__where_eq_id_val: string = link_to_id;
|
||||
|
||||
// Functions and Logic
|
||||
let lq__event_obj_li = $derived(liveQuery(async () => {
|
||||
if (event_id_random_li.length > 0) {
|
||||
let results = await db_events.events
|
||||
.bulkGet(event_id_random_li);
|
||||
|
||||
return results;
|
||||
} else if (link_to_type && link_to_id) {
|
||||
let results = await db_events.events
|
||||
.where(dq__where_type_id_val)
|
||||
.equals(dq__where_eq_id_val)
|
||||
// .sortBy('name')
|
||||
.sortBy('updated_on')
|
||||
// This should be sorted by a custom sort field
|
||||
|
||||
return results;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}));
|
||||
</script>
|
||||
|
||||
|
||||
<Comp__event_obj_li
|
||||
container_class_li={container_class_li}
|
||||
link_to_type={link_to_type}
|
||||
link_to_id={link_to_id}
|
||||
lq__event_obj_li={lq__event_obj_li}
|
||||
log_lvl={log_lvl}
|
||||
>
|
||||
</Comp__event_obj_li>
|
||||
@@ -1,9 +1,20 @@
|
||||
<script lang="ts">
|
||||
// *** Import Svelte core
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
}
|
||||
|
||||
let {
|
||||
log_lvl = 0
|
||||
}: Props = $props();
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { browser } from '$app/environment';
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// *** Import Aether core variables and functions
|
||||
// *** Import other supporting libraries
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
@@ -11,27 +22,42 @@ import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
export let log_lvl: number = 0;
|
||||
|
||||
// export let event_id_random_li: Array<string>;
|
||||
|
||||
// export let container_class_li = [];
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
let ae_promises: key_val = $state({});
|
||||
// let ae_tmp: key_val = {};
|
||||
// let ae_trigger: any = null;
|
||||
// let ae_triggers: key_val = {};
|
||||
|
||||
// let search_submit_results: any = null;
|
||||
|
||||
onMount(() => {
|
||||
if (log_lvl) {
|
||||
console.log('** AE IDAA Mounted: ** Query - Recovery Meeting (Event) Obj');
|
||||
}
|
||||
});
|
||||
|
||||
if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings.qry__fulltext_str.length) {
|
||||
$idaa_trig.event_li_qry = true;
|
||||
if ($idaa_loc.recovery_meetings?.save_search_text && $idaa_loc.recovery_meetings?.saved_search__session) {
|
||||
$idaa_sess.recovery_meetings.fulltext_search_qry_str = $idaa_loc.recovery_meetings.saved_search__session;
|
||||
}
|
||||
if ($idaa_loc.recovery_meetings?.save_search_text && $idaa_loc.recovery_meetings?.saved_search__session_location_name) {
|
||||
$idaa_sess.recovery_meetings.location_name_qry_str = $idaa_loc.recovery_meetings.saved_search__session_location_name;
|
||||
}
|
||||
|
||||
|
||||
// Functions and Logic
|
||||
if (browser) {
|
||||
$idaa_trig.event_li_qry = true;
|
||||
// $idaa_trig = 'load__event_obj_li';
|
||||
}
|
||||
|
||||
function preventDefault(fn) {
|
||||
return function (event) {
|
||||
event.preventDefault();
|
||||
fn.call(this, event);
|
||||
};
|
||||
}
|
||||
|
||||
// if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings.qry__fulltext_str.length) {
|
||||
// $idaa_trig.event_li_qry = true;
|
||||
// }
|
||||
|
||||
|
||||
// Updated 2024-10-01
|
||||
@@ -204,9 +230,10 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
|
||||
<!-- WARNING: Using m-auto to work in the Novi iframe -->
|
||||
<form
|
||||
on:submit|preventDefault={() => {
|
||||
onsubmit={preventDefault(() => {
|
||||
$idaa_trig.event_li_qry = true;
|
||||
}}
|
||||
})}
|
||||
autocomplete="off"
|
||||
class="
|
||||
search_form
|
||||
flex flex-col flex-wrap gap-1 items-center justify-center w-full max-w-2xl
|
||||
@@ -214,15 +241,6 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
"
|
||||
>
|
||||
|
||||
<!-- <div class="ae_group">
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search (day of week, location, time, chair, etc.)"
|
||||
name="qry__fulltext_str"
|
||||
on:keyup={handle_oninput_qry__fulltext_str}
|
||||
bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str}
|
||||
>
|
||||
</div> -->
|
||||
<div class="ae_group flex flex-row flex-wrap gap-2 w-full items-center justify-center border-b border-surface-300-700 p-1">
|
||||
<button
|
||||
type="button"
|
||||
@@ -232,9 +250,9 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
preset-tonal-secondary border border-secondary-500 hover:preset-filled-secondary-500
|
||||
transition-all *:hover:inline
|
||||
"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
$idaa_loc.recovery_meetings.qry__fulltext_str = '';
|
||||
// $idaa_trig.event_li_qry = true;
|
||||
$idaa_sess.recovery_meetings.qry__fulltext_str = '';
|
||||
$idaa_trig.event_li_qry = true;
|
||||
}}
|
||||
title="Clear search text"
|
||||
@@ -244,17 +262,18 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
<span class="fas fa-remove-format"></span>
|
||||
<span class="hidden">Clear Text</span>
|
||||
</button>
|
||||
|
||||
<!-- svelte-ignore a11y_autofocus -->
|
||||
<input
|
||||
type="search"
|
||||
placeholder="Search: day of week, location, contacts, etc."
|
||||
placeholder="Name, location, day of week, contacts, etc."
|
||||
id="meeting_qry__fulltext_str"
|
||||
name="qry__fulltext_str"
|
||||
bind:value={$idaa_loc.recovery_meetings.qry__fulltext_str}
|
||||
on:keyup={
|
||||
() => {
|
||||
onkeyup={() => {
|
||||
$idaa_trig.event_li_qry = true;
|
||||
}
|
||||
}
|
||||
}}
|
||||
autofocus
|
||||
style="width: 50%;"
|
||||
class="
|
||||
input text-sm hover:text-2xl font-semibold font-mono w-80
|
||||
@@ -264,6 +283,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
form-control
|
||||
"
|
||||
>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
class="
|
||||
@@ -301,7 +321,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
name="qry_virtual"
|
||||
type="checkbox"
|
||||
bind:checked={$idaa_loc.recovery_meetings.qry__virtual}
|
||||
on:change={() => {$idaa_trig.event_li_qry = true;}}
|
||||
onchange={() => {$idaa_trig.event_li_qry = true;}}
|
||||
class="checkbox inline form-check-input d-inline-block"
|
||||
>
|
||||
</label>
|
||||
@@ -311,7 +331,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
name="qry_physical"
|
||||
type="checkbox"
|
||||
bind:checked={$idaa_loc.recovery_meetings.qry__physical}
|
||||
on:change={() => {$idaa_trig.event_li_qry = true;}}
|
||||
onchange={() => {$idaa_trig.event_li_qry = true;}}
|
||||
class="checkbox inline form-check-input d-inline-block"
|
||||
>
|
||||
</label>
|
||||
@@ -333,7 +353,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
type="radio"
|
||||
value=""
|
||||
bind:group={$idaa_loc.recovery_meetings.qry__type}
|
||||
on:change={() => {$idaa_trig.event_li_qry = true;}}
|
||||
onchange={() => {$idaa_trig.event_li_qry = true;}}
|
||||
class="radio inline form-check-input d-inline-block"
|
||||
title="Show all meeting types"
|
||||
>
|
||||
@@ -345,7 +365,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
type="radio"
|
||||
value="IDAA"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry__type}
|
||||
on:change={() => {$idaa_trig.event_li_qry = true;}}
|
||||
onchange={() => {$idaa_trig.event_li_qry = true;}}
|
||||
class="radio inline form-check-input d-inline-block"
|
||||
title="Open to IDAA members only"
|
||||
>
|
||||
@@ -357,7 +377,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
type="radio"
|
||||
value="Caduceus"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry__type}
|
||||
on:change={() => {$idaa_trig.event_li_qry = true;}}
|
||||
onchange={() => {$idaa_trig.event_li_qry = true;}}
|
||||
class="radio inline form-check-input d-inline-block"
|
||||
title="Open to all healthcare workers including those who do not qualify for IDAA"
|
||||
>
|
||||
@@ -369,7 +389,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
type="radio"
|
||||
value="Family Recovery"
|
||||
bind:group={$idaa_loc.recovery_meetings.qry__type}
|
||||
on:change={() => {$idaa_trig.event_li_qry = true;}}
|
||||
onchange={() => {$idaa_trig.event_li_qry = true;}}
|
||||
class="radio inline form-check-input d-inline-block"
|
||||
title="Open to spouses, parents, and children of medical professionals who have substance use disorder."
|
||||
>
|
||||
@@ -419,7 +439,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
<select
|
||||
id="qry_limit__events"
|
||||
bind:value={$idaa_loc.recovery_meetings.qry__limit}
|
||||
on:change={() => {
|
||||
onchange={() => {
|
||||
$idaa_trig.event_li_qry = true;
|
||||
// search__event_presenter({
|
||||
// api_cfg: $ae_api,
|
||||
@@ -468,7 +488,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
<select
|
||||
id="qry_order_by__events"
|
||||
bind:value={$idaa_loc.recovery_meetings.qry__order_by}
|
||||
on:change={() => {
|
||||
onchange={() => {
|
||||
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'};
|
||||
@@ -498,7 +518,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
{#if ($ae_loc.edit_mode && $ae_loc.trusted_access) && (!$idaa_loc.recovery_meetings.qry__hidden || $idaa_loc.recovery_meetings.qry__hidden == 'not_hidden')}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
$idaa_loc.recovery_meetings.qry__hidden = 'all';
|
||||
$idaa_loc.recovery_meetings.qry__limit = 200;
|
||||
$idaa_trig.event_li_qry = true;
|
||||
@@ -515,7 +535,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
{:else if $ae_loc.trusted_access && $idaa_loc.recovery_meetings.qry__hidden != 'not_hidden'}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
$idaa_loc.recovery_meetings.qry__hidden = 'not_hidden';
|
||||
// $idaa_loc.recovery_meetings.qry__limit = 100;
|
||||
$idaa_trig.event_li_qry = true;
|
||||
@@ -534,7 +554,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
{#if ($ae_loc.edit_mode && $ae_loc.administrator_access) && (!$idaa_loc.recovery_meetings.qry__enabled || $idaa_loc.recovery_meetings.qry__enabled == 'enabled')}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
$idaa_loc.recovery_meetings.qry__hidden = 'all';
|
||||
$idaa_loc.recovery_meetings.qry__enabled = 'all';
|
||||
$idaa_loc.recovery_meetings.qry__limit = 500;
|
||||
@@ -552,7 +572,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
{:else if $ae_loc.administrator_access && $idaa_loc.recovery_meetings.qry__enabled != 'enabled'}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
$idaa_loc.recovery_meetings.qry__enabled = 'enabled';
|
||||
$idaa_trig.event_li_qry = true;
|
||||
}}
|
||||
@@ -574,7 +594,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || $idaa_loc.novi_uuid}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (!confirm('Create new meeting?')) {
|
||||
return false;
|
||||
}
|
||||
@@ -646,7 +666,7 @@ if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings
|
||||
{#if ($ae_loc.edit_mode && $ae_loc.trusted_access)}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
if (!confirm('Download exported data Excel file?')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ import { liveQuery } from "dexie";
|
||||
// import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
// import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import { db_journals } from "$lib/ae_journals/db_journals";
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { db_journals } from "$lib/ae_journals/db_journals";
|
||||
import { journals_loc, journals_sess, journals_slct, journals_prom, journals_trig } from '$lib/ae_journals/ae_journals_stores';
|
||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user