Sponsor Hub part looks pretty good now. Still need to enable the delete buttons.

This commit is contained in:
Scott Idem
2024-03-08 21:09:58 -05:00
parent 875f327c90
commit 4136c08cdb
6 changed files with 290 additions and 98 deletions

View File

@@ -32,7 +32,7 @@ const modalComponentEditEventPresenterObj: ModalComponent = { ref: Edit_modal_ev
const modal_edit__event_presenter_obj: ModalSettings = {
type: 'component',
component: modalComponentEditEventPresenterObj,
title: 'Speaker Submission Form', // Editing Event Presenter
title: 'Speaker Form', // Editing Event Presenter
position: '', // default is "items-center"
response: (r: boolean | undefined) => handle_modal_close(r)
@@ -117,7 +117,7 @@ onMount(() => {
ae_util.handle_url_and_message('event_presenter_id', $slct.event_presenter_id);
if ($slct.event_presenter_id) {
console.log(`Got an ID. Let's show the modal!`);
modalStore.trigger(modal_edit__event_presenter_obj);
// modalStore.trigger(modal_edit__event_presenter_obj);
// $slct_trigger = 'load__event_presenter_obj';
}
});

View File

@@ -41,17 +41,6 @@ import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import type { key_val } from '$lib/ae_stores';
onMount(() => {
console.log('** Component Mounted: ** View Modal - Presenter Obj');
if ($slct.event_presenter_id && $ae_loc.href_url) {
// $ae_loc.mod.events.presenter_link = `${$ae_loc.href_url}/load?event_presenter_id=${$slct.event_presenter_id}`;
$ae_loc.mod.events.presenter_link = `${$ae_loc.site_domain}/events_speakers/load?event_presenter_id=${$slct.event_presenter_id}`;
console.log('Speaker link:', $ae_loc.mod.events.presenter_link);
}
});
let ae_promises: key_val = {}; // Promise<any>;
$ae_loc.mod.events.submit_status = null;
@@ -98,6 +87,17 @@ if ($slct.event_presenter_id) {
}
onMount(() => {
console.log('** Component Mounted: ** Edit Modal - Presenter Obj');
if ($slct.event_presenter_id && $ae_loc.href_url) {
// $ae_loc.mod.events.presenter_link = `${$ae_loc.href_url}/load?event_presenter_id=${$slct.event_presenter_id}`;
$ae_loc.mod.events.presenter_link = `${$ae_loc.site_domain}/events_speakers/load?event_presenter_id=${$slct.event_presenter_id}`;
console.log('Speaker link:', $ae_loc.mod.events.presenter_link);
}
});
$: if ($slct.event_presenter_obj) {
// Create HTML for showing pictures here?
if ($slct.event_presenter_obj.image_li_json) {
@@ -106,7 +106,7 @@ $: if ($slct.event_presenter_obj) {
account_id: $ae_loc.account_id,
base_url: $ae_api.base_url,
hosted_file_id: $slct.event_presenter_obj.image_li_json.headshot.hosted_file_id_random,
filename: `${$slct.event_presenter_obj.full_name} [headshot]`,
filename: `${$slct.event_presenter_obj.full_name} [headshot].${$slct.event_presenter_obj.image_li_json.headshot.extension}`,
style: 'max-width: 20em;',
inc_link: true,
})
@@ -279,10 +279,15 @@ async function handle_submit_form(event) {
if ($slct.event_presenter_id) {
if ($store_current_tab == 'start' && $slct.event_presenter_id) {
$store_current_tab = 'biograhpy';
send_init_confirm_email();
if (!$slct.event_presenter_obj.updated_on) {
send_init_confirm_email();
}
// Move on to files
} else if ($store_current_tab == 'biograhpy' && $slct.event_presenter_id) {
$store_current_tab = 'files';
// Move on to summary
} else if ($store_current_tab == 'files' && $slct.event_presenter_id) {
$store_current_tab = 'summary';
}
@@ -297,6 +302,9 @@ async function handle_submit_form(event) {
async function handle_submit_form_files(event) {
console.log('*** handle_submit_form() ***');
$ae_sess.mod.events.disable_submit__event_presenter_obj = true;
$ae_sess.mod.events.submit_status = 'saving';
let event_presenter_do: key_val = {};
// if ($slct.event_presenter_obj.logo_li_json) {
@@ -329,12 +337,23 @@ async function handle_submit_form_files(event) {
if (hosted_file_results) {
event_presenter_do.image_li_json.headshot = hosted_file_results[0];
console.log(event_presenter_do.image_li_json);
placeholder_li.image_headshot = `<img src="/hosted_file/download/${event_presenter_do.image_li_json.headshot.hosted_file_id_random}">${event_presenter_do.image_li_json.headshot.filename}`;
placeholder_li.image_headshot = ae_util.create_img_element({
account_id: $ae_loc.account_id,
base_url: $ae_api.base_url,
hosted_file_id: event_presenter_do.image_li_json.headshot.hosted_file_id_random,
filename: `${$slct.event_presenter_obj.full_name} [headshot].${event_presenter_do.image_li_json.headshot.extension}`,
// style: 'max-width: 20em;',
inc_link: true,
})
// `<img src="/hosted_file/download/${event_presenter_do.image_li_json.headshot.hosted_file_id_random}">${event_presenter_do.image_li_json.headshot.filename}`;
}
}
console.log(event_presenter_do);
ae_promises.update__event_presenter_obj = await handle_update__event_presenter({
obj_type: 'event_presenter',
obj_id: $slct.event_presenter_id,
@@ -358,6 +377,9 @@ async function handle_submit_form_files(event) {
if ($store_current_tab == 'files' && $slct.event_presenter_id) {
$store_current_tab = 'summary';
}
console.log('Trigger a reload of the object list.');
$slct_trigger = 'load__event_presenter_obj_li';
}
@@ -457,9 +479,11 @@ async function handle_update__event_presenter({
}
function send_init_confirm_email() {
console.log(`*** send_init_confirm_email() *** to ${$slct.event_presenter_obj.email}`);
let subject = `CHOW 2024 Speaker Hub Link for ${$slct.event_presenter_obj.full_name} (ID: ${$slct.event_presenter_id})`;
let body_html = `<p>Thank you for your submission to the Speaker Hub. You are an integral part of Capitol Hill Ocean Week and we appreciate your participation. If you need to make any changes or updates to your submission, you may access it via the below hyperlink:</p><p>Name: ${$slct.event_presenter_obj.full_name} (Speaker ID: ${$slct.event_presenter_id})</p><p>Use this link to view or update your CHOW 2024 speaker information.<p>Copy and paste link: <a href="${$ae_loc.mod.events.presenter_link}">${$ae_loc.mod.events.presenter_link}</a></p>`
let body_html = `<p>Thank you for your submission to the Speaker Hub. You are an integral part of Capitol Hill Ocean Week and we appreciate your participation. If you need to make any changes or updates to your submission, you may access it via the below hyperlink:</p><p>Name: ${$slct.event_presenter_obj.full_name} (Speaker ID: ${$slct.event_presenter_id})</p><p>Use this link to view or update your CHOW 2024 speaker information.<p>Copy and paste link: <a href="${$ae_loc.mod.events.presenter_link}">${$ae_loc.mod.events.presenter_link}</a></p>`;
api.send_email({
api_cfg: $ae_api,
@@ -474,7 +498,7 @@ function send_init_confirm_email() {
function send_summary_email() {
let subject = `CHOW 2024 Speaker Hub Link for ${$slct.event_presenter_obj.full_name} (ID: ${$slct.event_presenter_id})`;
let body_html = `<p>Thank you for your submission to the Speaker Hub. You are an integral part of Capitol Hill Ocean Week and we appreciate your participation. If you need to make any changes or updates to your submission, you may access it via the link below.</p><p>Name: ${$slct.event_presenter_obj.full_name} (ID: ${$slct.event_presenter_id})</p><p>Professional title: ${$slct.event_presenter_obj.professional_title}</p><p>Affiliations: ${$slct.event_presenter_obj.affiliations}</p><p>Email: ${$slct.event_presenter_obj.email}</p><div>Biography:<pre class="biography pre_wrap">${$slct.event_presenter_obj.biography}</pre></div> <div>Headshot:<div style="max-width: 20em">${placeholder_li.image_headshot}</div></div> <p>Use this link to view or update your CHOW 2024 speaker information.<p>Copy and paste link: <a href="${$ae_loc.mod.events.presenter_link}">${$ae_loc.mod.events.presenter_link}</a></p>`
let body_html = `<p>Thank you for your submission to the Speaker Hub. You are an integral part of Capitol Hill Ocean Week and we appreciate your participation. If you need to make any changes or updates to your submission, you may access it via the link below.</p><p>Name: ${$slct.event_presenter_obj.full_name} (ID: ${$slct.event_presenter_id})</p><p>Professional title: ${$slct.event_presenter_obj.professional_title}</p><p>Affiliations: ${$slct.event_presenter_obj.affiliations}</p><p>Email: ${$slct.event_presenter_obj.email}</p><div>Biography:<pre class="biography pre_wrap">${$slct.event_presenter_obj.biography}</pre></div> <div>Headshot:<div style="max-width: 20em">${placeholder_li.image_headshot}</div></div> <p>Use this link to view or update your CHOW 2024 speaker information.<p>Copy and paste link: <a href="${$ae_loc.mod.events.presenter_link}">${$ae_loc.mod.events.presenter_link}</a></p>`;
api.send_email({
api_cfg: $ae_api,
@@ -552,7 +576,9 @@ async function handle_delete_event_presenter_obj({event_presenter_id, hosted_fil
{#if $modalStore[0]}
<section class="svelte_component ae_edit_modal ae_obj__event_presenter {container_class_li}">
<header class="{parent.regionHeader}">
{$modalStore[0].title ?? '-- No Title --'}
<h2 class="h3">{$modalStore[0].title ?? '-- No Title --'}:
{$slct.event_presenter_obj && $slct.event_presenter_obj.full_name ? $slct.event_presenter_obj.full_name : '-- Fill out and save --'}
</h2>
{#await ae_promises.update__event_presenter_obj}
<div class="modal-loading">
@@ -677,7 +703,7 @@ async function handle_delete_event_presenter_obj({event_presenter_id, hosted_fil
<section class="space-y-4">
<h3 class="h4">CHOW Speaker Listing Information</h3>
<h3 class="h4">CHOW 2024 Speaker Listing Information</h3>
<p>Please enter your personal and professional information below.</p>
@@ -835,6 +861,17 @@ async function handle_delete_event_presenter_obj({event_presenter_id, hosted_fil
disabled={($ae_loc.mod.events.disable_submit__event_presenter_obj)}
on:click={() => {
console.log('*** Save start button clicked ***');
if (!$slct.event_presenter_obj.email) {
if (alert(`You have not entered an email address.`)) {return false;}
}
if ($slct.event_presenter_obj.updated_on) {
if (confirm(`Would you like an email with a link back to this for be sent to you at ${$slct.event_presenter_obj.email}? Your information will be saved either way.`)) {
send_init_confirm_email();
} else {
return false;
}
}
}}
>
<span class="fas fa-check mx-1"></span>
@@ -978,7 +1015,7 @@ async function handle_delete_event_presenter_obj({event_presenter_id, hosted_fil
<div>Affiliations: {$slct.event_presenter_obj.affiliations}</div>
<div>Email: {$slct.event_presenter_obj.email}</div>
<div>Biography:
<pre class="biography pre_wrap">{$slct.event_presenter_obj.biography}</pre>
<pre class="biography pre_wrap">{$slct.event_presenter_obj.biography ?? '-- Not Entered --'}</pre>
</div>
<div>
Headshot:

View File

@@ -82,7 +82,8 @@ onMount(() => {
ae_util.handle_url_and_message('event_presenter_id', $slct.event_presenter_id);
if ($slct.event_presenter_id) {
console.log(`Got an ID. Let's show the modal!`);
modalStore.trigger(modal_edit__event_presenter);
// This causes a problem frequently... See through...
// modalStore.trigger(modal_edit__event_presenter);
} else {
console.log(`No ID. Nothing to show.`);
}
@@ -251,6 +252,15 @@ $: if (testing) {
<section>
{#if $slct.event_presenter_id}
<div class="text-center m-4">
{#if $slct.event_presenter_obj}
<p>Welcome to the Speaker Hub {$slct.event_presenter_obj.full_name}!</p>
{:else}
<p>Welcome to the Speaker Hub!</p>
{/if}
</div>
<button
class="btn variant-ghost-primary w-96"
on:click={() => {