Everything is working except for the file uploads
This commit is contained in:
@@ -26,6 +26,7 @@ import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_ev
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
import Form_agree from './form_agree.svelte';
|
||||
import Presenter_view from './presenter_view.svelte';
|
||||
|
||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||
$slct.account_id = data.account_id;
|
||||
@@ -106,6 +107,10 @@ let lq__event_presenter_obj = liveQuery(
|
||||
|
||||
$events_slct.event_presenter_obj = $lq__event_presenter_obj;
|
||||
|
||||
let lq__event_file_obj_li = liveQuery(
|
||||
() => db_events.files.where('event_session_id_random').equals($events_slct.event_session_id).toArray()
|
||||
);
|
||||
|
||||
// Load the Event Obj with ID based on the slug param.
|
||||
// $events_slct.event_id = param_slug_event_id;
|
||||
// console.log('Selected Event ID:', $events_slct.event_id);
|
||||
@@ -331,14 +336,14 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
console.log('Show/Hide Description');
|
||||
$events_loc.pres_mgmt.show_content__session_description = !$events_loc.pres_mgmt.show_content__session_description;
|
||||
}}
|
||||
class="btn btn-sm variant-soft-surface hover:variant-filled-surface"
|
||||
class="btn btn-sm variant-soft-surface hover:variant-filled-surface text-xs"
|
||||
>
|
||||
{#if $events_loc.pres_mgmt.show_content__session_description}
|
||||
<span class="fas fa-eye-slash mx-1"></span>
|
||||
<span class="text-xs">Hide Description</span>
|
||||
<span>Hide Description</span>
|
||||
{:else}
|
||||
<span class="fas fa-eye mx-1"></span>
|
||||
<span class="text-xs">Show</span>
|
||||
<span>Show</span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
@@ -580,14 +585,14 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
$events_loc.pres_mgmt.show_content__presentation_description = event_presentation_obj.event_presentation_id_random;
|
||||
}
|
||||
}}
|
||||
class="btn btn-sm variant-soft-surface hover:variant-filled-surface"
|
||||
class="btn btn-sm variant-soft-surface hover:variant-filled-surface text-xs"
|
||||
>
|
||||
{#if $events_loc.pres_mgmt.show_content__presentation_description == event_presentation_obj.event_presentation_id_random}
|
||||
<span class="fas fa-eye-slash mx-1"></span>
|
||||
<span class="text-xs">Hide Description</span>
|
||||
<span>Hide Description</span>
|
||||
{:else}
|
||||
<span class="fas fa-eye mx-1"></span>
|
||||
<span class="text-xs">Show</span>
|
||||
<span>Show</span>
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
@@ -610,7 +615,7 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
disabled={!$ae_loc.trusted_access && !$events_loc.auth__kv.presenter[event_presenter_obj.event_presenter_id_random]}
|
||||
disabled={!$ae_loc.trusted_access && (!$events_loc.auth__kv.presenter[event_presenter_obj.event_presenter_id_random] || !event_presenter_obj.agree)}
|
||||
on:click={
|
||||
() => {
|
||||
console.log('View presenter details');
|
||||
@@ -727,11 +732,11 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
|
||||
|
||||
{#if $ae_loc.trusted_access && event_presenter_obj.email}
|
||||
<span class="fas fa-envelope"></span>
|
||||
<!-- <span class="fas fa-envelope"></span>
|
||||
<a
|
||||
href="mailto:{event_presenter_obj.email}"
|
||||
class="text-blue-500"
|
||||
>{event_presenter_obj.email}</a>
|
||||
>{event_presenter_obj.email}</a> -->
|
||||
|
||||
|
||||
{#if event_presenter_obj.agree}
|
||||
@@ -741,19 +746,19 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
{#if event_presenter_obj.person_passcode}
|
||||
<!-- {#if event_presenter_obj.person_passcode}
|
||||
<span>
|
||||
<span class="fas fa-user-secret"></span>
|
||||
Passcode: {event_presenter_obj.person_passcode}
|
||||
</span>
|
||||
{/if}
|
||||
{/if} -->
|
||||
|
||||
{#if event_presenter_obj.passcode}
|
||||
<!-- {#if event_presenter_obj.passcode}
|
||||
<span class="bg-red-100 p-1 rounded-md">
|
||||
<span class="fas fa-key"></span>
|
||||
Passcode: {event_presenter_obj.passcode}
|
||||
</span>
|
||||
{/if}
|
||||
{/if} -->
|
||||
{:else}
|
||||
{/if}
|
||||
|
||||
@@ -791,8 +796,59 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
<p>Error: {error.message}</p>
|
||||
{/await}
|
||||
|
||||
{#if $lq__event_file_obj_li && $lq__event_file_obj_li.length > 0}
|
||||
|
||||
<strong class="text-sm">Files:</strong>
|
||||
<ul
|
||||
class="space-y-2 px-4"
|
||||
>
|
||||
{#each $lq__event_file_obj_li as event_file_obj}
|
||||
{#if (event_file_obj.event_presentation_id_random == event_presentation_obj.event_presentation_id_random && ($ae_loc.trusted_access || $events_loc.auth__kv.presentation[event_presentation_obj.event_presentation_id_random]))}
|
||||
<li>
|
||||
<button
|
||||
class="btn btn-md variant-soft-primary"
|
||||
on:click={() => {
|
||||
// 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: 1
|
||||
});
|
||||
|
||||
// window.postMessage({ type: 'download_event_file', event_file_id: event_file_obj.event_file_id_random, filename: event_file_obj.filename, auto_download: true }, '*');
|
||||
}}
|
||||
title={`Download this file: ${event_file_obj.filename} [API] -- SHA256 hash: ${event_file_obj.hash_sha256.slice(0, 10)}...`}
|
||||
>
|
||||
{#await ae_promises[event_file_obj.event_file_id_random]}
|
||||
|
||||
<span class="mx-1">
|
||||
<span class="fas fa-spinner fa-spin mx-1"></span>
|
||||
|
||||
Downloading
|
||||
|
||||
{#if $ae_sess.download[`/hosted_file/${event_file_obj.hosted_file_id_random}/download`]}
|
||||
{$ae_sess.download[`/hosted_file/${event_file_obj.hosted_file_id_random}/download`].percent_completed}%
|
||||
{/if}
|
||||
:
|
||||
</span>
|
||||
{:then}
|
||||
<span class="fas fa-download mx-1"></span>
|
||||
Download:
|
||||
{/await}
|
||||
|
||||
{event_file_obj.filename.slice(0, 20)}...{event_file_obj.extension}
|
||||
</button>
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
<!-- Show files list for this presentation -->
|
||||
{#await event_presentation_obj.event_file_li}
|
||||
<!-- {#await event_presentation_obj.event_file_li}
|
||||
<p>Loading...</p>
|
||||
{:then event_file_li}
|
||||
{#if event_file_li}
|
||||
@@ -813,7 +869,7 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
{/if}
|
||||
{:catch error}
|
||||
<p>Error: {error.message}</p>
|
||||
{/await}
|
||||
{/await} -->
|
||||
|
||||
</li>
|
||||
{/each}
|
||||
@@ -844,7 +900,7 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
<!-- </div> -->
|
||||
|
||||
<section class="ae_modal_scrollfix">
|
||||
<button
|
||||
<button
|
||||
on:click={
|
||||
() => {
|
||||
$events_loc.pres_mgmt.show_content__agree_text = null;
|
||||
@@ -856,8 +912,7 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
Close
|
||||
</button>
|
||||
|
||||
<Form_agree />
|
||||
|
||||
<Form_agree />
|
||||
</section>
|
||||
|
||||
<!-- <div class="h-12"> -->
|
||||
@@ -884,6 +939,8 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
<div class="ae_quick_modal_container">
|
||||
<section class="ae_quick_popover">
|
||||
|
||||
<div class="flex flex-col items-center">
|
||||
|
||||
<section class="ae_modal_scrollfix">
|
||||
<button
|
||||
on:click={
|
||||
@@ -897,93 +954,8 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
Close
|
||||
</button>
|
||||
|
||||
<h2 class="h3">
|
||||
Presenter Details for:<br>
|
||||
<strong>{$events_slct.presenter_obj.full_name} ({$events_slct.presenter_obj.email})</strong>
|
||||
</h2>
|
||||
|
||||
<!-- <Element_data_store
|
||||
ds_code="event_presenter_details"
|
||||
ds_type="html"
|
||||
display="block"
|
||||
class_li="p-2"
|
||||
/> -->
|
||||
|
||||
<section class="p-2">
|
||||
<h3 class="h4">Title: "{$events_slct.presentation_obj.name}"</h3>
|
||||
<h3 class="h4">Presenter:</h3>
|
||||
<ul
|
||||
class="space-y-2 px-4"
|
||||
>
|
||||
<li>
|
||||
<span class="fas fa-user"></span>
|
||||
{$events_slct.presenter_obj.full_name}
|
||||
</li>
|
||||
<li>
|
||||
<span class="fas fa-envelope"></span>
|
||||
<a
|
||||
href="mailto:{$events_slct.presenter_obj.email}"
|
||||
class="text-blue-500"
|
||||
>{$events_slct.presenter_obj.email}</a>
|
||||
</li>
|
||||
<!-- <li>
|
||||
<span class="fas fa-phone"></span>
|
||||
{$events_slct.presenter_obj.phone}
|
||||
</li> -->
|
||||
<li>
|
||||
<span class="fas fa-building"></span>
|
||||
{$events_slct.presenter_obj.affiliations}
|
||||
</li>
|
||||
<li>
|
||||
<span class="fas fa-user-tag"></span>
|
||||
{$events_slct.presenter_obj.professional_title}
|
||||
</li>
|
||||
<li>
|
||||
<span class="fas fa-user-secret"></span>
|
||||
{$events_slct.presenter_obj.person_passcode} (your passcode)
|
||||
|
||||
<button title="Edit your passcode" class="btn btn-sm variant-soft-warning">
|
||||
<span class="fas fa-edit">
|
||||
</span>
|
||||
Edit
|
||||
</button>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3 class="h4">Files:</h3>
|
||||
<label>
|
||||
Upload new file(s):
|
||||
<input
|
||||
type="file"
|
||||
class="form-input"
|
||||
multiple
|
||||
>
|
||||
</label>
|
||||
|
||||
<ul
|
||||
class="space-y-2 px-4"
|
||||
>
|
||||
{#if $events_slct.presenter_obj.file_li}
|
||||
{#each $events_slct.presenter_obj.file_li as file_obj}
|
||||
<li>
|
||||
<span class="fas fa-file"></span>
|
||||
<a
|
||||
href={file_obj.url}
|
||||
class="text-blue-500"
|
||||
>{file_obj.name}</a>
|
||||
</li>
|
||||
{/each}
|
||||
{:else}
|
||||
<li>
|
||||
<span class="fas fa-file"></span>
|
||||
No files uploaded
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
<Presenter_view />
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<button
|
||||
on:click={
|
||||
@@ -996,6 +968,9 @@ function send_init_confirm_email({to_email, to_name, person_id, person_passcode,
|
||||
<span class="fas fa-times mx-1"></span>
|
||||
Close
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user