Saving before working on the event_file functions
This commit is contained in:
@@ -82,20 +82,17 @@ export async function load_ae_obj_li__event_file(
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_li__event_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_li__event_file() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
|
||||
}
|
||||
|
||||
// Check if for_obj_type is in the list of valid Aether object types:
|
||||
let valid_for_obj_types = ['event', 'event_session', 'event_presentation', 'event_presenter', 'event_location'];
|
||||
let valid_for_obj_types = ['event', 'event_session', 'event_presentation', 'event_presenter', 'event_location', 'event_badge', 'event_device'];
|
||||
if (!valid_for_obj_types.includes(for_obj_type)) {
|
||||
console.log(`Invalid for_obj_type: ${for_obj_type}`);
|
||||
return [];
|
||||
}
|
||||
|
||||
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||
// let hidden: string = (params.qry__hidden ?? 'all'); // all, hidden, not_hidden
|
||||
// let limit: number = (params.qry__limit ?? 99); // 99
|
||||
// let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
|
||||
@@ -26,13 +26,16 @@ let {
|
||||
// *** Import Svelte specific
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
// import { liveQuery } from "dexie";
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
// import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { api } from '$lib/api';
|
||||
// import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||
|
||||
// import { liveQuery } from "dexie";
|
||||
// import { core_func } from '$lib/ae_core_functions';
|
||||
// import { db_core } from "$lib/db_core";
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
@@ -45,6 +48,9 @@ import Menu_session_list_menu from './menu_session_list.svelte';
|
||||
|
||||
let slct_event_location_id: string = $state($events_slct.event_location_id);
|
||||
|
||||
|
||||
// *** Functions and Logic
|
||||
|
||||
$events_trigger = null;
|
||||
|
||||
|
||||
@@ -76,14 +82,22 @@ let ae_promises: key_val = $state({
|
||||
onclick={() => {
|
||||
$events_loc.launcher.show_content__hidden_files = !$events_loc.launcher.show_content__hidden_files;
|
||||
}}
|
||||
class="btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-primary-500 text-xs py-1 px-2"
|
||||
class="
|
||||
btn btn-sm
|
||||
text-xs
|
||||
py-1 px-2
|
||||
preset-outlined-warning-200-800 preset-filled-warning-50-950
|
||||
hover:preset-outlined-success-200-800 hover:preset-filled-success-100-900
|
||||
w-1/2
|
||||
transition-all
|
||||
"
|
||||
>
|
||||
{#if $events_loc.launcher.show_content__hidden_files}
|
||||
<span class="fas fa-eye-slash m-1"></span>
|
||||
Hide Files
|
||||
{:else}
|
||||
<span class="fas fa-eye m-1"></span>
|
||||
Hidden Files?
|
||||
All Files?
|
||||
{/if}
|
||||
|
||||
</button>
|
||||
@@ -91,14 +105,22 @@ let ae_promises: key_val = $state({
|
||||
onclick={() => {
|
||||
$events_loc.launcher.show_content__hidden_sessions = !$events_loc.launcher.show_content__hidden_sessions;
|
||||
}}
|
||||
class="btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-primary-500 text-xs py-1 px-2"
|
||||
class="
|
||||
btn btn-sm
|
||||
text-xs
|
||||
py-1 px-2
|
||||
preset-outlined-warning-200-800 preset-filled-warning-50-950
|
||||
hover:preset-outlined-success-200-800 hover:preset-filled-success-100-900
|
||||
w-1/2
|
||||
transition-all
|
||||
"
|
||||
>
|
||||
{#if $events_loc.launcher.show_content__hidden_sessions}
|
||||
<span class="fas fa-eye-slash m-1"></span>
|
||||
Hide Sessions
|
||||
{:else}
|
||||
<span class="fas fa-eye m-1"></span>
|
||||
Hidden Sessions?
|
||||
All Sessions?
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
@@ -135,36 +157,18 @@ let ae_promises: key_val = $state({
|
||||
if (slct_event_location_id) {
|
||||
$events_loc.launcher.slct.event_location_id = slct_event_location_id;
|
||||
$events_slct.event_location_id = slct_event_location_id;
|
||||
// console.log(`$events_loc.launcher.slct.event_location_id:`, $events_loc.launcher.slct.event_location_id);
|
||||
// data_url.searchParams.set('location_id', slct_event_location_id);
|
||||
// await tick();
|
||||
|
||||
// $events_slct.event_location_id = slct_event_location_id;
|
||||
|
||||
// dq__where_type_id_val = 'event_location_id';
|
||||
// dq__where_eq_id_val = slct_event_location_id;
|
||||
|
||||
// $events_loc.launcher.slct.event_location_id = null;
|
||||
// await tick();
|
||||
// $events_loc.launcher.slct.event_location_id = slct_event_location_id;
|
||||
// await tick();
|
||||
|
||||
// $slct.event_location_id = slct_event_location_id;
|
||||
// $slct_trigger = 'event_location_li';
|
||||
|
||||
|
||||
// $events_trigger = 'event_location_li';
|
||||
|
||||
$events_slct.id_li__event_session = [];
|
||||
// await tick();
|
||||
|
||||
ae_promises[slct_event_location_id] = events_func.load_ae_obj_li__event_session({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_type: 'event_location',
|
||||
for_obj_id: $events_slct.event_location_id,
|
||||
inc_file_li: false,
|
||||
inc_presentation_li: false,
|
||||
enabled: 'enabled',
|
||||
hidden: 'all',
|
||||
inc_file_li: true,
|
||||
inc_presentation_li: true,
|
||||
inc_presenter_li: true,
|
||||
enabled: $events_loc.launcher.show_content__enabled_sessions ? 'all' : 'enabled',
|
||||
hidden: $events_loc.launcher.show_content__hidden_sessions ? 'all' : 'not_hidden',
|
||||
limit: 49,
|
||||
try_cache: true,
|
||||
log_lvl: 1,
|
||||
@@ -184,43 +188,9 @@ let ae_promises: key_val = $state({
|
||||
event_session_id_li = tmp_li;
|
||||
console.log(`event_session_id_li:`, event_session_id_li);
|
||||
$events_slct.id_li__event_session = event_session_id_li;
|
||||
// $events_slct = {...$events_slct};
|
||||
// await tick();
|
||||
|
||||
return load_results;
|
||||
})
|
||||
.finally(async () => {
|
||||
// This will hide the selected session if the location is changed to false.
|
||||
// WARNING: This may need to be commented out later.
|
||||
// $events_loc.launcher.slct.event_session_id = null;
|
||||
// await tick();
|
||||
// $events_loc.launcher.slct.event_session_id = event_session_obj?.id;
|
||||
// await tick();
|
||||
|
||||
// $events_slct.event_session_id = event_session_obj?.id;
|
||||
// $events_slct.event_session_obj = event_session_obj;
|
||||
|
||||
// ae_promises.slct_event_session_id = events_func.load_ae_obj_id__event_session({
|
||||
// api_cfg: $ae_api,
|
||||
// event_session_id: event_session_obj?.id,
|
||||
// inc_file_li: true,
|
||||
// inc_presentation_li: true,
|
||||
// try_cache: true,
|
||||
// log_lvl: 1
|
||||
// })
|
||||
// .then(async (load_results) => {
|
||||
// console.log(`load_results = `, load_results);
|
||||
|
||||
// let new_url = data_url.toString();
|
||||
// console.log(new_url);
|
||||
// events/UFu-gF-rZ-ws/launcher/XB6wmasQN6E?
|
||||
// let new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
|
||||
// goto(new_url, {replaceState: true});
|
||||
});
|
||||
// let new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
|
||||
// goto(new_url, {replaceState: true});
|
||||
// await tick();
|
||||
|
||||
new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
|
||||
|
||||
} else {
|
||||
@@ -233,10 +203,7 @@ let ae_promises: key_val = $state({
|
||||
$events_slct.event_session_id = null;
|
||||
// WARNING: This may need to be commented out later.
|
||||
}
|
||||
// let new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
|
||||
goto(new_url, {replaceState: true});
|
||||
// let new_url = data_url.toString()
|
||||
// console.log(new_url);
|
||||
// goto(new_url, {replaceState: false});
|
||||
}}
|
||||
>
|
||||
@@ -271,10 +238,10 @@ let ae_promises: key_val = $state({
|
||||
log_lvl: 0
|
||||
});
|
||||
}}
|
||||
class="btn btn-sm preset-tonal-primary border border-primary-500 hover:preset-filled-primary-500 text-xs py-1 px-2"
|
||||
class="btn btn-sm preset-tonal-primary border border-primary-500 hover:preset-filled-primary-500 text-xs py-1 px-2 w-full"
|
||||
>
|
||||
<span class="fas fa-file-archive m-1"></span>
|
||||
{event_file_obj?.filename}
|
||||
{event_file_obj?.filename}aa
|
||||
</button>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
@@ -3,9 +3,14 @@ interface Props {
|
||||
data_url: any;
|
||||
// export let lq__event_session_obj: any;
|
||||
lq__event_session_obj_li: any;
|
||||
log_lvl?: number;
|
||||
}
|
||||
|
||||
let { data_url, lq__event_session_obj_li }: Props = $props();
|
||||
let {
|
||||
data_url,
|
||||
lq__event_session_obj_li,
|
||||
log_lvl = $bindable(0),
|
||||
}: Props = $props();
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { goto } from '$app/navigation';
|
||||
@@ -14,7 +19,6 @@ import { tick } from 'svelte';
|
||||
|
||||
// *** 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';
|
||||
@@ -81,8 +85,8 @@ let hover_timer: any = $state(null);
|
||||
event_session_id: event_session_obj?.id,
|
||||
inc_file_li: true,
|
||||
inc_presentation_li: true,
|
||||
try_cache: true,
|
||||
log_lvl: 1
|
||||
inc_presenter_li: true,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(async (load_results) => {
|
||||
console.log(`load_results = `, load_results);
|
||||
@@ -111,8 +115,8 @@ let hover_timer: any = $state(null);
|
||||
event_session_id: event_session_obj?.id,
|
||||
inc_file_li: true,
|
||||
inc_presentation_li: true,
|
||||
try_cache: true,
|
||||
log_lvl: 1
|
||||
inc_presenter_li: true,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(async (load_results) => {
|
||||
console.log(`load_results = `, load_results);
|
||||
@@ -128,46 +132,6 @@ let hover_timer: any = $state(null);
|
||||
$events_sess.launcher.controller_cmd = `ae_load:event_session=${event_session_obj?.id}`;
|
||||
$events_sess.launcher.controller_trigger_send = true;
|
||||
}
|
||||
|
||||
|
||||
// await tick();
|
||||
|
||||
// ae_promises.slct_event_presentation_li = await events_func.load_ae_obj_li__event_presentation({
|
||||
// api_cfg: $ae_api,
|
||||
// event_session_id: event_session_obj?.id,
|
||||
// try_cache: true,
|
||||
// log_lvl: 1
|
||||
// })
|
||||
// .then(async (load_results) => {
|
||||
// console.log(`load_results = `, load_results);
|
||||
|
||||
// let event_presentation_id_li = [];
|
||||
|
||||
// let tmp_li = []; // This is to prevent the array from constantly updating and triggering the liveQuery.
|
||||
|
||||
// for (let i = 0; i < load_results.length; i++) {
|
||||
// let event_presentation_obj = load_results[i];
|
||||
// let event_presentation_id_random = event_presentation_obj.event_presentation_id_random;
|
||||
// tmp_li.push(event_presentation_id_random);
|
||||
// }
|
||||
// event_presentation_id_li = tmp_li;
|
||||
// console.log(`event_presentation_id_li:`, event_presentation_id_li);
|
||||
// $events_slct.id_li__event_presentation = event_presentation_id_li;
|
||||
|
||||
// data_url.searchParams.set('presentation_li', event_presentation_id_li);
|
||||
|
||||
// // let new_url = data_url.toString();
|
||||
// // console.log(new_url);
|
||||
// // goto(new_url, {replaceState: false});
|
||||
|
||||
// // return load_results;
|
||||
|
||||
// });
|
||||
|
||||
// await tick();
|
||||
// let new_url = data_url.toString();
|
||||
// console.log(new_url);
|
||||
// goto(new_url, {replaceState: false});
|
||||
}}
|
||||
class="btn btn-sm hover:preset-filled-primary-500 overflow-hidden text-sm w-full max-w-full text-left transition-all rounded-md flex flex-row justify-between items-center"
|
||||
class:preset-filled-primary-500={$events_slct.event_session_id === event_session_obj?.id}
|
||||
|
||||
Reference in New Issue
Block a user