Create presentations and presenters. Making things look nicer.
This commit is contained in:
0
src/lib/ae_core__person.ts
Normal file
0
src/lib/ae_core__person.ts
Normal file
@@ -113,6 +113,64 @@ export async function handle_load_ae_obj_li__event_presentation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Updated 2024-06-24
|
||||||
|
export async function handle_create_ae_obj__event_presentation(
|
||||||
|
{
|
||||||
|
api_cfg,
|
||||||
|
event_id,
|
||||||
|
event_session_id,
|
||||||
|
data_kv,
|
||||||
|
params={},
|
||||||
|
log_lvl=0
|
||||||
|
}: {
|
||||||
|
api_cfg: any,
|
||||||
|
event_id: string,
|
||||||
|
event_session_id: string,
|
||||||
|
data_kv: key_val,
|
||||||
|
params?: key_val,
|
||||||
|
log_lvl?: number
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
console.log(`*** handle_create_ae_obj__event_presentation() *** event_id=${event_id} event_session_id=${event_session_id}`);
|
||||||
|
|
||||||
|
ae_promises.create__event_presentation = await api.create_ae_obj_crud({
|
||||||
|
api_cfg: api_cfg,
|
||||||
|
obj_type: 'event_presentation',
|
||||||
|
fields: {
|
||||||
|
event_id_random: event_id,
|
||||||
|
event_session_id_random: event_session_id,
|
||||||
|
...data_kv
|
||||||
|
},
|
||||||
|
key: api_cfg.api_crud_super_key,
|
||||||
|
params: params,
|
||||||
|
return_obj: true,
|
||||||
|
log_lvl: log_lvl
|
||||||
|
})
|
||||||
|
.then(function (event_presentation_obj_create_result) {
|
||||||
|
if (event_presentation_obj_create_result) {
|
||||||
|
handle_db_save_ae_obj_li__event_presentation(
|
||||||
|
{
|
||||||
|
obj_type: 'event_presentation',
|
||||||
|
obj_li: [event_presentation_obj_create_result]
|
||||||
|
});
|
||||||
|
return event_presentation_obj_create_result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log('No results returned or failed.', error);
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
});
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log('ae_promises.create__event_presentation:', ae_promises.create__event_presentation);
|
||||||
|
}
|
||||||
|
return ae_promises.create__event_presentation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// This function will loop through the event_presentation_obj_li and save each one to the DB.
|
// This function will loop through the event_presentation_obj_li and save each one to the DB.
|
||||||
// Updated 2024-06-10
|
// Updated 2024-06-10
|
||||||
export function handle_db_save_ae_obj_li__event_presentation(
|
export function handle_db_save_ae_obj_li__event_presentation(
|
||||||
|
|||||||
@@ -112,6 +112,65 @@ export async function handle_load_ae_obj_li__event_presenter(
|
|||||||
return ae_promises.load__event_presenter_obj_li;
|
return ae_promises.load__event_presenter_obj_li;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Updated 2024-06-24
|
||||||
|
export async function handle_create_ae_obj__event_presenter(
|
||||||
|
{
|
||||||
|
api_cfg,
|
||||||
|
event_id,
|
||||||
|
event_session_id,
|
||||||
|
event_presentation_id,
|
||||||
|
data_kv,
|
||||||
|
params={},
|
||||||
|
log_lvl=0
|
||||||
|
}: {
|
||||||
|
api_cfg: any,
|
||||||
|
event_id: string,
|
||||||
|
event_session_id: string,
|
||||||
|
event_presentation_id: string,
|
||||||
|
data_kv: key_val,
|
||||||
|
params?: key_val,
|
||||||
|
log_lvl?: number
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
console.log(`*** handle_create_ae_obj__event_presenter() *** event_id=${event_id} event_session_id=${event_session_id} event_presentation_id=${event_presentation_id}`);
|
||||||
|
|
||||||
|
ae_promises.create__event_presenter = await api.create_ae_obj_crud({
|
||||||
|
api_cfg: api_cfg,
|
||||||
|
obj_type: 'event_presenter',
|
||||||
|
fields: {
|
||||||
|
event_id_random: event_id,
|
||||||
|
event_session_id_random: event_session_id,
|
||||||
|
event_presentation_id_random: event_presentation_id,
|
||||||
|
...data_kv
|
||||||
|
},
|
||||||
|
key: api_cfg.api_crud_super_key,
|
||||||
|
params: params,
|
||||||
|
return_obj: true,
|
||||||
|
log_lvl: log_lvl
|
||||||
|
})
|
||||||
|
.then(function (event_presenter_obj_create_result) {
|
||||||
|
if (event_presenter_obj_create_result) {
|
||||||
|
handle_db_save_ae_obj_li__event_presenter(
|
||||||
|
{
|
||||||
|
obj_type: 'event_presenter', obj_li: [event_presenter_obj_create_result]
|
||||||
|
});
|
||||||
|
return event_presenter_obj_create_result;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
console.log('No results returned or failed.', error);
|
||||||
|
})
|
||||||
|
.finally(function () {
|
||||||
|
});
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log('ae_promises.create__event_presenter:', ae_promises.create__event_presenter);
|
||||||
|
}
|
||||||
|
return ae_promises.create__event_presenter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Updated 2024-06-13
|
// Updated 2024-06-13
|
||||||
export async function handle_update_ae_obj__event_presenter(
|
export async function handle_update_ae_obj__event_presenter(
|
||||||
|
|||||||
@@ -35,12 +35,14 @@ import {
|
|||||||
import {
|
import {
|
||||||
handle_load_ae_obj_id__event_presentation,
|
handle_load_ae_obj_id__event_presentation,
|
||||||
handle_load_ae_obj_li__event_presentation,
|
handle_load_ae_obj_li__event_presentation,
|
||||||
|
handle_create_ae_obj__event_presentation,
|
||||||
handle_db_save_ae_obj_li__event_presentation
|
handle_db_save_ae_obj_li__event_presentation
|
||||||
} from "$lib/ae_events__event_presentation";
|
} from "$lib/ae_events__event_presentation";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
handle_load_ae_obj_id__event_presenter,
|
handle_load_ae_obj_id__event_presenter,
|
||||||
handle_load_ae_obj_li__event_presenter,
|
handle_load_ae_obj_li__event_presenter,
|
||||||
|
handle_create_ae_obj__event_presenter,
|
||||||
handle_update_ae_obj__event_presenter,
|
handle_update_ae_obj__event_presenter,
|
||||||
handle_db_save_ae_obj_li__event_presenter
|
handle_db_save_ae_obj_li__event_presenter
|
||||||
} from "$lib/ae_events__event_presenter";
|
} from "$lib/ae_events__event_presenter";
|
||||||
@@ -67,9 +69,11 @@ let export_obj = {
|
|||||||
|
|
||||||
handle_load_ae_obj_id__event_presentation: handle_load_ae_obj_id__event_presentation,
|
handle_load_ae_obj_id__event_presentation: handle_load_ae_obj_id__event_presentation,
|
||||||
handle_load_ae_obj_li__event_presentation: handle_load_ae_obj_li__event_presentation,
|
handle_load_ae_obj_li__event_presentation: handle_load_ae_obj_li__event_presentation,
|
||||||
|
handle_create_ae_obj__event_presentation: handle_create_ae_obj__event_presentation,
|
||||||
|
|
||||||
handle_load_ae_obj_id__event_presenter: handle_load_ae_obj_id__event_presenter,
|
handle_load_ae_obj_id__event_presenter: handle_load_ae_obj_id__event_presenter,
|
||||||
handle_load_ae_obj_li__event_presenter: handle_load_ae_obj_li__event_presenter,
|
handle_load_ae_obj_li__event_presenter: handle_load_ae_obj_li__event_presenter,
|
||||||
|
handle_create_ae_obj__event_presenter: handle_create_ae_obj__event_presenter,
|
||||||
handle_update_ae_obj__event_presenter: handle_update_ae_obj__event_presenter,
|
handle_update_ae_obj__event_presenter: handle_update_ae_obj__event_presenter,
|
||||||
|
|
||||||
handle_load_ae_obj_id__badge: handle_load_ae_obj_id__badge,
|
handle_load_ae_obj_id__badge: handle_load_ae_obj_id__badge,
|
||||||
|
|||||||
@@ -912,16 +912,84 @@ function send_sign_in_poc_email(
|
|||||||
|
|
||||||
<!-- Presentations in the session -->
|
<!-- Presentations in the session -->
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
|
<div class="float-right space-2 flex flex-row items-center">
|
||||||
|
{#if $ae_loc.trusted_access }
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Add Presentation');
|
||||||
|
|
||||||
|
let presentation_data = {
|
||||||
|
event_id_random: $events_slct.event_id,
|
||||||
|
event_session_id_random: $events_slct.event_session_id,
|
||||||
|
name: 'New Presentation',
|
||||||
|
code: 'new_presentation',
|
||||||
|
enable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
events_func.handle_create_ae_obj__event_presentation({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_id: $events_slct.event_id,
|
||||||
|
event_session_id: $events_slct.event_session_id,
|
||||||
|
data_kv: presentation_data,
|
||||||
|
log_lvl: 1,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
||||||
|
>
|
||||||
|
<span class="fas fa-plus mx-1"></span>
|
||||||
|
Add Presentation
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3 class="h3">Presentations:</h3>
|
<h3 class="h3">Presentations:</h3>
|
||||||
{#await $events_slct.event_presentation_obj_li}
|
{#await $events_slct.event_presentation_obj_li}
|
||||||
<p>Loading...</p>
|
<p>Loading...</p>
|
||||||
{:then event_presentation_obj_li}
|
{:then event_presentation_obj_li}
|
||||||
{#if event_presentation_obj_li && event_presentation_obj_li.length > 0}
|
{#if event_presentation_obj_li && event_presentation_obj_li.length > 0}
|
||||||
<ul
|
<ul
|
||||||
class="space-y-2 px-4"
|
class="space-y-4 p-4 m-2 bg-gray-100 rounded-md"
|
||||||
>
|
>
|
||||||
{#each event_presentation_obj_li as event_presentation_obj}
|
{#each event_presentation_obj_li as event_presentation_obj}
|
||||||
<li>
|
<li
|
||||||
|
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
||||||
|
>
|
||||||
|
|
||||||
|
<div class="float-right space-2 flex flex-row items-center">
|
||||||
|
{#if $ae_loc.trusted_access }
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Add Presenter');
|
||||||
|
|
||||||
|
let presenter_data = {
|
||||||
|
event_id_random: $events_slct.event_id,
|
||||||
|
event_session_id_random: $events_slct.event_session_id,
|
||||||
|
event_presentation_id_random: event_presentation_obj.event_presentation_id_random,
|
||||||
|
given_name: 'New',
|
||||||
|
family_name: 'Presenter',
|
||||||
|
email: 'test+newpres@oneskyit.com',
|
||||||
|
code: 'new_presenter',
|
||||||
|
enable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
events_func.handle_create_ae_obj__event_presenter({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_id: $events_slct.event_id,
|
||||||
|
event_session_id: $events_slct.event_session_id,
|
||||||
|
event_presentation_id: event_presentation_obj.event_presentation_id_random,
|
||||||
|
data_kv: presenter_data,
|
||||||
|
log_lvl: 1,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
||||||
|
>
|
||||||
|
<span class="fas fa-plus mx-1"></span>
|
||||||
|
Add Presenter
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<!-- Make sure to show the edit button only if the user has the correct permissions. Need to set the presentation ID in the store. -->
|
<!-- Make sure to show the edit button only if the user has the correct permissions. Need to set the presentation ID in the store. -->
|
||||||
{#if event_presentation_obj && ($ae_loc.trusted_access || $events_loc.auth__kv.presentation[event_presentation_obj.event_presentation_id_random])}
|
{#if event_presentation_obj && ($ae_loc.trusted_access || $events_loc.auth__kv.presentation[event_presentation_obj.event_presentation_id_random])}
|
||||||
@@ -936,13 +1004,12 @@ function send_sign_in_poc_email(
|
|||||||
// Careful with the trigger_patch. It will keep firing if not reset.
|
// Careful with the trigger_patch. It will keep firing if not reset.
|
||||||
ae_triggers.update_event_presentation_name = false;
|
ae_triggers.update_event_presentation_name = false;
|
||||||
}}
|
}}
|
||||||
class="btn btn-sm variant-soft-warning float-right"
|
class="btn btn-sm variant-soft-warning"
|
||||||
>
|
>
|
||||||
<span class="fas fa-times mx-1">
|
<span class="fas fa-times mx-1">
|
||||||
</span>
|
</span>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -955,10 +1022,10 @@ function send_sign_in_poc_email(
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
title="Edit presentation title and description"
|
title="Edit presentation title and description"
|
||||||
class="btn btn-sm variant-soft-warning float-right">
|
class="btn btn-sm variant-soft-warning">
|
||||||
<span class="fas fa-edit mx-1">
|
<span class="fas fa-edit mx-1">
|
||||||
</span>
|
</span>
|
||||||
Edit
|
Edit Presentation Name
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -1022,10 +1089,8 @@ function send_sign_in_poc_email(
|
|||||||
</Element_ae_crud>
|
</Element_ae_crud>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<h4 class="h5">
|
<h4 class="h5">
|
||||||
"{event_presentation_obj.name}"
|
"{event_presentation_obj.name}"
|
||||||
@@ -1040,9 +1105,11 @@ function send_sign_in_poc_email(
|
|||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
{#if event_presentation_obj.description}
|
||||||
<strong class="text-sm">
|
<strong class="text-sm">
|
||||||
Description:
|
Description:
|
||||||
</strong>
|
</strong>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
@@ -1063,12 +1130,20 @@ function send_sign_in_poc_email(
|
|||||||
<span>Show</span>
|
<span>Show</span>
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
|
|
||||||
<pre
|
<pre
|
||||||
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
|
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
|
||||||
class:hidden={$events_loc.pres_mgmt.show_content__presentation_description !== event_presentation_obj.event_presentation_id_random}
|
class:hidden={$events_loc.pres_mgmt.show_content__presentation_description !== event_presentation_obj.event_presentation_id_random}
|
||||||
>{event_presentation_obj.description}</pre>
|
>{event_presentation_obj.description}</pre>
|
||||||
|
{:else}
|
||||||
|
<div class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
|
||||||
|
class:hidden={!$ae_loc.administrator_access}
|
||||||
|
>
|
||||||
|
<span class="fas fa-exclamation-triangle mx-1"></span>
|
||||||
|
No description provided.
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Show presenters for this presentation -->
|
<!-- Show presenters for this presentation -->
|
||||||
{#await event_presentation_obj.event_presenter_li}
|
{#await event_presentation_obj.event_presenter_li}
|
||||||
|
|||||||
Reference in New Issue
Block a user