Stopping for dinner and a break.

This commit is contained in:
Scott Idem
2024-06-13 19:08:09 -04:00
parent 6bcc554737
commit 58d25e922c
3 changed files with 237 additions and 111 deletions

View File

@@ -356,6 +356,51 @@ async function handle_load_ae_obj_li__event_presentation(
}
// Updated 2024-06-13
async function handle_load_ae_obj_id__event_presenter(
{
api_cfg,
event_presenter_id,
try_cache=false,
log_lvl=0
} : {
api_cfg: any,
event_presenter_id: string,
try_cache?: boolean,
log_lvl?: number
}
) {
console.log(`*** handle_load_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}`);
let params = {};
ae_promises.load__event_presenter_obj = await api.get_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'event_presenter',
obj_id: event_presenter_id, // NOTE: This is the FQDN, not normally the ID.
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
params: params,
log_lvl: log_lvl
})
.then(function (event_presenter_obj_get_result) {
if (event_presenter_obj_get_result) {
// This is expecting a list
handle_db_save_ae_obj_li__event_presenter({obj_type: 'event_presenter', obj_li: [event_presenter_obj_get_result]});
return event_presenter_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_promises.load__event_presenter_obj;
}
// Updated 2024-06-10
async function handle_load_ae_obj_li__event_presenter(
{
@@ -1491,6 +1536,7 @@ let export_obj = {
handle_load_ae_obj_li__event_presentation: handle_load_ae_obj_li__event_presentation,
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_id__badge: handle_load_ae_obj_id__badge,

View File

@@ -25,6 +25,9 @@ import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_st
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
import { events_func } from '$lib/ae_events_functions';
import Form_agree from './form_agree.svelte';
import FormAgree from './form_agree.svelte';
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
$slct.account_id = data.account_id;
console.log(`$slct.account_id = `, $slct.account_id);
@@ -62,6 +65,8 @@ if (!$events_loc.pres_mgmt) {
$events_loc.pres_mgmt.show_content__agree_text = null;
}
$events_loc.pres_mgmt.show_content__agree_text = false;
// import Leads_add_scan from './leads_add_scan.svelte';
// import Sessions_list from './sessions_list.svelte';
// import Leads_manage from './leads_manage.svelte';
@@ -100,6 +105,8 @@ let lq__event_presenter_obj = liveQuery(
() => db_events.presenters.get($events_slct.event_presenter_id)
);
$events_slct.event_presenter_obj = $lq__event_presenter_obj;
// 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);
@@ -254,7 +261,7 @@ onMount(() => {
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"
class="btn btn-sm variant-soft-surface hover:variant-filled-surface"
>
{#if $events_loc.pres_mgmt.show_content__session_description}
<span class="fas fa-eye-slash mx-1"></span>
@@ -318,7 +325,7 @@ onMount(() => {
{#if $events_loc.auth__person?.id}
<button
type="button"
class="btn btn-sm variant-soft-warning"
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
on:click={() => {
$events_loc.auth__person = {
id: null,
@@ -462,8 +469,12 @@ onMount(() => {
<!-- 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 $ae_loc.trusted_access || $events_loc.auth__kv.presentation[event_presentation_obj.event_presentation_id_random]}
<button title="Edit presentation title and description" class="btn btn-sm variant-soft-warning float-right">
<span class="fas fa-edit">
<button
type="button"
disabled
title="Edit presentation title and description"
class="btn btn-sm variant-soft-warning float-right">
<span class="fas fa-edit mx-1">
</span>
Edit Presentation
</button>
@@ -495,7 +506,7 @@ onMount(() => {
$events_loc.pres_mgmt.show_content__presentation_description = event_presentation_obj.event_presentation_id_random;
}
}}
class="btn btn-sm variant-soft-surface"
class="btn btn-sm variant-soft-surface hover:variant-filled-surface"
>
{#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>
@@ -539,7 +550,7 @@ onMount(() => {
$events_loc.pres_mgmt.show_content__presenter_start = event_presenter_obj.event_presenter_id_random;
}
}
class="btn btn-lg variant-ghost-primary text-lg font-bold min-w-56"
class="btn btn-lg variant-ghost-primary text-lg font-bold min-w-56 hover:variant-filled-primary"
title="Person ID: {event_presenter_obj.person_id_random}; Email: {event_presenter_obj.email}"
>
<span class="fas fa-user mx-1"></span>
@@ -584,7 +595,7 @@ onMount(() => {
$events_loc.pres_mgmt.show_content__agree_text = event_presenter_obj.event_presenter_id_random;
}
}
class="btn btn-md variant-ghost-success"
class="btn btn-md variant-ghost-success hover:variant-filled-success"
title="Agreed to terms and conditions"
>
<span class="fas fa-check text-green-500 px-1" title="Agreed to terms and conditions"></span>
@@ -606,7 +617,7 @@ onMount(() => {
$events_loc.pres_mgmt.show_content__agree_text = event_presenter_obj.event_presenter_id_random;
}
}
class="btn btn-md variant-ghost-warning"
class="btn btn-md variant-ghost-warning hover:variant-filled-warning"
title="View terms and conditions"
>
<span class="fas fa-times bg-red-500 text-white px-1 mx-1" title="Not agreed to terms and conditions"></span>
@@ -721,6 +732,7 @@ onMount(() => {
</section>
{#if $events_loc.pres_mgmt?.show_content__agree_text}
<section class="ae_quick_modal_container">
<section class="ae_quick_popover">
@@ -739,109 +751,7 @@ onMount(() => {
</button>
<h2 class="h3">
Presenter Agreement for:<br>
<strong>{$events_slct.presenter_obj.full_name} ({$events_slct.presenter_obj.email})</strong>
</h2>
<Element_data_store
ds_code="event_presenter_agree_text"
ds_type="html"
display="block"
class_li="p-2"
/>
<section class="p-2">
<!-- Highlight the persons name, email, and that whole line. -->
<p class="text-lg bg-yellow-100 p-2">
<strong>{$events_slct.presenter_obj.full_name} ({$events_slct.presenter_obj.email})</strong> agrees to the following terms and conditions for the presentation:
</p>
<h3 class="h4">Title: "{$events_slct.presentation_obj.name}"</h3>
<h3 class="h4">Opt-Out?</h3>
<p>Speaker does not permit the use of presentation materials as described in section(s), above for: (please check for all that apply)</p>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Audio Reproduction of Presentation
</label>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Video Reproduction of Presentation
</label>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Transcription and Publication of Presentation on LCI Website
</label>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Publication of Presentation on LCI Congress App
</label>
<h3 class="h4">Agree?</h3>
<!-- Agree (agreement) means this presenter has agreed to the terms and conditions. -->
<Element_ae_crud
trigger_patch={ae_triggers.agree}
api_cfg={$ae_api}
object_type={'event_presenter'}
object_id={$events_slct.presenter_obj?.event_presenter_id_random}
field_name={'agree'}
field_type={'button'}
field_value={$events_slct.presenter_obj.agree}
allow_null={false}
hide_edit_btn={true}
outline_element={false}
show_crud={false}
display_inline={true}
class_li={'m-1'}
on:ae_crud_updated={e => {
console.log(`ae_crud_updated event:`, e.detail);
events_func.handle_load_ae_obj_id__presenter({api_cfg: $ae_api, presenter_id: $events_slct.presenter_id});
}}
>
{#if !$events_slct.presenter_obj?.agree}
Not Agreed:
<span class="fas fa-question text-red-500 m-1"></span>
<!-- <span class="fas fa-credit-card mx-1"></span> -->
Waiting for agreement
{:else}
Agreed:
<span class="fas fa-check text-green-500 m-1"></span>
<span class="fas fa-check mx-1"></span>
Marked as agreed
{/if}
{#if $ae_loc.trusted_access || $events_loc.auth__kv.session[$events_slct.event_session_id]}
<button
type="button"
on:click={() => {
$events_slct.presenter_obj.agree = !$events_slct.presenter_obj?.agree;
ae_triggers.agree = true;
}}
class="btn btn-sm variant-soft-warning"
>
{@html ($events_slct.presenter_obj?.agree ? '<span class="fas fa-sync m-1"></span> Not agreed?' : '<span class="fa fa-sync m-1"></span> Mark as agreed?')}
</button>
{/if}
</Element_ae_crud>
</section>
<Form_agree />
</section>

View File

@@ -0,0 +1,170 @@
<script lang="ts">
console.log(`ae_events_pres_mgmt session [slug] form_agree.svelte`);
import { onMount } from 'svelte';
import { liveQuery } from "dexie";
import type { key_val } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils';
import Element_data_store from '$lib/element_data_store.svelte';
import Element_ae_crud from '$lib/element_ae_crud.svelte';
import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { db_events } from "$lib/db_events";
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
import { events_func } from '$lib/ae_events_functions';
let ae_triggers: key_val = {};
let ae_promises: key_val = {}; // Promise<any>;
// let lq__event_presentation_obj = liveQuery(
// async () => await db_events.presentations.get($events_slct.event_presentation_id)
// );
console.log(`$events_slct.event_presenter_id:`, $events_slct.event_presenter_id);
let lq__event_presenter_obj = liveQuery(
() => db_events.presenters.get($events_slct.event_presenter_id)
);
// $events_slct.event_presenter_obj = $lq__event_presenter_obj;
let tmp_agree = false;
let tmp_opt_out = {};
onMount(() => {
console.log('Events Session [slug]: form_agree.svelte');
console.log(`$events_slct.event_presenter_id:`, $events_slct.event_presenter_id);
console.log(`$lq__event_presenter_obj:`, $lq__event_presenter_obj);
});
</script>
{#await $lq__event_presenter_obj}
Loading...
{:then result}
{#if $lq__event_presenter_obj}
<h2 class="h3">
Presenter Agreement for:<br>
<strong>{$lq__event_presenter_obj.full_name} ({$lq__event_presenter_obj.email})</strong>
</h2>
<Element_data_store
ds_code="event_presenter_agree_text"
ds_type="html"
display="block"
class_li="p-2"
/>
<section class="text-lg p-1 m-1 border border-red-200 rounded-md bg-red-100 space-y-2">
<!-- Highlight the persons name, email, and that whole line. -->
<p class="text-lg bg-yellow-100 p-2">
<strong>{$lq__event_presenter_obj.full_name} ({$lq__event_presenter_obj.email})</strong> agrees to the following terms and conditions for the presentation:
</p>
<h3 class="h4">Title: "{$events_slct.presentation_obj.name}"</h3>
<h3 class="h4">Opt-Out?</h3>
<p>Speaker does not permit the use of presentation materials as described in section(s), above for: (please check for all that apply)</p>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Audio Reproduction of Presentation
</label>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Video Reproduction of Presentation
</label>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Transcription and Publication of Presentation on LCI Website
</label>
<label>
<input
type="checkbox"
class="form-checkbox"
>
Publication of Presentation on LCI Congress App
</label>
<h3 class="h4">Agree?</h3>
<!-- Agree (agreement) means this presenter has agreed to the terms and conditions. -->
<Element_ae_crud
trigger_patch={ae_triggers.agree}
api_cfg={$ae_api}
object_type={'event_presenter'}
object_id={$lq__event_presenter_obj?.event_presenter_id_random}
field_name={'agree'}
field_type={'button'}
field_value={tmp_agree}
allow_null={false}
hide_edit_btn={true}
outline_element={false}
show_crud={false}
display_inline={true}
class_li={'m-1'}
on:ae_crud_updated={e => {
console.log(`ae_crud_updated event:`, e.detail);
events_func.handle_load_ae_obj_id__event_presenter({api_cfg: $ae_api, event_presenter_id: $lq__event_presenter_obj?.event_presenter_id_random, log_lvl: 1});
}}
>
{#if !$lq__event_presenter_obj?.agree}
<div>
Not Agreed:
<span class="fas fa-times text-red-500 m-1"></span>
<!-- <span class="fas fa-question text-red-500 m-1"></span> -->
</div>
<div>
Waiting for agreement to the Guest Speaker Consent and Release and Terms and Conditions before you can move on.
</div>
{:else}
Agreed:
<span class="fas fa-check text-green-500 m-1"></span>
Marked as agreed
{/if}
<div class="text-center">
{#if $ae_loc.trusted_access || $events_loc.auth__kv.session[$events_slct.event_session_id]}
<button
type="button"
on:click={() => {
tmp_agree = !$lq__event_presenter_obj?.agree;
ae_triggers.agree = true;
}}
class="btn btn-lg variant-ghost-success hover:variant-filled-primary m-2"
class:variant-ghost-warning={$lq__event_presenter_obj?.agree}
>
{#if $lq__event_presenter_obj?.agree}
<!-- <span class="fas fa-sync m-1"></span> -->
<span class="fas fa-times text-red-500 mx-1"></span>
Not agreed?
{:else}
<span class="fa fa-check m-1 text-green-500"></span>
Mark as agreed?
{/if}
<!-- {@html ($lq__event_presenter_obj?.agree ? '<span class="fas fa-sync m-1"></span> Not agreed?' : '<span class="fa fa-sync m-1"></span> Mark as agreed?')} -->
</button>
{/if}
</div>
</Element_ae_crud>
</section>
{/if}
{/await}