Bug fix for IDAA Archive Content edit button. Updates related to new Launcher.

This commit is contained in:
Scott Idem
2025-07-22 15:56:07 -04:00
parent 7d07879e21
commit 1e94043e19
6 changed files with 256 additions and 246 deletions

View File

@@ -76,11 +76,12 @@ let ae_promises: key_val = $state({
</script>
<section
<div
class="
flex flex-col gap-1 items-center justify-center
text-center
w-full max-w-full
event_launcher_menu
shrink h-full w-full max-w-full
flex flex-col flex-wrap gap-1 items-center justify-start
overflow-x-clip
"
>
@@ -88,7 +89,7 @@ let ae_promises: key_val = $state({
{#if $lq__event_event_file_obj_li}
<div class="w-full text-center">
<div class="w-full">
<!-- <div class="text-xs text-neutral-800/80">
<strong>
Event Files:
@@ -128,143 +129,149 @@ let ae_promises: key_val = $state({
{#if $ae_loc.edit_mode}
{#if $lq__event_location_obj_li && $lq__event_location_obj_li.length > 0}
<div class="text-xs text-neutral-800/80"><strong>
Locations:
{#if $ae_loc.administrator_access}
({$lq__event_location_obj_li?.length}&times;)
<div
class="
w-full max-w-full
flex flex-row gap-1 items-center justify-center
"
>
{#if $lq__event_location_obj_li && $lq__event_location_obj_li.length > 0}
<div class="text-xs text-neutral-800/80"><strong>
Location:
{#if $ae_loc.administrator_access}
({$lq__event_location_obj_li?.length}&times;)
{/if}
<!-- This should fade out once the data is loaded. -->
{#await ae_promises[slct_event_location_id]}
<span class="fas fa-spinner fa-spin text-blue-500"></span>
{:then result}
<span class="fas fa-check text-green-500/80"></span>
{/await}
</strong></div>
<select
class="select text-xs p-1 w-42"
bind:value={slct_event_location_id}
onchange={async () => {
// console.log(`slct_event_location_id:`, slct_event_location_id);
console.log('Remove fields from the URL.');
// data_url.searchParams.delete('location_id');
data_url.searchParams.delete('presentation_id');
data_url.searchParams.delete('presenter_id');
data_url.searchParams.delete('session_id');
// let url_location_id = slct_event_location_id;
// data_url.searchParams.set('location_id', url_location_id);
let new_url = `/events/${$events_slct.event_id}/launcher`;
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;
$events_slct.id_li__event_session = [];
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: 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,
})
.then(async function (load_results) {
console.log(`load_results = `, load_results);
let event_session_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_session_obj = load_results[i];
let event_session_id_random = event_session_obj.event_session_id_random;
tmp_li.push(event_session_id_random);
}
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;
return load_results;
});
new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
} else {
// This will hide the selected session if the location is changed to false.
// WARNING: This may need to be commented out later.
// slct_event_session_id = null;
$events_loc.launcher.slct.event_location_id = null;
$events_slct.event_location_id = null;
$events_loc.launcher.slct.event_session_id = null;
$events_slct.event_session_id = null;
// WARNING: This may need to be commented out later.
}
goto(new_url, {replaceState: true});
// goto(new_url, {replaceState: false});
}}
>
<option value="">Select a location</option>
{#each $lq__event_location_obj_li as event_location_obj}
<option
value={event_location_obj?.id}
>
{event_location_obj?.name}
</option>
{/each}
</select>
{:else}
<div class="text-sm">
No locations found.
(Event ID: {$lq__event_obj?.id})
</div>
{/if}
<!-- This should fade out once the data is loaded. -->
{#await ae_promises[slct_event_location_id]}
<span class="fas fa-spinner fa-spin text-blue-500"></span>
{:then result}
<span class="fas fa-check text-green-500/80"></span>
{/await}
</strong></div>
<select
class="select text-xs p-1"
bind:value={slct_event_location_id}
onchange={async () => {
// console.log(`slct_event_location_id:`, slct_event_location_id);
console.log('Remove fields from the URL.');
// data_url.searchParams.delete('location_id');
data_url.searchParams.delete('presentation_id');
data_url.searchParams.delete('presenter_id');
data_url.searchParams.delete('session_id');
// let url_location_id = slct_event_location_id;
// data_url.searchParams.set('location_id', url_location_id);
let new_url = `/events/${$events_slct.event_id}/launcher`;
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;
$events_slct.id_li__event_session = [];
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: 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,
})
.then(async function (load_results) {
console.log(`load_results = `, load_results);
let event_session_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_session_obj = load_results[i];
let event_session_id_random = event_session_obj.event_session_id_random;
tmp_li.push(event_session_id_random);
}
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;
return load_results;
});
new_url = `/events/${$events_slct.event_id}/launcher/${$events_slct.event_location_id}`;
} else {
// This will hide the selected session if the location is changed to false.
// WARNING: This may need to be commented out later.
// slct_event_session_id = null;
$events_loc.launcher.slct.event_location_id = null;
$events_slct.event_location_id = null;
$events_loc.launcher.slct.event_session_id = null;
$events_slct.event_session_id = null;
// WARNING: This may need to be commented out later.
}
goto(new_url, {replaceState: true});
// goto(new_url, {replaceState: false});
}}
>
<option value="">Select a location</option>
{#each $lq__event_location_obj_li as event_location_obj}
<option
value={event_location_obj?.id}
>
{event_location_obj?.name}
</option>
{/each}
</select>
{:else}
<div class="text-sm">
No locations found.
(Event ID: {$lq__event_obj?.id})
</div>
{/if}
{/if}
{#if $lq__location_event_file_obj_li}
<div class="w-full text-center">
{#each $lq__location_event_file_obj_li as event_file_obj, index}
<button
disabled={!$ae_loc.trusted_access}
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,
hosted_file_id: event_file_obj?.hosted_file_id_random,
return_file: true,
filename: event_file_obj?.filename,
auto_download: true,
log_lvl: 0
});
}}
class="
btn btn-sm
text-xs w-full
preset-tonal-primary
hover:preset-tonal-success
transition-all
"
>
<span class="fas fa-file-archive m-1 text-neutral-800/80"></span>
{event_file_obj?.filename}
</button>
{/each}
<div class="w-full">
{#each $lq__location_event_file_obj_li as event_file_obj, index}
<button
disabled={!$ae_loc.trusted_access}
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,
hosted_file_id: event_file_obj?.hosted_file_id_random,
return_file: true,
filename: event_file_obj?.filename,
auto_download: true,
log_lvl: 0
});
}}
class="
btn btn-sm
text-xs w-full
preset-tonal-primary
hover:preset-tonal-success
transition-all
"
>
<span class="fas fa-file-archive m-1 text-neutral-800/80"></span>
{event_file_obj?.filename}
</button>
{/each}
</div>
{/if}
</section>
<section class="text-center w-full max-w-full">
<!-- <div class="w-full"> -->
{#if $lq__event_session_obj_li}
<Menu_session_list_menu
@@ -273,10 +280,15 @@ let ae_promises: key_val = $state({
/>
{/if}
</section>
<!-- </div> -->
{#if $ae_loc.edit_mode}
<section class="flex flex-row gap-2 items-center justify-center w-full max-w-full">
<div
class="
w-full max-w-full
flex flex-row gap-1 items-center justify-center
"
>
<button
onclick={() => {
$events_loc.launcher.show_content__hidden_files = !$events_loc.launcher.show_content__hidden_files;
@@ -320,5 +332,8 @@ let ae_promises: key_val = $state({
All Sessions
{/if}
</button>
</section>
{/if}
</div>
{/if}
</div>