Lots of work on searching. Other related code clean up.
This commit is contained in:
@@ -51,6 +51,9 @@ let idaa_local_data_struct: key_val = {
|
|||||||
hidden: 'not_hidden', // all, hidden, not_hidden
|
hidden: 'not_hidden', // all, hidden, not_hidden
|
||||||
limit: 150,
|
limit: 150,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
|
|
||||||
|
// qry__order_by: 'updated_on', // For the IDB index query
|
||||||
|
// qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, // For the SQL query
|
||||||
},
|
},
|
||||||
|
|
||||||
bb: {
|
bb: {
|
||||||
@@ -64,7 +67,8 @@ let idaa_local_data_struct: key_val = {
|
|||||||
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
qry__hidden: 'not_hidden', // all, hidden, not_hidden
|
||||||
qry__limit: 50,
|
qry__limit: 50,
|
||||||
qry__offset: 0,
|
qry__offset: 0,
|
||||||
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
qry__order_by: 'updated_on', // For the IDB index query
|
||||||
|
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'}, // For the SQL query
|
||||||
|
|
||||||
edit_kv: {}, // Used to track which post objects are being edited
|
edit_kv: {}, // Used to track which post objects are being edited
|
||||||
},
|
},
|
||||||
@@ -74,7 +78,8 @@ 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__order_by: 'updated_on', // For the IDB index query; name, updated_on/created_on
|
||||||
|
qry__order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, // For the SQL query
|
||||||
qry__offset: 0,
|
qry__offset: 0,
|
||||||
|
|
||||||
qry__fulltext_str: null,
|
qry__fulltext_str: null,
|
||||||
|
|||||||
@@ -576,9 +576,9 @@ max-w-max -->
|
|||||||
title="Search for a session"
|
title="Search for a session"
|
||||||
>
|
>
|
||||||
{#if $events_sess.pres_mgmt.status_qry__search == 'loading'}
|
{#if $events_sess.pres_mgmt.status_qry__search == 'loading'}
|
||||||
<span class="fas fa-spinner fa-spin"></span>
|
<span class="fas fa-spinner fa-spin text-success-600-400"></span>
|
||||||
{:else }
|
{:else }
|
||||||
<span class="fas fa-search mx-1"></span>
|
<span class="fas fa-search mx-1 text-surface-800-200"></span>
|
||||||
{/if}
|
{/if}
|
||||||
Search
|
Search
|
||||||
</button>
|
</button>
|
||||||
@@ -606,7 +606,7 @@ max-w-max -->
|
|||||||
|
|
||||||
<Comp_event_session_obj_li_wrapper
|
<Comp_event_session_obj_li_wrapper
|
||||||
event_session_id_random_li={event_session_id_random_li}
|
event_session_id_random_li={event_session_id_random_li}
|
||||||
log_lvl={2}
|
log_lvl={1}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
|
|||||||
@@ -1,23 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
||||||
// *** Import Svelte specific
|
|
||||||
import type { key_val } from '$lib/ae_stores';
|
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
|
||||||
import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
|
||||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
|
||||||
import Comp_event_presenter_obj_li from '../events/[event_id]/presenter/ae_comp__event_presenter_obj_li_wrapper.svelte';
|
|
||||||
import Element_manage_event_file_li from '$lib/element_manage_event_file_li_direct.svelte';
|
|
||||||
|
|
||||||
// import { liveQuery } from "dexie";
|
|
||||||
|
|
||||||
// *** Import Aether specific variables and functions
|
|
||||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
|
||||||
// import { db_events } from "$lib/db_events";
|
|
||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
|
||||||
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
|
||||||
import { events_func } from '$lib/ae_events_functions';
|
|
||||||
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
// Exports
|
// Exports
|
||||||
log_lvl?: number;
|
log_lvl?: number;
|
||||||
@@ -49,6 +30,24 @@ let {
|
|||||||
show__session_files = false,
|
show__session_files = false,
|
||||||
show__session_presentations = false
|
show__session_presentations = false
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
|
// *** Import Svelte specific
|
||||||
|
import type { key_val } from '$lib/ae_stores';
|
||||||
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
|
import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||||
|
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||||
|
import Comp_event_presenter_obj_li from '../events/[event_id]/presenter/ae_comp__event_presenter_obj_li_wrapper.svelte';
|
||||||
|
import Element_manage_event_file_li from '$lib/element_manage_event_file_li_direct.svelte';
|
||||||
|
|
||||||
|
// import { liveQuery } from "dexie";
|
||||||
|
|
||||||
|
// *** Import Aether specific variables and functions
|
||||||
|
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||||
|
// import { db_events } from "$lib/db_events";
|
||||||
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
|
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
||||||
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
|
|
||||||
// export let allow_basic: boolean = false;
|
// export let allow_basic: boolean = false;
|
||||||
// export let allow_moderator: boolean = false;
|
// export let allow_moderator: boolean = false;
|
||||||
|
|
||||||
@@ -87,7 +86,7 @@ let ae_triggers: key_val = $state({});
|
|||||||
<!-- <section class="py-2 space-y-2 xs:max-w-sm lg:max-w-100 container overflow-x-scroll"> -->
|
<!-- <section class="py-2 space-y-2 xs:max-w-sm lg:max-w-100 container overflow-x-scroll"> -->
|
||||||
|
|
||||||
<h2 class="h3">
|
<h2 class="h3">
|
||||||
<span class="text-md">
|
<span class="text-base text-gray-500">
|
||||||
Sessions:
|
Sessions:
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -95,7 +94,7 @@ let ae_triggers: key_val = $state({});
|
|||||||
<span class="text-3xl font-bold bg-success-100 px-4 border rounded-lg border-success-200"
|
<span class="text-3xl font-bold bg-success-100 px-4 border rounded-lg border-success-200"
|
||||||
title="Count {$lq__event_session_obj_li?.length ?? 'None'}"
|
title="Count {$lq__event_session_obj_li?.length ?? 'None'}"
|
||||||
>
|
>
|
||||||
<span class="fas fa-list-ol mx-4"></span>
|
<span class="fas fa-list-ol mx-4 text-gray-500"></span>
|
||||||
{$lq__event_session_obj_li?.length ?? 'None'}×
|
{$lq__event_session_obj_li?.length ?? 'None'}×
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -127,6 +126,8 @@ let ae_triggers: key_val = $state({});
|
|||||||
{#each $lq__event_session_obj_li as session_obj, index}
|
{#each $lq__event_session_obj_li as session_obj, index}
|
||||||
<tr
|
<tr
|
||||||
class:dim={session_obj?.hide}
|
class:dim={session_obj?.hide}
|
||||||
|
class:bg-warning-100={!session_obj?.enable}
|
||||||
|
class:text-warning-900={!session_obj?.enable}
|
||||||
>
|
>
|
||||||
<td>
|
<td>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -35,54 +35,54 @@ $idaa_slct.event_obj_li = ae_acct.slct.event_obj_li;
|
|||||||
// *** Set initial variables
|
// *** Set initial variables
|
||||||
|
|
||||||
|
|
||||||
$effect(() => {
|
// $effect(() => {
|
||||||
if ($idaa_trig.event_id && $idaa_slct.event_id) {
|
// if ($idaa_trig.event_id && $idaa_slct.event_id) {
|
||||||
log_lvl = 1;
|
// log_lvl = 1;
|
||||||
$idaa_trig.event_id = false;
|
// $idaa_trig.event_id = false;
|
||||||
|
|
||||||
if (log_lvl) {
|
// if (log_lvl) {
|
||||||
console.log(`Triggered: $idaa_slct.event_id = ${$idaa_slct.event_id}`);
|
// console.log(`Triggered: $idaa_slct.event_id = ${$idaa_slct.event_id}`);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$idaa_prom.load__event_obj = events_func.load_ae_obj_id__event({
|
// $idaa_prom.load__event_obj = events_func.load_ae_obj_id__event({
|
||||||
api_cfg: $ae_api,
|
// api_cfg: $ae_api,
|
||||||
event_id: $idaa_slct.event_id,
|
// event_id: $idaa_slct.event_id,
|
||||||
// enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
// // enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
||||||
// hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
// // hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||||
// limit: $idaa_loc.recovery_meetings.qry__limit,
|
// // limit: $idaa_loc.recovery_meetings.qry__limit,
|
||||||
try_cache: true,
|
// try_cache: true,
|
||||||
log_lvl: log_lvl,
|
// log_lvl: log_lvl,
|
||||||
})
|
// })
|
||||||
.then((event_obj) => {
|
// .then((event_obj) => {
|
||||||
if (log_lvl) {
|
// if (log_lvl) {
|
||||||
console.log(`Event object loaded: `, event_obj);
|
// console.log(`Event object loaded: `, event_obj);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$idaa_slct.event_obj = event_obj;
|
// $idaa_slct.event_obj = event_obj;
|
||||||
|
|
||||||
// $idaa_sess.recovery_meetings.show__modal_view = $idaa_slct.event_id;
|
// // $idaa_sess.recovery_meetings.show__modal_view = $idaa_slct.event_id;
|
||||||
// $idaa_sess.recovery_meetings.show__modal_edit = false;
|
// // $idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||||
});
|
// });
|
||||||
|
|
||||||
// $idaa_slct.event_obj = $idaa_prom.load__event_obj;
|
// // $idaa_slct.event_obj = $idaa_prom.load__event_obj;
|
||||||
|
|
||||||
if (!page.url.searchParams.get('event_id')) {
|
// if (!page.url.searchParams.get('event_id')) {
|
||||||
const url = new URL(location);
|
// const url = new URL(location);
|
||||||
// url.searchParams.set('event_id', $idaa_slct.event_id);
|
// // url.searchParams.set('event_id', $idaa_slct.event_id);
|
||||||
url.searchParams.delete('event_id');
|
// url.searchParams.delete('event_id');
|
||||||
history.pushState({}, '', url);
|
// history.pushState({}, '', url);
|
||||||
|
|
||||||
let message = {'event_id': $idaa_slct.event_id};
|
// let message = {'event_id': $idaa_slct.event_id};
|
||||||
window.parent.postMessage(message, "*");
|
// window.parent.postMessage(message, "*");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// $idaa_sess.recovery_meetings.show__modal_view = $idaa_slct.event_id;
|
// // $idaa_sess.recovery_meetings.show__modal_view = $idaa_slct.event_id;
|
||||||
// $idaa_sess.recovery_meetings.show__modal_view__event_id = $idaa_slct.event_id;
|
// // $idaa_sess.recovery_meetings.show__modal_view__event_id = $idaa_slct.event_id;
|
||||||
// $idaa_sess.recovery_meetings.show__modal_edit = false;
|
// // $idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||||
// $idaa_sess.recovery_meetings.show__modal_edit__event_id = false;
|
// // $idaa_sess.recovery_meetings.show__modal_edit__event_id = false;
|
||||||
|
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ export async function load({ params, parent }) { // route
|
|||||||
for_obj_type: 'account',
|
for_obj_type: 'account',
|
||||||
for_obj_id: account_id,
|
for_obj_id: account_id,
|
||||||
qry_conference: false,
|
qry_conference: false,
|
||||||
limit: 29,
|
hidden: 'not_hidden', // 'not_hidden'
|
||||||
|
enabled: 'enabled',
|
||||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'},
|
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'},
|
||||||
|
limit: 199,
|
||||||
try_cache: true,
|
try_cache: true,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ interface Props {
|
|||||||
}
|
}
|
||||||
let { data }: Props = $props();
|
let { data }: Props = $props();
|
||||||
|
|
||||||
let log_lvl: number = $state(0);
|
let log_lvl: number = $state(1);
|
||||||
|
|
||||||
// *** Import Svelte specific
|
// *** Import Svelte specific
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
@@ -34,71 +34,76 @@ import Comp__event_obj_li_wrapper from './ae_idaa_comp__event_obj_li_wrapper.sve
|
|||||||
// import Comp__event_obj_id_view from './ae_idaa_comp__event_obj_id_view.svelte';
|
// import Comp__event_obj_id_view from './ae_idaa_comp__event_obj_id_view.svelte';
|
||||||
|
|
||||||
|
|
||||||
let event_id = page.url.searchParams.get('event_id') ?? null;
|
// let event_id = page.url.searchParams.get('event_id') ?? null;
|
||||||
if (!event_id) {
|
// if (!event_id) {
|
||||||
$idaa_slct.event_id = null;
|
// $idaa_slct.event_id = null;
|
||||||
} else {
|
// } else {
|
||||||
console.log(`ae Recovery Meetings - [event_id] +page.ts: event_id = `, event_id);
|
// console.log(`ae Recovery Meetings - [event_id] +page.ts: event_id = `, event_id);
|
||||||
$idaa_slct.event_id = event_id;
|
// $idaa_slct.event_id = event_id;
|
||||||
$idaa_trig.event_id = event_id;
|
// $idaa_trig.event_id = event_id;
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (browser) {
|
||||||
|
$idaa_trig.event_li_qry = true;
|
||||||
|
// $idaa_trig = 'load__event_obj_li';
|
||||||
}
|
}
|
||||||
|
|
||||||
let event_id_random_li: Array<string> = $state([]);
|
let event_id_random_li: Array<string> = $state([]);
|
||||||
|
|
||||||
// Functions and Logic
|
// Functions and Logic
|
||||||
let lq_new__event_obj_li = $derived(liveQuery(async () => {
|
// let lq_new__event_obj_li = $derived(liveQuery(async () => {
|
||||||
let link_to_type: string = 'account';
|
// let link_to_type: string = 'account';
|
||||||
let link_to_id: string = $slct.account_id;
|
// let link_to_id: string = $ae_lock.account_id;
|
||||||
if (log_lvl > 1) {
|
// if (log_lvl > 1) {
|
||||||
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}; event_id_random_li:`, event_id_random_li);
|
// console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}; event_id_random_li:`, event_id_random_li);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Check if event_id_random_li is an array and not undefined
|
// // Check if event_id_random_li is an array and not undefined
|
||||||
if (event_id_random_li) {
|
// if (event_id_random_li) {
|
||||||
if (log_lvl) {
|
// if (log_lvl) {
|
||||||
console.log(`Trying bulkGet:`, event_id_random_li);
|
// console.log(`Trying bulkGet:`, event_id_random_li);
|
||||||
}
|
// }
|
||||||
let results = await db_events.events
|
// let results = await db_events.events
|
||||||
.bulkGet(event_id_random_li);
|
// .bulkGet(event_id_random_li);
|
||||||
|
|
||||||
return results;
|
// return results;
|
||||||
} else if (link_to_type && link_to_id) {
|
// } else if (link_to_type && link_to_id) {
|
||||||
if (log_lvl) {
|
// if (log_lvl) {
|
||||||
console.log(`Trying where: ${link_to_type}; equals: ${link_to_id}`);
|
// console.log(`Trying where: ${link_to_type}; equals: ${link_to_id}`);
|
||||||
}
|
// }
|
||||||
let results: any = null;
|
// let results: any = null;
|
||||||
if ($idaa_loc.recovery_meetings.qry__order_by == 'name') {
|
// if ($idaa_loc.recovery_meetings.qry__order_by == 'name') {
|
||||||
results = await db_events.events
|
// results = await db_events.events
|
||||||
.where(`${link_to_type}_id`)
|
// .where(`${link_to_type}_id`)
|
||||||
.equals(link_to_id)
|
// .equals(link_to_id)
|
||||||
.and((event) => {
|
// .and((event) => {
|
||||||
return event.hide == false;
|
// return event.hide == false;
|
||||||
})
|
// })
|
||||||
.and((event) => {
|
// .and((event) => {
|
||||||
return event.enable == true;
|
// return event.enable == true;
|
||||||
})
|
// })
|
||||||
.sortBy('name')
|
// .sortBy('name')
|
||||||
} else {
|
// } else {
|
||||||
results = await db_events.events
|
// results = await db_events.events
|
||||||
.where(`${link_to_type}_id`)
|
// .where(`${link_to_type}_id`)
|
||||||
.equals(link_to_id)
|
// .equals(link_to_id)
|
||||||
.and((event) => {
|
// .and((event) => {
|
||||||
return event.hide == false;
|
// return event.hide == false;
|
||||||
})
|
// })
|
||||||
.and((event) => {
|
// .and((event) => {
|
||||||
return event.enable == true;
|
// return event.enable == true;
|
||||||
})
|
// })
|
||||||
.sortBy('updated_on')
|
// .sortBy('updated_on')
|
||||||
}
|
// }
|
||||||
|
|
||||||
return results;
|
// return results;
|
||||||
} else {
|
// } else {
|
||||||
if (log_lvl) {
|
// if (log_lvl) {
|
||||||
console.log('Trying... Nothing to load');
|
// console.log('Trying... Nothing to load');
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}));
|
// }));
|
||||||
|
|
||||||
// let lq__event_obj = $derived(liveQuery(async () => {
|
// let lq__event_obj = $derived(liveQuery(async () => {
|
||||||
// let results = await db_events.events
|
// let results = await db_events.events
|
||||||
@@ -129,7 +134,7 @@ let lq_new__event_obj_li = $derived(liveQuery(async () => {
|
|||||||
// $idaa_prom.load__event_obj_li = events_func.load_ae_obj_li__event({
|
// $idaa_prom.load__event_obj_li = events_func.load_ae_obj_li__event({
|
||||||
// api_cfg: $ae_api,
|
// api_cfg: $ae_api,
|
||||||
// for_obj_type: 'account',
|
// for_obj_type: 'account',
|
||||||
// for_obj_id: $idaa_slct.account_id,
|
// for_obj_id: $ae_loc.account_id,
|
||||||
// qry_conference: false,
|
// qry_conference: false,
|
||||||
// enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
// enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
||||||
// hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
// hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||||
@@ -147,6 +152,8 @@ $effect(() => {
|
|||||||
if ($idaa_trig.event_li_qry) {
|
if ($idaa_trig.event_li_qry) {
|
||||||
$idaa_trig.event_li_qry = false;
|
$idaa_trig.event_li_qry = false;
|
||||||
|
|
||||||
|
log_lvl = 2;
|
||||||
|
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`Triggered: $idaa_trig.event_li_qry`);
|
console.log(`Triggered: $idaa_trig.event_li_qry`);
|
||||||
}
|
}
|
||||||
@@ -156,19 +163,15 @@ $effect(() => {
|
|||||||
let and_physical = $idaa_loc.recovery_meetings.qry__physical;
|
let and_physical = $idaa_loc.recovery_meetings.qry__physical;
|
||||||
let and_virtual = $idaa_loc.recovery_meetings.qry__virtual;
|
let and_virtual = $idaa_loc.recovery_meetings.qry__virtual;
|
||||||
let and_type = $idaa_loc.recovery_meetings.qry__type;
|
let and_type = $idaa_loc.recovery_meetings.qry__type;
|
||||||
// let order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li;
|
let fulltext_str = $idaa_loc.recovery_meetings.qry__fulltext_str?.trim() ?? null;
|
||||||
|
let enabled = $idaa_loc.recovery_meetings.qry__enabled;
|
||||||
|
let hidden = $idaa_loc.recovery_meetings.qry__hidden;
|
||||||
|
let limit = $idaa_loc.recovery_meetings.qry__limit;
|
||||||
|
let order_by_li = $idaa_loc.recovery_meetings.qry__order_by_li;
|
||||||
let search_delay = 15;
|
let search_delay = 15;
|
||||||
let max_tries = 5;
|
let max_tries = 5;
|
||||||
// let try_cache = true;
|
|
||||||
|
|
||||||
// let params = {
|
if (enabled !== 'all' || hidden !== 'all') {
|
||||||
// 'qry__enabled': $idaa_loc.recovery_meetings.qry__enabled ?? 'enabled',
|
|
||||||
// 'qry__hidden': $idaa_loc.recovery_meetings.qry__hidden ?? 'not_hidden',
|
|
||||||
// 'qry__limit': $idaa_loc.recovery_meetings.qry__limit ?? 35,
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
if ($idaa_loc.recovery_meetings.qry__enabled !== 'all' || $idaa_loc.recovery_meetings.qry__hidden !== 'all') {
|
|
||||||
console.log(`Deleting disabled or hidden event.`);
|
console.log(`Deleting disabled or hidden event.`);
|
||||||
let results = db_events.events
|
let results = db_events.events
|
||||||
.clear();
|
.clear();
|
||||||
@@ -179,15 +182,13 @@ $effect(() => {
|
|||||||
if ($idaa_sess.recovery_meetings?.qry__status != null && $idaa_sess.recovery_meetings?.qry__status != 'done') {
|
if ($idaa_sess.recovery_meetings?.qry__status != null && $idaa_sess.recovery_meetings?.qry__status != 'done') {
|
||||||
console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != done ***');
|
console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != done ***');
|
||||||
// WARNING: This is a temporary fix for the search string. It needs to be fixed in the future. Using lk_search_str for now.
|
// WARNING: This is a temporary fix for the search string. It needs to be fixed in the future. Using lk_search_str for now.
|
||||||
$idaa_sess.recovery_meetings.status_qry__last_request_str = $idaa_loc.recovery_meetings.qry__fulltext_str;
|
$idaa_sess.recovery_meetings.status_qry__last_request_str = fulltext_str;
|
||||||
|
|
||||||
// We want to delay the initial search request to give the previous search request to finish.
|
// We want to delay the initial search request to give the previous search request to finish.
|
||||||
let random_delay = Math.floor(Math.random() * 50);
|
let random_delay = Math.floor(Math.random() * 50);
|
||||||
search_delay += 50+random_delay;
|
search_delay += 50+random_delay;
|
||||||
}
|
}
|
||||||
|
event_id_random_li = [];
|
||||||
log_lvl = 1;
|
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let request_loop = setInterval(() => {
|
let request_loop = setInterval(() => {
|
||||||
count++;
|
count++;
|
||||||
@@ -204,12 +205,13 @@ $effect(() => {
|
|||||||
let random_delay = Math.floor(Math.random() * 25);
|
let random_delay = Math.floor(Math.random() * 25);
|
||||||
search_delay += 25+random_delay;
|
search_delay += 25+random_delay;
|
||||||
console.log(`*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status == loading wait *** search_delay=${search_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;
|
// $idaa_sess.status_qry__last_request_str = fulltext_str;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != loading ***');
|
console.log('*** TEST SEARCH - $idaa_sess.recovery_meetings.qry__status != loading ***');
|
||||||
|
|
||||||
$idaa_sess.recovery_meetings.qry__status = 'loading';
|
$idaa_sess.recovery_meetings.qry__status = 'loading';
|
||||||
|
// event_id_random_li = [];
|
||||||
|
|
||||||
(and_physical) ?? null;
|
(and_physical) ?? null;
|
||||||
(and_virtual) ?? null;
|
(and_virtual) ?? null;
|
||||||
@@ -219,7 +221,7 @@ $effect(() => {
|
|||||||
// and_type = null;
|
// and_type = null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
console.log(`TEST - and_physical: ${and_physical}; and_virtual: ${and_virtual}; and_type: ${and_type}; qry__fulltext_str: ${$idaa_loc.recovery_meetings.qry__fulltext_str}`);
|
console.log(`TEST - and_physical: ${and_physical}; and_virtual: ${and_virtual}; and_type: ${and_type}; qry__fulltext_str: ${fulltext_str}`);
|
||||||
|
|
||||||
$idaa_prom.load__event_obj_qry = events_func.qry_ae_obj_li__event({
|
$idaa_prom.load__event_obj_qry = events_func.qry_ae_obj_li__event({
|
||||||
api_cfg: $ae_api,
|
api_cfg: $ae_api,
|
||||||
@@ -230,11 +232,12 @@ $effect(() => {
|
|||||||
qry_physical: and_physical,
|
qry_physical: and_physical,
|
||||||
qry_virtual: and_virtual,
|
qry_virtual: and_virtual,
|
||||||
qry_type: and_type,
|
qry_type: and_type,
|
||||||
qry_str: $idaa_loc.recovery_meetings.qry__fulltext_str,
|
qry_str: fulltext_str,
|
||||||
enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
|
||||||
hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
enabled: enabled,
|
||||||
order_by_li: $idaa_loc.recovery_meetings.qry__order_by_li,
|
hidden: hidden,
|
||||||
limit: $idaa_loc.recovery_meetings.qry__limit,
|
limit: limit,
|
||||||
|
order_by_li: order_by_li,
|
||||||
log_lvl: log_lvl,
|
log_lvl: log_lvl,
|
||||||
})
|
})
|
||||||
.then(function (search_results) {
|
.then(function (search_results) {
|
||||||
@@ -275,7 +278,7 @@ $effect(() => {
|
|||||||
$idaa_sess.recovery_meetings.qry__status = 'done';
|
$idaa_sess.recovery_meetings.qry__status = 'done';
|
||||||
|
|
||||||
if (log_lvl > 1) {
|
if (log_lvl > 1) {
|
||||||
console.log(`TEST SEARCH - event_id_random_li:`, event_id_random_li);
|
console.log(`TEST SEARCH - qry__status: ${$idaa_sess.recovery_meetings.qry__status} event_id_random_li:`, event_id_random_li);
|
||||||
// console.log(`TEST SEARCH - search live query: ${$lq_kv__event_obj_li}`);
|
// console.log(`TEST SEARCH - search live query: ${$lq_kv__event_obj_li}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,12 +338,12 @@ if (browser) {
|
|||||||
let message = {'event_id': $idaa_slct?.event_id ?? null};
|
let message = {'event_id': $idaa_slct?.event_id ?? null};
|
||||||
window.parent.postMessage(message, "*");
|
window.parent.postMessage(message, "*");
|
||||||
|
|
||||||
add_activity_log(
|
// add_activity_log(
|
||||||
{
|
// {
|
||||||
action: 'idaa_meetings_page',
|
// action: 'idaa_meetings_page',
|
||||||
action_with: 'browser',
|
// action_with: 'browser',
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -468,17 +471,29 @@ function add_activity_log(
|
|||||||
show_edit_btn={true}
|
show_edit_btn={true}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Having this if statement seems to help with loading results. Especially new results. Unsure why... 2025-07-10 -->
|
||||||
<!-- {#if $lq_new__event_obj_li && $lq_new__event_obj_li?.length} -->
|
<!-- {#if $lq_new__event_obj_li && $lq_new__event_obj_li?.length} -->
|
||||||
<!-- lq__event_obj_li={lq_new__event_obj_li} -->
|
{#if Array.isArray(event_id_random_li) && event_id_random_li.length}
|
||||||
{#if event_id_random_li}
|
|
||||||
<Comp__event_obj_li_wrapper
|
<Comp__event_obj_li_wrapper
|
||||||
event_id_random_li={event_id_random_li}
|
event_id_random_li={event_id_random_li}
|
||||||
link_to_type={'account'}
|
link_to_type={'account'}
|
||||||
link_to_id={$slct.account_id}
|
link_to_id={$ae_loc.account_id}
|
||||||
log_lvl={log_lvl}
|
log_lvl={log_lvl}
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<p>No recovery meetings available to show.</p>
|
<div class="space-y-2">
|
||||||
|
{#if $idaa_sess.recovery_meetings.qry__status === 'loading'}
|
||||||
|
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center">
|
||||||
|
<span class="fas fa-spinner fa-spin m-1"></span>
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center">
|
||||||
|
No recovery meetings available to show. The search may need to be changed.
|
||||||
|
{$idaa_sess.recovery_meetings.qry__status ?? 'Unknown Query Status'}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ if (log_lvl) {
|
|||||||
|
|
||||||
$idaa_sess.recovery_meetings.edit__event_obj = null;
|
$idaa_sess.recovery_meetings.edit__event_obj = null;
|
||||||
$idaa_slct.event_id = ae_acct.slct.event_id;
|
$idaa_slct.event_id = ae_acct.slct.event_id;
|
||||||
$idaa_trig.event_id = ae_acct.slct.event_id;
|
// $idaa_trig.event_id = ae_acct.slct.event_id;
|
||||||
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +76,6 @@ if (browser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
log_lvl = 1;
|
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`Destroying recovery meetings page for event_id: ${$idaa_slct?.event_id}`);
|
console.log(`Destroying recovery meetings page for event_id: ${$idaa_slct?.event_id}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ if ($idaa_slct.event_id) {
|
|||||||
console.log(`Event Object selected: ${$lq__event_obj}`)
|
console.log(`Event Object selected: ${$lq__event_obj}`)
|
||||||
console.log(`Event Object name: ${$lq__event_obj?.name}`);
|
console.log(`Event Object name: ${$lq__event_obj?.name}`);
|
||||||
|
|
||||||
$slct_trigger = 'load__event_obj';
|
// $slct_trigger = 'load__event_obj';
|
||||||
$idaa_trig.event_id = $idaa_slct.event_id;
|
// $idaa_trig.event_id = $idaa_slct.event_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// $: if (browser && $lq__event_obj?.event_id) {
|
// $: if (browser && $lq__event_obj?.event_id) {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ let {
|
|||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
// *** Import Svelte specific
|
// *** Import Svelte specific
|
||||||
import { onMount } from 'svelte';
|
// import { onMount } from 'svelte';
|
||||||
import { Spinner } from 'flowbite-svelte';
|
// import { Spinner } from 'flowbite-svelte';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
// *** Import Aether specific variables and functions
|
// *** Import Aether specific variables and functions
|
||||||
@@ -35,12 +35,12 @@ if (browser) {
|
|||||||
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
add_activity_log(
|
// add_activity_log(
|
||||||
{
|
// {
|
||||||
action: 'idaa_meetings_page',
|
// action: 'idaa_meetings_page',
|
||||||
action_with: 'search',
|
// action_with: 'search',
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_activity_log(
|
function add_activity_log(
|
||||||
@@ -108,10 +108,11 @@ function add_activity_log(
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!-- {#if Array.isArray(event_id_random_li) && event_id_random_li.length} -->
|
||||||
{#if $lq__event_obj_li && $lq__event_obj_li.length}
|
{#if $lq__event_obj_li && $lq__event_obj_li.length}
|
||||||
<div class="overflow-auto space-y-2">
|
<div class="overflow-auto space-y-2">
|
||||||
<h2 class="h3">
|
<h2 class="h3">
|
||||||
<span class="text-base">
|
<span class="text-base text-gray-500">
|
||||||
Results:
|
Results:
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@@ -381,10 +382,16 @@ function add_activity_log(
|
|||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
<div class="space-y-2">
|
<div class="space-y-2">
|
||||||
{#if $idaa_loc.recovery_meetings.qry_status === 'loading'}
|
{#if $idaa_sess.recovery_meetings.qry__status === 'loading'}
|
||||||
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center"><Spinner class="me-3" /> Loading...</div>
|
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center">
|
||||||
|
<!-- <Spinner class="m-3" /> -->
|
||||||
|
<span class="fas fa-spinner fa-spin m-1"></span>
|
||||||
|
xx Loading...
|
||||||
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center"> No recovery meetings available to show. The search may need to be changed.</div>
|
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center">
|
||||||
|
xx No recovery meetings available to show. The search may need to be changed.
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -54,18 +54,48 @@ let dq__where_eq_id_val: string = link_to_id;
|
|||||||
|
|
||||||
// Functions and Logic
|
// Functions and Logic
|
||||||
let lq__event_obj_li = $derived(liveQuery(async () => {
|
let lq__event_obj_li = $derived(liveQuery(async () => {
|
||||||
if (event_id_random_li.length > 0) {
|
// Check if event_id_random_li is an array and has items
|
||||||
|
// if (Array.isArray(event_id_random_li)) { // && event_id_random_li.length > 0) {
|
||||||
|
if (event_id_random_li && event_id_random_li.length) {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Trying IDB bulkGet: ${event_id_random_li.length}`), event_id_random_li;
|
||||||
|
}
|
||||||
|
// if (!event_id_random_li.length) {
|
||||||
|
// return [];
|
||||||
|
// }
|
||||||
let results = await db_events.events
|
let results = await db_events.events
|
||||||
.bulkGet(event_id_random_li);
|
.bulkGet(event_id_random_li);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
} else if (link_to_type && link_to_id) {
|
} else if (link_to_type && link_to_id) {
|
||||||
let results = await db_events.events
|
if (log_lvl) {
|
||||||
.where(dq__where_type_id_val)
|
console.log(`Trying where: ${link_to_type}; equals: ${link_to_id}; event_id_random_li: ${event_id_random_li}`, event_id_random_li);
|
||||||
.equals(dq__where_eq_id_val)
|
}
|
||||||
// .sortBy('name')
|
let results: any = null;
|
||||||
.sortBy('updated_on')
|
if (order_by == 'name') {
|
||||||
// This should be sorted by a custom sort field
|
results = await db_events.events
|
||||||
|
.where(dq__where_type_id_val)
|
||||||
|
.equals(dq__where_eq_id_val)
|
||||||
|
.and((event) => {
|
||||||
|
return event.hide == false;
|
||||||
|
})
|
||||||
|
.and((event) => {
|
||||||
|
return event.enable == true;
|
||||||
|
})
|
||||||
|
.sortBy('name')
|
||||||
|
// This should be sorted by a custom sort field
|
||||||
|
} else {
|
||||||
|
results = await db_events.events
|
||||||
|
.where(dq__where_type_id_val)
|
||||||
|
.equals(dq__where_eq_id_val)
|
||||||
|
.and((event) => {
|
||||||
|
return event.hide == false;
|
||||||
|
})
|
||||||
|
.and((event) => {
|
||||||
|
return event.enable == true;
|
||||||
|
})
|
||||||
|
.sortBy('updated_on')
|
||||||
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
} else {
|
} else {
|
||||||
@@ -74,7 +104,7 @@ let lq__event_obj_li = $derived(liveQuery(async () => {
|
|||||||
}));
|
}));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if $lq__event_obj_li}
|
||||||
<Comp__event_obj_li
|
<Comp__event_obj_li
|
||||||
container_class_li={container_class_li}
|
container_class_li={container_class_li}
|
||||||
link_to_type={link_to_type}
|
link_to_type={link_to_type}
|
||||||
@@ -83,3 +113,15 @@ let lq__event_obj_li = $derived(liveQuery(async () => {
|
|||||||
log_lvl={log_lvl}
|
log_lvl={log_lvl}
|
||||||
>
|
>
|
||||||
</Comp__event_obj_li>
|
</Comp__event_obj_li>
|
||||||
|
{:else}
|
||||||
|
<div class="space-y-2">
|
||||||
|
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center">
|
||||||
|
<span class="fas fa-spinner fa-spin m-1"></span>
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ae_highlight ae_padding_md ae_row ae_flex_justify_center">
|
||||||
|
No recovery meetings available to show. The search may need to be changed.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
@@ -43,11 +43,6 @@ if ($idaa_loc.recovery_meetings?.save_search_text && $idaa_loc.recovery_meetings
|
|||||||
|
|
||||||
|
|
||||||
// Functions and Logic
|
// Functions and Logic
|
||||||
if (browser) {
|
|
||||||
$idaa_trig.event_li_qry = true;
|
|
||||||
// $idaa_trig = 'load__event_obj_li';
|
|
||||||
}
|
|
||||||
|
|
||||||
function preventDefault(fn) {
|
function preventDefault(fn) {
|
||||||
return function (event) {
|
return function (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@@ -441,20 +436,6 @@ function preventDefault(fn) {
|
|||||||
bind:value={$idaa_loc.recovery_meetings.qry__limit}
|
bind:value={$idaa_loc.recovery_meetings.qry__limit}
|
||||||
onchange={() => {
|
onchange={() => {
|
||||||
$idaa_trig.event_li_qry = true;
|
$idaa_trig.event_li_qry = true;
|
||||||
// search__event_presenter({
|
|
||||||
// api_cfg: $ae_api,
|
|
||||||
// event_id: $events_slct.event_id,
|
|
||||||
// agree: true,
|
|
||||||
// biography: null,
|
|
||||||
// ft_search_str: '',
|
|
||||||
// lk_search_str: '',
|
|
||||||
// params: {
|
|
||||||
// 'qry__enabled': 'enabled',
|
|
||||||
// 'qry__hidden': 'not_hidden',
|
|
||||||
// 'qry__limit': $idaa_loc.recovery_meetings.qry__limit__events,},
|
|
||||||
// try_cache: false,
|
|
||||||
// log_lvl: log_lvl,
|
|
||||||
// });
|
|
||||||
}}
|
}}
|
||||||
class="
|
class="
|
||||||
select w-20 text-sm inline-block
|
select w-20 text-sm inline-block
|
||||||
@@ -490,11 +471,11 @@ function preventDefault(fn) {
|
|||||||
bind:value={$idaa_loc.recovery_meetings.qry__order_by}
|
bind:value={$idaa_loc.recovery_meetings.qry__order_by}
|
||||||
onchange={() => {
|
onchange={() => {
|
||||||
if ($idaa_loc.recovery_meetings.qry__order_by == 'updated_on') {
|
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 = 'updated_on'; // For the IDB index query
|
||||||
$idaa_loc.recovery_meetings.qry__order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'};
|
$idaa_loc.recovery_meetings.qry__order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}; // For the SQL query
|
||||||
} else {
|
} else {
|
||||||
$idaa_loc.recovery_meetings.qry__order_by = 'name';
|
$idaa_loc.recovery_meetings.qry__order_by = 'name'; // For the IDB index query
|
||||||
$idaa_loc.recovery_meetings.qry__order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'};
|
$idaa_loc.recovery_meetings.qry__order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}; // For the SQL query
|
||||||
}
|
}
|
||||||
$idaa_trig.event_li_qry = true;
|
$idaa_trig.event_li_qry = true;
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user