Sponsor Hub part looks pretty good now. Still need to enable the delete buttons.
This commit is contained in:
@@ -427,7 +427,7 @@ function handle_url_and_message(name: string, value: null|string) {
|
||||
|
||||
if (value) {
|
||||
url.searchParams.set(name, value);
|
||||
// history.pushState({}, '', url);
|
||||
history.pushState({}, '', url);
|
||||
|
||||
// console.log('url:', url);
|
||||
// pushState(url.href, {});
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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={() => {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { fade } from 'svelte/transition';
|
||||
// This works and uses local storage:
|
||||
// store_current_tab must be prefixed with $ to be reactive.
|
||||
import { clipboard, FileDropzone, getModalStore, localStorageStore, ProgressRadial, RadioGroup, RadioItem, TabGroup, Tab, TabAnchor } from '@skeletonlabs/skeleton';
|
||||
|
||||
import type { Writable } from 'svelte/store';
|
||||
|
||||
import Element_data_store from '$lib/element_data_store.svelte';
|
||||
@@ -40,6 +41,17 @@ import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
|
||||
let ae_promises: key_val = {}; // Promise<any>;
|
||||
|
||||
$ae_sess.mod.sponsorships.submit_status = null;
|
||||
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
|
||||
let placeholder_li: key_val = {
|
||||
file_logo_primary: '-- No File Selected --',
|
||||
file_logo_light: '-- No File Selected --',
|
||||
file_logo_dark: '-- No File Selected --',
|
||||
file_media_promo_video: '-- No File Selected --',
|
||||
};
|
||||
|
||||
if ($slct.sponsorship_id) {
|
||||
console.log(`Sponsorship ID selected: ${$slct.sponsorship_id}`);
|
||||
console.log(`Sponsorship object selected:`, $slct.sponsorship_obj);
|
||||
@@ -56,7 +68,11 @@ if ($slct.sponsorship_id) {
|
||||
description: null,
|
||||
|
||||
poc_person_id: null,
|
||||
poc_json: {},
|
||||
poc_json: {
|
||||
full_name: null,
|
||||
email: null,
|
||||
phone_mobile: null,
|
||||
},
|
||||
|
||||
logo_li_json: null,
|
||||
media_li_json: null,
|
||||
@@ -71,21 +87,11 @@ if ($slct.sponsorship_id) {
|
||||
level_str: null,
|
||||
amount: null,
|
||||
paid: null,
|
||||
|
||||
enable: null,
|
||||
};
|
||||
}
|
||||
|
||||
let ae_promises: key_val = {}; // Promise<any>;
|
||||
|
||||
$ae_sess.mod.sponsorships.submit_status = null;
|
||||
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
|
||||
let placeholder_li: key_val = {
|
||||
file_logo_primary: '-- No File Selected --',
|
||||
file_logo_light: '-- No File Selected --',
|
||||
file_logo_dark: '-- No File Selected --',
|
||||
file_media_promo_video: '-- No File Selected --',
|
||||
};
|
||||
|
||||
|
||||
onMount(() => {
|
||||
console.log('** Component Mounted: ** Edit Modal - Sponsorship Obj');
|
||||
@@ -96,45 +102,44 @@ onMount(() => {
|
||||
console.log('Sponsorship link:', $ae_loc.mod.sponsorships.link);
|
||||
}
|
||||
|
||||
// I tried adding this to load with the sponsorships +layout.ts. This did not seem to work. Probably an async related issue?
|
||||
let ds_code: null|string = 'sponsorships__agree_li';
|
||||
let ds_type: null|string = 'json';
|
||||
// Deal with this later!
|
||||
// // I tried adding this to load with the sponsorships +layout.ts. This did not seem to work. Probably an async related issue?
|
||||
// let ds_code: null|string = 'sponsorships__agree_li';
|
||||
// let ds_type: null|string = 'json';
|
||||
|
||||
let loading_results = api.get_data_store_obj_w_code({
|
||||
api_cfg: $ae_api,
|
||||
data_store_code: ds_code,
|
||||
data_type: ds_type,
|
||||
log_lvl: 1
|
||||
})
|
||||
.then( function (ds_results) {
|
||||
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
if (ds_results) {
|
||||
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
// let ae_loc_tmp = get(ae_loc);
|
||||
if (ds_type == 'json') {
|
||||
$ae_loc.ds[ds_code] = ds_results.json;
|
||||
} else {
|
||||
$ae_loc.ds[ds_code] = ds_results.text;
|
||||
}
|
||||
// $ae_loc = $ae_loc;
|
||||
}
|
||||
})
|
||||
.finally(function () {
|
||||
// console.log(`ae_loc = `, get(ae_loc));
|
||||
return true;
|
||||
});
|
||||
// let loading_results = api.get_data_store_obj_w_code({
|
||||
// api_cfg: $ae_api,
|
||||
// data_store_code: ds_code,
|
||||
// data_type: ds_type,
|
||||
// log_lvl: 1
|
||||
// })
|
||||
// .then( function (ds_results) {
|
||||
// console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
// if (ds_results) {
|
||||
// console.log(`ae_ Data Store ${ds_code} = `, ds_results);
|
||||
// // let ae_loc_tmp = get(ae_loc);
|
||||
// if (ds_type == 'json') {
|
||||
// $ae_loc.ds[ds_code] = ds_results.json;
|
||||
// } else {
|
||||
// $ae_loc.ds[ds_code] = ds_results.text;
|
||||
// }
|
||||
// // $ae_loc = $ae_loc;
|
||||
// }
|
||||
// })
|
||||
// .finally(function () {
|
||||
// // console.log(`ae_loc = `, get(ae_loc));
|
||||
// return true;
|
||||
// });
|
||||
|
||||
// console.log($slct.sponsorship_obj.address_li_json.mailing);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$: if ($slct.sponsorship_obj) {
|
||||
// Logo related
|
||||
if ($slct.sponsorship_obj.logo_li_json) {
|
||||
if ($slct.sponsorship_obj.logo_li_json.primary && $slct.sponsorship_obj.logo_li_json.primary.hosted_file_id_random) {
|
||||
placeholder_li.file_logo_primary = create_img_element({
|
||||
placeholder_li.file_logo_primary = ae_util.create_img_element({
|
||||
hosted_file_id: $slct.sponsorship_obj.logo_li_json.primary.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [logo_primary].${$slct.sponsorship_obj.logo_li_json.primary.extension}`,
|
||||
inc_link: true,
|
||||
@@ -143,7 +148,7 @@ $: if ($slct.sponsorship_obj) {
|
||||
// `<img src="${$ae_api.base_url}/hosted_file/${$slct.sponsorship_obj.logo_li_json.primary.hosted_file_id_random}/download?x_no_account_id_token=${$ae_loc.account_id}" class="max-w-64">${$slct.sponsorship_obj.logo_li_json.primary.filename}`;
|
||||
}
|
||||
if ($slct.sponsorship_obj.logo_li_json.light && $slct.sponsorship_obj.logo_li_json.light.hosted_file_id_random) {
|
||||
placeholder_li.file_logo_light = create_img_element({
|
||||
placeholder_li.file_logo_light = ae_util.create_img_element({
|
||||
hosted_file_id: $slct.sponsorship_obj.logo_li_json.light.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [logo_light].${$slct.sponsorship_obj.logo_li_json.light.extension}`,
|
||||
inc_link: true,
|
||||
@@ -152,7 +157,7 @@ $: if ($slct.sponsorship_obj) {
|
||||
// `<img src="https://dev-demo.oneskyit.com/hosted_file/download/${$slct.sponsorship_obj.logo_li_json.light.hosted_file_id_random}" class="max-w-64">${$slct.sponsorship_obj.logo_li_json.light.filename}`;
|
||||
}
|
||||
if ($slct.sponsorship_obj.logo_li_json.dark && $slct.sponsorship_obj.logo_li_json.dark.hosted_file_id_random) {
|
||||
placeholder_li.file_logo_dark = create_img_element({
|
||||
placeholder_li.file_logo_dark = ae_util.create_img_element({
|
||||
hosted_file_id: $slct.sponsorship_obj.logo_li_json.dark.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [logo_dark].${$slct.sponsorship_obj.logo_li_json.dark.extension}`,
|
||||
inc_link: true,
|
||||
@@ -164,7 +169,7 @@ $: if ($slct.sponsorship_obj) {
|
||||
// Other media files related
|
||||
if ($slct.sponsorship_obj.media_li_json) {
|
||||
if ($slct.sponsorship_obj.media_li_json.promo_video && $slct.sponsorship_obj.media_li_json.promo_video.hosted_file_id_random) {
|
||||
placeholder_li.file_media_promo_video = create_video_element({
|
||||
placeholder_li.file_media_promo_video = ae_util.create_video_element({
|
||||
hosted_file_id: $slct.sponsorship_obj.media_li_json.promo_video.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [promo_video].${$slct.sponsorship_obj.media_li_json.promo_video.extension}`,
|
||||
inc_link: true,
|
||||
@@ -450,11 +455,9 @@ async function handle_submit_form(event) {
|
||||
sponsorship_do['enable'] = !!sponsorship_di.enable;
|
||||
}
|
||||
|
||||
// if (tinyMCE.get('notes')) {
|
||||
// sponsorship_do['notes'] = tinyMCE.get('notes').getContent();
|
||||
// } else {
|
||||
if (typeof sponsorship_di.notes !== 'undefined') {
|
||||
sponsorship_do['notes'] = sponsorship_di.notes;
|
||||
// }
|
||||
}
|
||||
|
||||
console.log(sponsorship_do);
|
||||
|
||||
@@ -464,24 +467,43 @@ async function handle_submit_form(event) {
|
||||
data: sponsorship_do
|
||||
});
|
||||
console.log(ae_promises.create__sponsorship);
|
||||
$slct.sponsorship_id = ae_promises.create__sponsorship.obj_id_random;
|
||||
$ae_loc.mod.sponsorships.link = `${$ae_loc.site_domain}/sponsorships/load?sponsorship_id=${$slct.sponsorship_id}`;
|
||||
console.log('Sponsorship link:', $ae_loc.mod.sponsorships.link);
|
||||
if (ae_promises.create__sponsorship.sponsorship_id_random) {
|
||||
$slct.sponsorship_id = ae_promises.create__sponsorship.sponsorship_id_random;
|
||||
$slct.sponsorship_obj = ae_promises.create__sponsorship;
|
||||
|
||||
$ae_loc.mod.sponsorships.link = `${$ae_loc.site_domain}/sponsorships/load?sponsorship_id=${$slct.sponsorship_id}`;
|
||||
console.log('Sponsorship link:', $ae_loc.mod.sponsorships.link);
|
||||
|
||||
// This should no longer be needed! Will add a check later to trigger this or a second create if something does not look correct.
|
||||
// $slct_trigger = 'load__sponsorship_obj';
|
||||
|
||||
$ae_sess.mod.sponsorships.submit_status = 'created';
|
||||
} else {
|
||||
console.log('No sponsorship_id_random found was found. Something may have gone wrong.');
|
||||
$ae_sess.mod.sponsorships.submit_status = 'created_unknown';
|
||||
}
|
||||
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
|
||||
$ae_sess.mod.sponsorships.submit_status = 'created';
|
||||
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
} else {
|
||||
ae_promises.update__sponsorship_obj = await handle_update__sponsorship({
|
||||
obj_type: 'sponsorship',
|
||||
obj_id: $slct.sponsorship_id,
|
||||
data: sponsorship_do
|
||||
});
|
||||
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
|
||||
$ae_sess.mod.sponsorships.submit_status = 'updated';
|
||||
console.log(ae_promises.update__sponsorship_obj);
|
||||
if (ae_promises.update__sponsorship_obj.sponsorship_id_random) {
|
||||
$slct.sponsorship_obj = ae_promises.update__sponsorship_obj;
|
||||
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
// $slct_trigger = 'load__sponsorship_obj';
|
||||
$ae_sess.mod.sponsorships.submit_status = 'updated';
|
||||
} else {
|
||||
console.log('No sponsorship_id_random found was found. Something may have gone wrong.');
|
||||
$ae_sess.mod.sponsorships.submit_status = 'updated_unknown';
|
||||
|
||||
console.log('Trigger a reload of the object.');
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
}
|
||||
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
|
||||
}
|
||||
|
||||
if ($slct.sponsorship_id) {
|
||||
@@ -489,12 +511,15 @@ async function handle_submit_form(event) {
|
||||
|
||||
if ($store_current_tab == 'start' && $slct.sponsorship_id) {
|
||||
$store_current_tab = 'marketing';
|
||||
send_init_confirm_email();
|
||||
if (!$slct.sponsorship_obj.updated_on) {
|
||||
send_init_confirm_email();
|
||||
}
|
||||
|
||||
// If level is 2 or above then they can go to the exhibits tab.
|
||||
} else if ($store_current_tab == 'marketing' && $slct.sponsorship_id && $slct.sponsorship_obj.level_num >= 2) {
|
||||
$store_current_tab = 'exhibit';
|
||||
|
||||
// Move on to files
|
||||
} else if ($store_current_tab == 'marketing' && $slct.sponsorship_id && $slct.sponsorship_obj.level_num == 1) {
|
||||
$store_current_tab = 'files';
|
||||
|
||||
@@ -512,6 +537,8 @@ async function handle_submit_form(event) {
|
||||
} else if ($store_current_tab == 'files' && $slct.sponsorship_id && $slct.sponsorship_obj.level_num) {
|
||||
$store_current_tab = 'guests';
|
||||
}
|
||||
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
} else {
|
||||
console.log('No obj ID found!');
|
||||
}
|
||||
@@ -554,9 +581,13 @@ async function handle_submit_form_files(event) {
|
||||
if (hosted_file_results) {
|
||||
sponsorship_do.logo_li_json.primary = hosted_file_results[0];
|
||||
// console.log(sponsorship_do.logo_li_json);
|
||||
placeholder_li.file_logo_primary = create_img_element({
|
||||
placeholder_li.file_logo_primary = ae_util.create_img_element({
|
||||
account_id: $ae_loc.account_id,
|
||||
base_url: $ae_api.base_url,
|
||||
hosted_file_id: sponsorship_do.logo_li_json.primary.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [logo_primary].${sponsorship_do.logo_li_json.primary.extension}`,
|
||||
// style: 'max-width: 20em;',
|
||||
inc_link: true,
|
||||
})
|
||||
|
||||
// `<img src="https://dev-api.oneskyit.com/hosted_file/${sponsorship_do.logo_li_json.primary.hosted_file_id_random}/download?x_no_account_id_token=${$ae_loc.account_id}" class="max-w-64">${sponsorship_do.logo_li_json.primary.filename}`;
|
||||
@@ -571,9 +602,13 @@ async function handle_submit_form_files(event) {
|
||||
if (hosted_file_results) {
|
||||
sponsorship_do.logo_li_json.light = hosted_file_results[0];
|
||||
// console.log(sponsorship_do.logo_li_json);
|
||||
placeholder_li.file_logo_light = create_img_element({
|
||||
placeholder_li.file_logo_light = ae_util.create_img_element({
|
||||
account_id: $ae_loc.account_id,
|
||||
base_url: $ae_api.base_url,
|
||||
hosted_file_id: sponsorship_do.logo_li_json.light.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [logo_light].${sponsorship_do.logo_li_json.light.extension}`,
|
||||
// style: 'max-width: 20em;',
|
||||
inc_link: true,
|
||||
})
|
||||
|
||||
// `<img src="/hosted_file/download/${sponsorship_do.logo_li_json.light.hosted_file_id_random}" class="max-w-64">${sponsorship_do.logo_li_json.light.filename}`;
|
||||
@@ -588,9 +623,13 @@ async function handle_submit_form_files(event) {
|
||||
if (hosted_file_results) {
|
||||
sponsorship_do.logo_li_json.dark = hosted_file_results[0];
|
||||
// console.log(sponsorship_do.logo_li_json);
|
||||
placeholder_li.file_logo_dark = create_img_element({
|
||||
placeholder_li.file_logo_dark = ae_util.create_img_element({
|
||||
account_id: $ae_loc.account_id,
|
||||
base_url: $ae_api.base_url,
|
||||
hosted_file_id: sponsorship_do.logo_li_json.dark.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [logo_dark].${sponsorship_do.logo_li_json.dark.extension}`,
|
||||
// style: 'max-width: 20em;',
|
||||
inc_link: true,
|
||||
})
|
||||
|
||||
// `<img src="/hosted_file/download/${sponsorship_do.logo_li_json.dark.hosted_file_id_random}" class="max-w-64">${sponsorship_do.logo_li_json.dark.filename}`;
|
||||
@@ -605,9 +644,13 @@ async function handle_submit_form_files(event) {
|
||||
if (hosted_file_results) {
|
||||
sponsorship_do.media_li_json.promo_video = hosted_file_results[0];
|
||||
// console.log(sponsorship_do.media_li_json);
|
||||
placeholder_li.file_media_promo_video = create_video_element({
|
||||
placeholder_li.file_media_promo_video = ae_util.create_video_element({
|
||||
account_id: $ae_loc.account_id,
|
||||
base_url: $ae_api.base_url,
|
||||
hosted_file_id: sponsorship_do.media_li_json.promo_video.hosted_file_id_random,
|
||||
filename: `${$slct.sponsorship_obj.name} [promo_video].${sponsorship_do.media_li_json.promo_video.extension}`,
|
||||
style: 'max-width: 20em;',
|
||||
inc_link: true,
|
||||
})
|
||||
|
||||
// `<video src="/hosted_file/download/${sponsorship_do.media_li_json.promo_video.hosted_file_id_random}" controls class="max-w-64"></video>${sponsorship_do.media_li_json.promo_video.filename}`;
|
||||
@@ -622,12 +665,27 @@ async function handle_submit_form_files(event) {
|
||||
obj_id: $slct.sponsorship_id,
|
||||
data: sponsorship_do
|
||||
});
|
||||
console.log(ae_promises.update__sponsorship_obj);
|
||||
if (ae_promises.update__sponsorship_obj.sponsorship_id_random) {
|
||||
$slct.sponsorship_obj = ae_promises.update__sponsorship_obj;
|
||||
|
||||
// $slct_trigger
|
||||
$ae_sess.mod.sponsorships.submit_status = 'updated';
|
||||
} else {
|
||||
console.log('No sponsorship_id_random was found. Something may have gone wrong.');
|
||||
$ae_sess.mod.events.submit_status = 'updated_unknown';
|
||||
|
||||
console.log('Trigger a reload of the object.');
|
||||
$slct_trigger = 'load__sponsorship_obj';
|
||||
}
|
||||
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
|
||||
$ae_sess.mod.sponsorships.submit_status = 'updated';
|
||||
|
||||
if ($store_current_tab == 'files') {
|
||||
$store_current_tab = 'guests';
|
||||
}
|
||||
|
||||
console.log('Trigger a reload of the object list.');
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
}
|
||||
|
||||
|
||||
@@ -674,6 +732,7 @@ async function handle_create__sponsorship({
|
||||
obj_type: obj_type,
|
||||
fields: data,
|
||||
key: $ae_api.api_crud_super_key,
|
||||
return_obj: true,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then(async function (create__obj_result) {
|
||||
@@ -728,10 +787,11 @@ async function handle_update__sponsorship({
|
||||
}
|
||||
|
||||
function send_init_confirm_email() {
|
||||
console.log(`*** send_init_confirm_email() *** to ${$slct.sponsorship_obj.poc_json.email}.`)
|
||||
console.log(`*** send_init_confirm_email() *** to ${$slct.sponsorship_obj.poc_json.email}.`);
|
||||
|
||||
let subject = `CHOW 2024 Sponsor Hub Link for ${$slct.sponsorship_obj.name} (ID: ${$slct.sponsorship_id})`;
|
||||
|
||||
let body_html = `<p>Thank you for your submission to the Sponsorship 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.sponsorship_obj.name} (Sponsor ID: ${$slct.sponsorship_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.sponsorships.link}">${$ae_loc.mod.sponsorships.link}</a></p>`
|
||||
let body_html = `<p>Thank you for your submission to the Sponsorship 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.sponsorship_obj.name} (Sponsor ID: ${$slct.sponsorship_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.sponsorships.link}">${$ae_loc.mod.sponsorships.link}</a></p>`;
|
||||
|
||||
api.send_email({
|
||||
api_cfg: $ae_api,
|
||||
@@ -756,6 +816,66 @@ function send_confirm_email() {
|
||||
body_html: body_html,
|
||||
});
|
||||
}
|
||||
|
||||
// let delete_sponsorship_obj_promise: Promise<any>;
|
||||
let delete_sponsorship_obj_promise;
|
||||
async function handle_delete_sponsorship_obj({sponsorship_id, hosted_file_id=null, method='delete'}) {
|
||||
console.log('*** handle_delete_sponsorship_obj() ***');
|
||||
|
||||
if (hosted_file_id) {
|
||||
// let delete_hosted_file_obj_promise = api.delete_hosted_file({
|
||||
// api_cfg: $ae_api,
|
||||
// hosted_file_id: hosted_file_id,
|
||||
// link_to_type: 'sponsorship',
|
||||
// link_to_id: sponsorship_id,
|
||||
// rm_orphan: true,
|
||||
// // params: params,
|
||||
// key: $ae_api.api_crud_super_key,
|
||||
// log_lvl: 2
|
||||
// })
|
||||
// .then(function (hosted_file_obj_delete_result) {
|
||||
// if (hosted_file_obj_delete_result) {
|
||||
// // console.log(`Result:`, hosted_file_obj_delete_result);
|
||||
|
||||
// dispatch(
|
||||
// 'deleted__hosted_file_obj',
|
||||
// {
|
||||
// hosted_file_id: hosted_file_id,
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log('The result was null or false when trying to delete.', error);
|
||||
// });
|
||||
}
|
||||
|
||||
delete_sponsorship_obj_promise = await api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'sponsorship',
|
||||
obj_id: sponsorship_id,
|
||||
method: method,
|
||||
// params: params,
|
||||
key: $ae_api.api_crud_super_key,
|
||||
log_lvl: 2
|
||||
})
|
||||
.then(function (sponsorship_obj_delete_result) {
|
||||
if (sponsorship_obj_delete_result) {
|
||||
// console.log(`Result:`, sponsorship_obj_delete_result);
|
||||
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
console.log('Trigger a reload of the object list.');
|
||||
$slct_trigger = 'load__sponsorship_obj_li';
|
||||
|
||||
parent.onClose();
|
||||
|
||||
return delete_sponsorship_obj_promise;
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- @component This is the Sponsorships modal edit form. -->
|
||||
@@ -763,12 +883,11 @@ function send_confirm_email() {
|
||||
{#if $modalStore[0]}
|
||||
<div class="svelte_component ae_edit_modal ae_obj__sponsorship {container_class_li}">
|
||||
<header class={parent.regionHeader}>
|
||||
<h2>{$modalStore[0].title ?? '-- No Title --'}:
|
||||
{$slct.sponsorship_obj.level_str ?? '-- Please Select Level --'}
|
||||
<h2 class="h3">{$modalStore[0].title ?? '-- No Title --'}:
|
||||
{$slct.sponsorship_obj.level_str ?? '-- Fill out and save --'}
|
||||
<!-- ({$slct.sponsorship_obj.level_num}) -->
|
||||
</h2>
|
||||
|
||||
|
||||
{#await ae_promises.update__sponsorship_obj}
|
||||
<div class="modal-loading">
|
||||
<span class="fas fa-spinner fa-spin"></span>
|
||||
@@ -931,6 +1050,10 @@ function send_confirm_email() {
|
||||
{#if $store_current_tab === 'start'}
|
||||
|
||||
|
||||
<section class="space-y-4">
|
||||
|
||||
<h3 class="h4">CHOW 2024 Sponsor Information</h3>
|
||||
|
||||
<form
|
||||
class="modal-form {$ae_loc.hub.classes__form}"
|
||||
on:submit|preventDefault={handle_submit_form}
|
||||
@@ -1140,7 +1263,7 @@ function send_confirm_email() {
|
||||
id="poc_email"
|
||||
name="poc_email"
|
||||
placeholder="Email"
|
||||
value={($slct.sponsorship_obj.poc_json && $slct.sponsorship_obj.poc_json.email ? $slct.sponsorship_obj.poc_json.email : '')}
|
||||
bind:value={$slct.sponsorship_obj.poc_json.email}
|
||||
autocomplete="email"
|
||||
readonly={!$ae_loc.trusted_access && $slct.sponsorship_obj.sposorship_id_random}
|
||||
required
|
||||
@@ -1385,22 +1508,31 @@ function send_confirm_email() {
|
||||
disabled={($ae_sess.mod.sponsorships.disable_submit__sponsorship_obj)}
|
||||
on:click={() => {
|
||||
console.log('*** Start save and continue button clicked ***');
|
||||
// if (!confirm(`Are you sure you want to save this sponsorship? A confirmation email will be sent to ${$slct.sponsorship_obj.email}?`)) {return false;}
|
||||
// handle_submit_form();
|
||||
// handle_submit_form;
|
||||
}}
|
||||
>
|
||||
if (!$slct.sponsorship_obj.poc_json.email) {
|
||||
if (alert(`You have not entered an email address.`)) {return false;}
|
||||
}
|
||||
|
||||
if ($slct.sponsorship_obj.updated_on) {
|
||||
if (!confirm(`Would you like an email with a link back to this for be sent to you at ${$slct.sponsorship_obj.poc_json.email}? Your information will be saved either way.`)) {
|
||||
send_init_confirm_email();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-check mx-1"></span>
|
||||
Save and continue
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
{:else if $store_current_tab === 'marketing'}
|
||||
|
||||
|
||||
|
||||
<form
|
||||
class="modal-form {$ae_loc.hub.classes__form}"
|
||||
on:submit|preventDefault={handle_submit_form}
|
||||
@@ -2126,6 +2258,7 @@ function send_confirm_email() {
|
||||
class="select text-xs"
|
||||
id="guest_{index}_ada"
|
||||
name="guest_{index}_ada"
|
||||
value={guest.ada}
|
||||
>
|
||||
<option value="">-- None --</option>
|
||||
<option value="mobility">Mobility</option>
|
||||
@@ -2140,6 +2273,7 @@ function send_confirm_email() {
|
||||
class="select text-xs"
|
||||
id="guest_{index}_dietary"
|
||||
name="guest_{index}_dietary"
|
||||
value={guest.dietary}
|
||||
>
|
||||
<option value="">-- None --</option>
|
||||
<option value="vegetarian">Vegetarian</option>
|
||||
|
||||
@@ -83,7 +83,8 @@ onMount(() => {
|
||||
ae_util.handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
|
||||
if ($slct.sponsorship_id) {
|
||||
console.log(`Got an ID. Let's show the modal!`);
|
||||
modalStore.trigger(modal_edit__sponsorship_obj);
|
||||
// This causes a problem frequently... See through...
|
||||
// modalStore.trigger(modal_edit__sponsorship_obj);
|
||||
} else {
|
||||
console.log(`No ID. Nothing to show.`);
|
||||
}
|
||||
@@ -252,6 +253,16 @@ $: if (testing) {
|
||||
|
||||
<section>
|
||||
{#if $slct.sponsorship_id}
|
||||
|
||||
<div class="text-center m-4">
|
||||
{#if $slct.event_presenter_obj}
|
||||
<p class="font-bold">Welcome to the Sponsor Hub {$slct.sponsorship_obj.name}!</p>
|
||||
{:else}
|
||||
<p>Welcome to the Sponsor Hub!</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
<button
|
||||
class="btn variant-ghost-primary w-96"
|
||||
on:click={() => {
|
||||
|
||||
Reference in New Issue
Block a user