Improved styling. Less debug. Other clean up.

This commit is contained in:
Scott Idem
2024-11-12 14:13:51 -05:00
parent 1e1a4f1016
commit fedbbe9ae2
6 changed files with 63 additions and 29 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
/** @type {import('./$types').PageData} */
export let data: any;
let log_lvl = 2;
let log_lvl = 1;
// console.log(`ae_events_pres_mgmt event [event_id] +page.svelte data:`, data);
import { browser } from '$app/environment';
@@ -41,25 +41,39 @@ $: lq__event_obj = liveQuery(async () => {
$: lq_new__event_obj_li = liveQuery(async () => {
let link_to_type: string = 'account';
let link_to_id: string = $slct.account_id;
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
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);
}
// Check if event_id_random_li is an array and not undefined
if (event_id_random_li) {
console.log(`Trying bulkGet:`, event_id_random_li);
if (log_lvl) {
console.log(`Trying bulkGet:`, event_id_random_li);
}
let results = await db_events.events
.bulkGet(event_id_random_li);
return results;
} else if (link_to_type && link_to_id) {
console.log(`Trying where: ${link_to_type}; equals: ${link_to_id}`);
if (log_lvl) {
console.log(`Trying where: ${link_to_type}; equals: ${link_to_id}`);
}
let results = await db_events.events
.where(`${link_to_type}_id`)
.equals(link_to_id)
.and((event) => {
return event.hide == false;
})
.and((event) => {
return event.enable == true;
})
.sortBy('name')
return results;
} else {
console.log('Trying... Nothing to load');
if (log_lvl) {
console.log('Trying... Nothing to load');
}
return null;
}
});