Saving work on reports. Trying separate out the session specific reports.
This commit is contained in:
@@ -1,4 +1,31 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
// Exports
|
||||
container_class_li?: string|Array<string>;
|
||||
event_file_id_random_li?: Array<string>;
|
||||
allow_basic?: boolean;
|
||||
allow_moderator?: boolean;
|
||||
// export let max_records: number = 100;
|
||||
show_direct_download?: boolean;
|
||||
show_location_fields?: boolean;
|
||||
show_presentation_fields?: boolean;
|
||||
// export let show_presenter_fields: boolean = false;
|
||||
show_session_fields?: boolean;
|
||||
hide_session_code?: boolean;
|
||||
}
|
||||
|
||||
let {
|
||||
container_class_li = [],
|
||||
event_file_id_random_li = [],
|
||||
allow_basic = false,
|
||||
allow_moderator = false,
|
||||
show_direct_download = false,
|
||||
show_location_fields = false,
|
||||
show_presentation_fields = false,
|
||||
show_session_fields = false,
|
||||
hide_session_code = false
|
||||
}: Props = $props();
|
||||
|
||||
// Imports
|
||||
import { liveQuery } from "dexie";
|
||||
|
||||
@@ -12,35 +39,41 @@ import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$
|
||||
// import { events_func } from '$lib/ae_events_functions';
|
||||
import MyClipboard from '$lib/e_app_clipboard.svelte';
|
||||
|
||||
// Exports
|
||||
export let container_class_li: string|Array<string> = [];
|
||||
export let event_file_id_random_li: Array<string> = [];
|
||||
export let allow_basic: boolean = false;
|
||||
export let allow_moderator: boolean = false;
|
||||
// export let max_records: number = 100;
|
||||
export let show_direct_download: boolean = false;
|
||||
export let show_location_fields: boolean = false;
|
||||
export let show_presentation_fields: boolean = false;
|
||||
// export let show_presenter_fields: boolean = false;
|
||||
export let show_session_fields: boolean = false;
|
||||
|
||||
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||
|
||||
// Variables
|
||||
let ae_promises: key_val = {};
|
||||
let ae_promises: key_val = $state({});
|
||||
|
||||
// *** Functions and Logic
|
||||
// let lq__event_file_obj = liveQuery(
|
||||
// () => db_events.files.get($events_slct.event_file_id)
|
||||
// );
|
||||
|
||||
let lq_kv__event_file_obj_li = liveQuery(
|
||||
() => db_events.files
|
||||
.bulkGet(event_file_id_random_li)
|
||||
);
|
||||
let lq_kv__event_file_obj_li = $derived(liveQuery(async () => {
|
||||
// let lq_kv__event_file_obj_li = liveQuery(
|
||||
let results = await db_events.files
|
||||
.bulkGet(event_file_id_random_li);
|
||||
|
||||
return results;
|
||||
}));
|
||||
|
||||
// Define the list of unacceptable characters if not using the default.
|
||||
// const unacceptable_chars = /[ <>:"/\\|?*]/g;
|
||||
|
||||
let horiz_scroll_warning: boolean = $state(false);
|
||||
let horiz_check_element: HTMLElement|null = $state(null);
|
||||
|
||||
// Check if element is scrolling horizontally
|
||||
$effect(() => {
|
||||
if (horiz_check_element && horiz_check_element.scrollWidth > horiz_check_element.offsetWidth) {
|
||||
horiz_scroll_warning = true;
|
||||
// console.log('Element is too wide for the container. Horizontal scrolling detected.');
|
||||
} else {
|
||||
horiz_scroll_warning = false;
|
||||
// console.log('Element fits within the container. No horizontal scrolling.', horiz_check_element);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -49,7 +82,14 @@ let lq_kv__event_file_obj_li = liveQuery(
|
||||
|
||||
{#if event_file_id_random_li && $lq_kv__event_file_obj_li && $lq_kv__event_file_obj_li?.length > 0 && $lq_kv__event_file_obj_li?.length == event_file_id_random_li?.length}
|
||||
|
||||
<div class="overflow-auto space-y-2">
|
||||
<div
|
||||
bind:this={horiz_check_element}
|
||||
id="tbl_container"
|
||||
class="overflow-auto space-y-2"
|
||||
class:border-r-2={horiz_scroll_warning}
|
||||
class:border-dashed={horiz_scroll_warning}
|
||||
class:border-warning-900-100={horiz_scroll_warning}
|
||||
>
|
||||
<h2 class="h3">
|
||||
<span class="text-base">
|
||||
Results:
|
||||
@@ -67,6 +107,7 @@ let lq_kv__event_file_obj_li = liveQuery(
|
||||
</h2>
|
||||
|
||||
<table
|
||||
|
||||
class="table table-auto table-striped w-full text-xs lg:text-sm"
|
||||
>
|
||||
<thead
|
||||
@@ -89,6 +130,9 @@ let lq_kv__event_file_obj_li = liveQuery(
|
||||
<th class="px-4 py-2">Location</th>
|
||||
{/if}
|
||||
{#if show_session_fields}
|
||||
<th class="px-4 py-2" class:hidden={hide_session_code}>
|
||||
Code
|
||||
</th>
|
||||
<th class="px-4 py-2">
|
||||
Session
|
||||
</th>
|
||||
@@ -115,7 +159,7 @@ let lq_kv__event_file_obj_li = liveQuery(
|
||||
|
||||
<button
|
||||
disabled={!allow_basic && !allow_moderator && !$ae_loc.trusted_access}
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
// ae_promises[event_file_obj?.event_file_id_random]
|
||||
ae_promises[event_file_obj?.event_file_id_random] = api.download_hosted_file({
|
||||
api_cfg: $ae_api,
|
||||
|
||||
Reference in New Issue
Block a user