Moving older event_speakers and sponsorships modules to backups.

This commit is contained in:
Scott Idem
2025-10-03 14:49:17 -04:00
parent a2f2742f30
commit c949581429
19 changed files with 0 additions and 6895 deletions

View File

@@ -1,44 +0,0 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data: any;
import { onMount } from 'svelte';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
// 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);
let ae_acct = data[$slct.account_id];
// console.log(`ae_acct = `, ae_acct);
// $ae_loc = data.ae_loc;
$ae_loc.mod.events.event_id = data.ae_slct.event_id;
// $events_slct.event_id = ae_acct.slct.event_id
// $events_slct.event_obj = ae_acct.slct.event_obj
// We want to loop through all of the data store (ds) key value pairs and set them to localStorage
if (data.ae_ds) {
for (let [key, value] of Object.entries(data.ae_ds)) {
console.log(`ae_ds__ key: ${key}, value:`, value);
localStorageStore(`ae_ds__${key}`, value);
}
}
onMount(() => {
// console.log(`$slct.event_id = `, $slct.event_id);
if (data.url.searchParams.get('event_id')) {
$slct.event_id = data.url.searchParams.get('event_id');
$ae_loc.mod.events.event_id = data.url.searchParams.get('event_id');
}
});
</script>
<svelte:head>
<title>Speaker Hub - {$ae_loc.title ?? 'Æ loading...'}</title>
</svelte:head>
<slot></slot>

View File

@@ -1,99 +0,0 @@
/** @type {import('./$types').LayoutLoad} */
console.log(`ae_events_speakers +layout.ts start`);
// import { browser } from '$app/environment';
// import type { key_val } from '$lib/ae_stores';
// import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { core_func } from '$lib/ae_core/ae_core_functions';
// import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';
import { events_func } from '$lib/ae_events_functions';
export async function load({ parent }) {
let data = await parent();
let account_id = data.account_id;
let ae_acct = data[account_id];
// console.log(`ae_acct = `, ae_acct);
// if (!account_id) {
// console.log(`events_speakers +layout.ts: The account_id was not found in the data!!!`);
// return false;
// }
let event_id = ae_acct.slct.event_id;
if (!event_id) {
console.log(`events_speakers +layout.ts: The event_id was not found in the data!!!`);
return false;
}
let load_event_obj = events_func.load_ae_obj_id__event({
api_cfg: ae_acct.api,
event_id: event_id,
try_cache: true
});
ae_acct.slct.event_obj = load_event_obj;
data.ae_events_speakers_layout_ts = true;
let ds_code_li = {}; //: key_val; // = ae_loc_tmp.ds;
// console.log(`ae_ ds_code_li = `, ds_code_li);
let ds_code: string = '';
let ds_type: null|string = null;
ds_code = 'hub__page__events_speakers__create_info_header';
ds_type = 'text';
// ds_code_li[ds_code]
ae_acct['ds'][ds_code] = core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_acct.api, code: ds_code, data_type: ds_type, save_idb: true})
.then(function (ds_results) {
if (ds_results) {
// console.log(`ae_ ds_results = `, ds_results);
return ds_results;
}
}
);
ds_code = 'hub__page__events_speakers__create_info';
ds_type = 'text';
// ds_code_li[ds_code]
ae_acct['ds'][ds_code] = core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_acct.api, code: ds_code, data_type: ds_type, save_idb: true})
.then(function (ds_results) {
if (ds_results) {
// console.log(`ae_ ds_results = `, ds_results);
return ds_results;
}
}
);
// let ae_ds_tmp = ae_loc_tmp.ds;
// // Merge the new data into the existing data
// // ae_ds_tmp = {
// // ...ae_ds_tmp,
// // ...ds_code_li,
// // }
// // ae_loc_tmp = {
// // ...ae_loc_tmp,
// // 'ds': ae_ds_tmp,
// // }
// // console.log(`ae_loc = `, ae_loc_tmp);
// data['ae_loc'] = ae_loc_tmp;
data['ae_ds'] = {
...data['ae_ds'],
...ae_acct['ds']
}
// WARNING: Precaution against shared data between sites and sessions.
data[account_id] = ae_acct;
return data;
}
// export const prerender = true;

View File

@@ -1,452 +0,0 @@
<script lang="ts">
export let data: any;
// console.log(`ae_ Svelte Events Speakers +page data:`, data);
import { onMount } from 'svelte';
// https://github.com/skeletonlabs/skeleton/blob/master/packages/skeleton/src/lib/utilities/Modal/types.ts
// To retrieve the store, getModalStore must be invoked at the top level of your component!
import type {
ModalSettings,
ModalComponent,
} from '@skeletonlabs/skeleton-svelte';
const modalStore = getModalStore();
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { core_func } from '$lib/ae_core/ae_core_functions';
import { ae_util } from '$lib/ae_utils/ae_utils';
import type { key_val } from '$lib/ae_stores';
import Edit_modal_event_presenter_obj from './10_edit_modal__event_presenter_obj.svelte';
import List_event_presenter_obj from './10_list__event_presenter_obj.svelte';
import View_modal_event_presenter_obj from './10_view_modal__event_presenter_obj.svelte';
let ae_promises: key_val = {};
// Editing
const modalComponentEditEventPresenterObj: ModalComponent = { ref: Edit_modal_event_presenter_obj, props: {container_class_li: 'w-full p-4 space-y-4 card ae_modal_scrollfix'} };
const modal_edit__event_presenter_obj: ModalSettings = {
type: 'component',
component: modalComponentEditEventPresenterObj,
title: 'Speaker Form', // Editing Event Presenter
position: '', // default is "items-center"
response: (r: boolean | undefined) => handle_modal_close(r)
};
// Viewing
const modalComponentViewEventPresenterObj: ModalComponent = { ref: View_modal_event_presenter_obj, props: {container_class_li: 'w-full p-4 space-y-4 card ae_modal_scrollfix'} };
const modal_view__event_presenter_obj: ModalSettings = {
type: 'component',
component: modalComponentViewEventPresenterObj,
title: 'Speaker Submission', // Viewing Event Presenter
position: '', // default is "items-center"
// Provide arbitrary classes to the backdrop and modal elements:
// backdropClasses: 'bg-green-500!',
// modalClasses: 'w-modal-wide',
// modalClasses: 'w-full',
// Provide arbitrary metadata to your modal instance:
// meta: {
// component_root_classes: 'w-full',
// fn: do_something_function
// },
response: (r: boolean | undefined) => handle_modal_close(r)
};
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response);
ae_util.handle_url_and_message('event_presenter_id', null);
// We do NOT want to keep these values if it is closed and not just switching from view to edit. A "smart" transition?
if (!$ae_loc.mod.events.show_edit__event_presenter_obj || !$ae_loc.mod.events.show_view__event_presenter_obj) {
console.log('Clearing event_presenter_id and event_presenter_obj');
$slct.event_presenter_id = null;
if ($slct.event_presenter_obj) {
console.log('Clearing event_presenter_obj');
$slct.event_presenter_obj = null;
}
} else {
console.log('Not clearing event_presenter_id and event_presenter_obj');
console.log(`show_edit__event_presenter_obj: ${$ae_loc.mod.events.show_edit__event_presenter_obj}`);
console.log(`show_view__event_presenter_obj: ${$ae_loc.mod.events.show_view__event_presenter_obj}`);
}
}
$ae_loc.hostname = data.url.hostname;
$ae_loc.site_domain = data.url.origin;
// We don't want the edit or view to show up by default. Maybe if we see an object ID param in the URL, we can show the view modal.
$ae_loc.mod.events.show_edit__event_presenter_obj = false;
$ae_loc.mod.events.show_view__event_presenter_obj = false;
if ($ae_loc.trusted_access) {
$ae_loc.mod.events.show_list__event_presenter_obj_li = true;
} else {
$ae_loc.mod.events.show_list__event_presenter_obj_li = false;
}
let ae_event_id_get_promise: Promise<any>;
let ae_event_presenter_obj_li_get_promise: Promise<any>;
let ae_event_presenter_obj_get_promise: Promise<any>;
// This might need to be reviewed and compared to sponsorships version again
if ($slct.event_id) {
handle_load_ae_obj_li__event_presenter({
event_id: $slct.event_id,
try_cache: false
});
// $slct.event_id = $ae_loc.mod.events.event_id;
// handle_load_ae_obj_id__event({event_id: $slct.event_id, try_cache: false});
}
onMount(() => {
console.log('Events - Speakers: +page.svelte');
// console.log(`$ae_loc = `, $ae_loc);
let href_url = window.location.href;
// console.log(href_url);
$ae_loc.href_url = href_url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
// $slct_trigger = 'msg_parent';
ae_util.handle_url_and_message('event_id', $slct.event_id);
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 clear the modal store just in case!`);
modalStore.clear();
// console.log(`Got an ID. Let's show the modal!`);
// modalStore.trigger(modal_edit__event_presenter_obj);
// $slct_trigger = 'load__event_presenter_obj';
}
});
$: if ($slct_trigger == 'show_edit__event_presenter_obj' && $ae_loc.mod.events.show_edit__event_presenter_obj) {
console.log('Show Modal Edit');
$slct_trigger = null;
if ($slct.event_presenter_id) {
let location = window.location.href;
const url = new URL(location);
url.searchParams.set('event_presenter_id', $slct.event_presenter_id);
history.pushState({}, '', url);
let message = {'event_presenter_id': $slct.event_presenter_id};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
}
// modalStore.clear();
modalStore.trigger(modal_edit__event_presenter_obj);
}
$: if ($slct_trigger == 'show_view__event_presenter_obj' && $ae_loc.mod.events.show_view__event_presenter_obj) {
console.log('Show Modal View');
$slct_trigger = null;
let location = window.location.href;
const url = new URL(location);
url.searchParams.set('event_presenter_id', $slct.event_presenter_id);
history.pushState({}, '', url);
// modalStore.clear();
modalStore.trigger(modal_view__event_presenter_obj);
let message = {'event_presenter_id': $slct.event_presenter_id};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
}
$: if ($slct_trigger == 'load__event_presenter_obj_li' && $slct.event_id) {
console.log(`load__event_presenter_obj_li event_id: ${$slct.event_id}`);
$slct_trigger = null;
// handle_load_ae_obj_id__event({event_id: $slct.event_id, try_cache: false});
handle_load_ae_obj_li__event_presenter({
event_id: $slct.event_id, try_cache: false
});
}
async function handle_load_ae_obj_li__event_presenter({event_id, try_cache=true}) {
console.log('*** handle_load_ae_obj_li__event_presenter() ***');
// console.log($ae_loc.mod.events);
let enabled: string = ($ae_loc.qry__enabled ?? 'enabled'); // all, disabled, enabled
let hidden: string = ($ae_loc.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
let limit: number = ($ae_loc.qry__limit ?? 199); // 99
let offset: number = ($ae_loc.qry__offset ?? 0); // 0
if ($ae_loc.administrator_access) {
enabled = 'all';
hidden = 'all';
limit = 350;
} else if ($ae_loc.trusted_access) {
enabled = 'enabled';
// hidden = 'not_hidden';
limit = 250;
} else {
enabled = 'enabled';
// hidden = 'not_hidden';
limit = 25;
}
// let enabled = $ae_loc.mod.events.enabled;
// let hidden = $ae_loc.mod.events.hidden;
// let limit = $ae_loc.mod.events.limit;
// let offset = $ae_loc.mod.events.offset;
let params = {};
let params_json: key_val = {};
// console.log('params_json:', params_json);
// console.log(params_json);
$ae_loc.mod.events.qry_status = 'loading';
ae_event_presenter_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'event_presenter',
for_obj_type: 'event',
for_obj_id: event_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 in the API config.
enabled: enabled,
hidden: hidden,
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'},
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
limit: limit,
offset: offset,
params_json: params_json,
params: params,
log_lvl: 1
})
.then(function (event_presenter_obj_li_get_result) {
if (event_presenter_obj_li_get_result) {
$slct.event_presenter_obj_li = event_presenter_obj_li_get_result;
} else {
$slct.event_presenter_obj_li = [];
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
})
.finally(function () {
$ae_loc.mod.events.qry_status = 'done';
console.log('Object list:', $slct.event_presenter_obj_li);
});
return ae_event_presenter_obj_li_get_promise;
}
// load_ae_obj_li__event() was done in layout.ts
// This is different from how the sponsorships are loaded.
// Do we need anything from the event object to load the presenters?
// Load the Event Presenter Obj with ID based on the URL param.
$: if ($slct_trigger == 'load__event_presenter_obj' && $slct.event_presenter_id) {
console.log('Selected Event Presenter ID:', $slct.event_presenter_id);
$slct_trigger = null;
handle_load_ae_obj_id__event_presenter({
event_presenter_id: $slct.event_presenter_id, try_cache: false
});
}
async function handle_load_ae_obj_id__event_presenter({event_presenter_id, try_cache=false}) {
console.log(`*** handle_load_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}`);
let params = {};
// $ae_sess.hub.event_presenter_id_qry_status = 'loading';
ae_event_presenter_obj_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'event_presenter',
obj_id: event_presenter_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 in the API config.
params: params,
log_lvl: 1
})
.then(function (event_presenter_obj_get_result) {
if (event_presenter_obj_get_result) {
$slct.event_presenter_obj = event_presenter_obj_get_result;
console.log(`event presenter object:`, $slct.event_presenter_obj);
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_event_presenter_obj_get_promise;
}
// // let delete_event_presenter_obj_promise: Promise<any>;
// let delete_event_presenter_obj_promise;
// async function handle_delete_event_presenter_obj({event_presenter_id, hosted_file_id=null, method='delete'}) {
// console.log('*** handle_delete_event_presenter_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: 'event_presenter',
// // link_to_id: event_presenter_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_event_presenter_obj_promise = api.delete_ae_obj_id_crud({
// api_cfg: $ae_api,
// obj_type: 'event_presenter',
// obj_id: event_presenter_id,
// method: method,
// // params: params,
// key: $ae_api.api_crud_super_key,
// log_lvl: 0
// })
// .then(function (event_presenter_obj_delete_result) {
// if (event_presenter_obj_delete_result) {
// // console.log(`Result:`, event_presenter_obj_delete_result);
// }
// })
// .catch(function (error) {
// console.log('The result was null or false when trying to delete.', error);
// });
// return delete_event_presenter_obj_promise;
// }
</script>
<section class="ae_events_speakers md:container h-full mx-auto flex flex-col items-center space-y-4">
<header>
<h1 class="h1 text-center">
<!-- &AElig; - Events: Speakers -->
Speaker Hub
</h1>
</header>
<section>
<button
class="btn preset-tonal-primary border border-primary-500"
on:click={() => {
// $ae_loc.mod.events.show_edit__event_presenter_obj = true;
$slct.event_presenter_id = null;
$slct.event_presenter_obj = null;
// modalStore.trigger(modal_edit__event_presenter_obj);
$ae_loc.mod.events.show_edit__event_presenter_obj = true;
$slct_trigger = 'show_edit__event_presenter_obj';
}}
>
<span class="fas fa-edit mx-1"></span>
Start Speaker Submission Form
</button>
{#if $ae_loc.trusted_access}
<button
type="button"
on:click={() => {
if (!confirm('Download exported data Excel file?')) {
return false;
}
ae_promises.download__events_speakers_export = core_func.handle_download_export__obj_type({
api_cfg: $ae_api,
get_obj_type: 'event_presenter',
for_obj_type: 'event',
for_obj_id: $slct.event_id,
file_type: 'Excel',
return_file: true,
filename: `${$ae_loc.account_code}_Speakers_Hub_export_${ae_util.iso_datetime_formatter()}.xlsx`,
auto_download: true,
log_lvl: 2
});
}}
class="btn btn-sm preset-tonal-warning border border-warning-500 w-42 mb-1 export_data_btn text-xs"
title={`Download sponsorship data for ${$ae_loc.account_name}`}
>
{#await ae_promises.download__sponsorship_export}
<span class="fas fa-spinner fa-spin"></span>
<!-- <span class="loading-text">
Downloading...
</span> -->
{:then}
<!-- Done? -->
{/await}
<span class="fas fa-download mx-1"></span> Export All Data
</button>
{/if}
</section>
<section class="events_speakers_list ae_h_scrollfix">
{#await ae_event_presenter_obj_li_get_promise}
<span class="fas fa-spinner fa-spin"></span>
<span class="loading-text">
Loading...
</span>
{/await}
{#if $slct.event_presenter_obj_li && $ae_loc.mod.events.show_list__event_presenter_obj_li}
<List_event_presenter_obj class_li=""/>
{/if}
</section>
</section>
<style lang="postcss">
</style>

View File

@@ -1,148 +0,0 @@
<script lang="ts">
// *** Import Svelte core
import { onMount } from 'svelte';
// *** Import Aether core variables and functions
import { ae_util } from '$lib/ae_utils/ae_utils';
// import { ae } from 'aether_npm_lib';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
export let class_li: string = '';
onMount(() => {
console.log('** Component Mounted: ** List - Event Presenters Obj');
});
</script>
<section class="svelte_component ae_section ae_list list__event_presenter_obj event_presenter_obj_li {class_li}">
{#if $slct.event_presenter_obj_li}
<table class="table table-compact ">
<thead>
<tr>
<th>Options</th>
<th>Name</th>
<th>Email</th>
<th>Affiliations</th>
<th>Created</th>
<th>Updated</th>
</tr>
</thead>
<tbody>
{#each $slct.event_presenter_obj_li as ae_event_presenter_obj, index}
<tr
id={`ae_event_presenter_id__${ae_event_presenter_obj.event_presenter_id_random}`}
class="ae_object event_presenter_obj"
>
<td class="ae_options event_presenter_obj__options">
<div class=" preset-filled">
<button
on:click={() => {
$slct.event_presenter_id = ae_event_presenter_obj.event_presenter_id_random;
$slct.event_presenter_obj = ae_event_presenter_obj;
console.log(`Selected Event Presenter ID: ${$slct.event_presenter_id}`);
console.log(`Selected Event Presenter Object:`, $slct.event_presenter_obj);
$ae_loc.mod.events.show_main__options = true;
$ae_loc.mod.events.show_edit__event_presenter_obj = false;
$ae_loc.mod.events.show_list__event_presenter_obj_li = true;
$ae_loc.mod.events.show_view__event_presenter_obj = true;
$slct_trigger = 'show_view__event_presenter_obj';
}}
class="preset-tonal-primary"
title={`Open to see details: ${ae_event_presenter_obj.name}`}
>
<span class="fas fa-envelope-open mx-1"></span>
<!-- <span class="fas fa-info-circle"></span> -->
View
</button>
{#if $ae_loc.trusted_access}
<button
on:click={() => {
$slct.event_presenter_id = ae_event_presenter_obj.event_presenter_id_random;
$slct.event_presenter_obj = ae_event_presenter_obj;
console.log(`Selected Event Presenter ID: ${$slct.event_presenter_id}`);
console.log(`Selected Event Presenter Object:`, $slct.event_presenter_obj);
// $slct_trigger = 'load__event_presenter_obj';
$ae_loc.mod.events.show_main__options = true;
$ae_loc.mod.events.show_edit__event_presenter_obj = true;
$ae_loc.mod.events.show_list__event_presenter_obj_li = true;
$ae_loc.mod.events.show_view__event_presenter_obj = false;
$slct_trigger = 'show_edit__event_presenter_obj';
}}
class="preset-tonal-warning"
title={`Edit event presenter: ${ae_event_presenter_obj.name}`}
>
<span class="fas fa-edit mx-1"></span> Edit
</button>
{/if}
</div>
</td>
<td class="ae_value event_presenters__name">{ae_event_presenter_obj.full_name}</td>
<td class="">
{#if ae_event_presenter_obj.email}
<a href="mailto:{ae_event_presenter_obj.email}"><span class="fas fa-envelope"></span> {ae_event_presenter_obj.email}</a>
{:else}
-- None --
{/if}
</td>
<td>
{ae_event_presenter_obj.affiliations ?? '-- None --'}
</td>
<td><span class="text-xs">{ae_util.iso_datetime_formatter(ae_event_presenter_obj.created_on, 'datetime_short')}</span></td>
<td><span class="text-xs">{ae_util.iso_datetime_formatter(ae_event_presenter_obj.updated_on, 'datetime_short')}</span></td>
</tr>
{/each}
</tbody>
<tfoot>
<tr>
<th colspan="6" class="">
Total Count:
{$slct.event_presenter_obj_li.length}
</th>
</tr>
</tfoot>
</table>
{:else}
<div>No event presenters available to show at this time</div>
{/if}
</section>
<style>
.ae_label {
font-size: smaller;
}
.ae_value {
font-weight: bold;
}
/*
.ae_header h3 {
font-size: 1.2em;
margin: 0;
}
.event_presenter_obj .ae_meta {
flex-direction: column;
}
.event_presenter_obj .ae_meta .ae_group {
flex-direction: row;
}
.event_presenter_obj .ae_meta .ae_options {
flex-direction: row;
justify-content: space-between;
}
*/
</style>

View File

@@ -1,215 +0,0 @@
<script lang="ts">
import type { SvelteComponent } from 'svelte';
import { onMount } from 'svelte';
// This works and uses local storage:
// store_current_tab must be prefixed with $ to be reactive.
import { Tab, FileUpload, ProgressRing, Segment, Tabs } from '@skeletonlabs/skeleton-svelte';
import type { Writable } from 'svelte/store';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
// Stores
// Props
/** Exposes parent props to this component. */
export let parent: SvelteComponent;
console.log(`Parent:`, parent);
export let container_class_li = '';
const modalStore = getModalStore();
if ($slct.event_presenter_id) {
console.log(`Presenter ID selected: ${$slct.event_presenter_id}`);
console.log(`Presenter object selected:`, $slct.event_presenter_obj);
$slct_trigger = 'load__event_presenter_obj';
}
onMount(() => {
console.log('** Component Mounted: ** View Modal - Presenter Obj');
});
</script>
<!-- @component This is the Presenters modal view form. -->
{#if $modalStore[0]}
<section class="svelte_component ae_view_modal ae_obj__event_presenter {container_class_li} p-4 space-y-4">
<header class={parent.regionHeader}>
{@html $slct.event_presenter_obj.full_name}
<button class="btn preset-tonal-primary float-end" on:click={parent.onClose}>
<span class="fas fa-times mx-1"></span>
Close
</button>
</header>
<p>This quick view of a presenter's information is customizable or can be hidden completely.</p>
<div class="event_presenter__content space-y-4">
<div
class="event_presenter_biography biography"
>
<h2 class="h4">Biography:</h2>
<pre class="event_presenter__biography pre_wrap">{@html $slct.event_presenter_obj.biography ? $slct.event_presenter_obj.biography : '-- No Bio Given --'}</pre>
</div>
<div
class="event_presenter__professional_title"
>
<span class="ae_label">Professional Title:</span>
<span class="ae_value">{@html $slct.event_presenter_obj.professional_title ? $slct.event_presenter_obj.professional_title : '-- No Title Given --'}</span>
</div>
<div
class="event_presenter__affiliations"
>
<span class="ae_label">Affiliations:</span>
<span class="ae_value">{@html $slct.event_presenter_obj.affiliations ? $slct.event_presenter_obj.affiliations : '-- No Affiliations Given --'}</span>
</div>
<div
class="event_presenter__email"
>
<span class="ae_label">Email:</span>
<span class="ae_value"><span class="fas fa-envelope"></span>
<a href="mailto:{$slct.event_presenter_obj.email}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.event_presenter_obj.email}</a></span>
</div>
<div
class:ae_d_none={!$slct.event_presenter_obj.phone_mobile}
class="event_presenter_phone_mobile"
>
<span class="ae_label">Phone:</span>
<span class="ae_value"><span class="fas fa-phone"></span> {$slct.event_presenter_obj.phone_mobile}{$slct.event_presenter_obj.phone_mobile}</span>
</div>
<!-- <div>
<span class="ae_label">Approved:</span>
<span class="ae_value">
{$slct.event_presenter_obj.approve ? 'Yes, marked as approved' : 'Not yet marked as approved'}
</span>
</div> -->
<!-- <div class="ae_list event_presenter__guests">
<h2>More Information</h2>
<div class="ae_warning">More info can go here</div>
</div> -->
<section class="card-footer ae_section ae_meta event_presenter__meta">
<div class="ae_group">
<span
class="event_presenter__id"
class:ae_d_none={!$ae_loc.administrator_access}>
ID:
{$slct.event_presenter_obj.event_presenter_id_random}
</span>
<span
class="event_presenter__created_on"
>
Created on: {ae_util.iso_datetime_formatter($slct.event_presenter_obj.created_on, 'datetime_short')}
</span>
<span
class="event_presenter__updated_on"
class:ae_d_none={!$slct.event_presenter_obj.updated_on}
>
Updated on: {ae_util.iso_datetime_formatter($slct.event_presenter_obj.updated_on, 'datetime_short')}
</span>
</div>
</section>
</div>
<footer class="{parent.regionFooter}">
{#if $ae_loc.trusted_access}
<span class="ae_options mx-1">
<button
class="btn preset-tonal-warning mx-1"
on:click={() => {
if (!confirm(`Are you sure you want to send this email to ${$slct.event_presenter_obj.email}?`)) {return false;}
api.send_email({
api_cfg: $ae_api,
from_email: 'scott.idem+from@oneskyit.com',
from_name: 'Scott Idem',
to_email: $slct.event_presenter_obj.email,
subject: 'Test Email',
body_html: 'This is a test email from the AE system.',
});
}}
>
<span class="fas fa-paper-plane mx-1"></span>
Send Email
</button>
<button
on:click={() => {
$ae_loc.mod.events.show_edit__event_presenter_obj = true;
$ae_loc.mod.events.show_view__event_presenter_obj = false;
parent.onClose();
$slct_trigger = 'show_edit__event_presenter_obj';
}}
class="btn preset-tonal-warning mx-1"
title={`Edit presenter: ${$slct.event_presenter_obj.name}`}
>
<span class="fas fa-edit mx-1"></span> Edit
</button>
</span>
{/if}
<button class="btn preset-tonal-primary" on:click={parent.onClose}>
<span class="fas fa-times mx-1"></span>
Close
</button>
</footer>
</section>
{/if}
<style>
.ae_label {
font-size: smaller;
}
.ae_value {
font-weight: bold;
}
.event_presenter__user_timezone {
font-size: smaller;
font-style: italic;
}
.event_presenter_obj .ae_meta {
flex-direction: column;
/* justify-content: space-between; */
}
.event_presenter_obj .ae_meta .ae_group {
flex-direction: row;
}
.event_presenter_obj .ae_meta .ae_options {
flex-direction: row;
justify-content: space-between;
}
/* a {
color: #82B6E1;
} */
</style>

View File

@@ -1 +0,0 @@

View File

@@ -1,12 +0,0 @@
/** @type {import('./$types').LayoutLoad} */
console.log(`ae_events_speakers [slug] +layout.ts start`);
import { get } from 'svelte/store';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import type { key_val } from '$lib/ae_stores';
export async function load({ params, url }) {
}

View File

@@ -1,317 +0,0 @@
<script lang="ts">
export let data: any;
console.log(`ae_ Svelte Events Speakers [slug] +page data:`, data);
import { onMount } from 'svelte';
// https://github.com/skeletonlabs/skeleton/blob/master/packages/skeleton/src/lib/utilities/Modal/types.ts
// To retrieve the store, getModalStore must be invoked at the top level of your component!
// import type {
// DrawerSettings,
// ModalSettings,
// ModalComponent,
// ModalStore
// } from '@skeletonlabs/skeleton-svelte';
// const modalStore = getModalStore();
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils/ae_utils';
import type { key_val } from '$lib/ae_stores';
import Edit_modal_event_presenter from '../10_edit_modal__event_presenter_obj.svelte';
// Editing
const modalComponentEditEventPresenterObj: ModalComponent = { ref: Edit_modal_event_presenter, props: {container_class_li: 'w-full p-4 space-y-4 card'} };
const modal_edit__event_presenter: ModalSettings = {
type: 'component',
component: modalComponentEditEventPresenterObj,
title: 'Edit Speaker Submission',
position: '', // default is "items-center"
response: (r: boolean | undefined) => handle_modal_close(r)
};
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response);
ae_util.handle_url_and_message('event_presenter_id', null);
// We want to keep these values in case they want to re-open the modal. Do NOT clear.
// $slct.event_presenter_id = null;
// $slct.event_presenter_obj = null;
}
if ($slct_trigger == 'msg_parent' && $slct.event_id) {
console.log(`Message parent with event_id ${$slct.event_id}`);
$slct_trigger = null
let message = {'event_id': $slct.event_id};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
}
$ae_loc.hostname = data.url.hostname;
$ae_loc.site_domain = data.url.origin;
// We don't want the edit or view to show up by default. Maybe if we see an object ID param in the URL, we can show a modal.
$ae_loc.mod.events.show_edit__event_presenter_obj = false;
$ae_loc.mod.events.show_view__event_presenter_obj = false;
let ae_event_presenter_get_promise: Promise<any>;
let ae_event_obj_get_promise;
onMount(() => {
console.log('Events Presenters [New/Edit]: +page.svelte');
// console.log(`$ae_loc = `, $ae_loc);
let url = window.location.href;
// console.log(url);
$ae_loc.href_url = url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
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!`);
// This causes a problem frequently... See through...
// modalStore.trigger(modal_edit__event_presenter);
} else {
console.log(`No ID. Nothing to show.`);
}
});
// console.log(`$ae_loc = `, $ae_loc);
// $ae_loc.href_url = url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
// Load the Event Obj with ID based on the URL param.
// $slct.event_id = data.url.searchParams.get('event_id');
// $slct_trigger = 'load__event_obj';
// $: if ($slct_trigger == 'load__event_obj' && $slct.event_id) {
// console.log('Selected Event ID:', $slct.event_id);
// $slct_trigger = null;
// handle_load_ae_obj_id__event({event_id: $slct.event_id, try_cache: false});
// }
async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
console.log(`*** handle_load_ae_obj_id__event() *** event_id=${event_id}`);
let params = {};
// $ae_loc.hub.event_id_qry_status = 'loading';
ae_event_obj_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'event',
obj_id: event_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 in the API config.
params: params,
log_lvl: 0
})
.then(function (event_obj_get_result) {
if (event_obj_get_result) {
$slct.event_obj = event_obj_get_result;
console.log(`event object:`, $slct.event_obj);
}
// Auto show the selected event_presenter ID
// Is this pushState needed here?
// Set the URL param "event_id" to the current event_presenter ID.
// const url = new URL(location);
// url.searchParams.set('event_id', $slct.event_id);
// history.pushState({}, '', url);
// Is this postMessage needed here?
// let message = {'event_id': $slct.event_id};
// window.parent.postMessage(message, "*");
// modalStore.trigger(modal_view__event_obj);
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_event_obj_get_promise;
}
// Load the Event Presenter Obj with ID based on the URL param.
// $slct.event_presenter_id = data.url.searchParams.get('ae_id');
$slct.event_presenter_id = data.url.searchParams.get('event_presenter_id');
if ($slct.event_presenter_id) {
console.log('Selected Event Presenter ID:', $slct.event_presenter_id);
$slct_trigger = 'load__event_presenter';
// $ae_loc.mod.events.show_edit__event_presenter_obj = true;
// $slct_trigger = 'show_edit__event_presenter';
}
$: if ($slct_trigger == 'load__event_presenter' && $slct.event_presenter_id) {
console.log('Selected Event Presenter ID:', $slct.event_presenter_id);
$slct_trigger = null;
handle_load_ae_obj_id__event_presenter({
event_presenter_id: $slct.event_presenter_id, try_cache: false
});
// modalStore.trigger(modal_edit__event_presenter);
// $slct_trigger = 'show_edit__event_presenter';
}
async function handle_load_ae_obj_id__event_presenter({event_presenter_id, try_cache=false}) {
console.log(`*** handle_load_ae_obj_id__event_presenter() *** event_presenter_id=${event_presenter_id}`);
let params = {};
// $ae_sess.hub.event_presenter_id_qry_status = 'loading';
ae_event_presenter_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'event_presenter',
obj_id: event_presenter_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 in the API config.
params: params,
log_lvl: 0
})
.then(function (event_presenter_get_result) {
if (event_presenter_get_result) {
$slct.event_presenter_obj = event_presenter_get_result;
console.log(`event_presenter object:`, $slct.event_presenter);
}
// Auto show the selected event_presenter ID
// Is this pushState needed here?
// Set the URL param "event_presenter_id" to the current event_presenter ID.
// const url = new URL(location);
// url.searchParams.set('event_presenter_id', $slct.event_presenter_id);
// history.pushState({}, '', url);
// Is this postMessage needed here?
// let message = {'event_presenter_id': $slct.event_presenter_id};
// window.parent.postMessage(message, "*");
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_event_presenter_get_promise;
}
let testing = false;
// $: if ($slct_trigger == 'show_edit__event_presenter' && $ae_loc.mod.events.show_edit__event_presenter) {
$: if (testing) {
// && $ae_loc.mod.events.show_edit__event_presenter
// $: if ($slct_trigger == 'show_edit__event_presenter') {
console.log('Show Modal Edit');
$slct_trigger = null;
testing = false;
// $ae_trig.m_events__show_modal_edit = false;
// if ($slct.event_presenter_id) {
// let location = window.location.href;
// const url = new URL(location);
// url.searchParams.set('event_presenter_id', $slct.event_presenter_id);
// history.pushState({}, '', url);
// let message = {'event_presenter_id': $slct.event_presenter_id};
// window.parent.postMessage(message, "*");
// // console.log('Message sent to parent (iframe):', message);
// }
// modalStore.clear();
modalStore.trigger(modal_edit__event_presenter);
}
</script>
<section
class="ae_events_speakers md:container h-full mx-auto flex flex-col items-center space-y-4"
>
{#if $ae_loc.ds.hub__page__events_speakers__create_info_header}
{@html $ae_loc.ds.hub__page__events_speakers__create_info_header}
{:else}
<header>
<h1 class="h2">Speaker Hub Info Goes Here</h1>
</header>
{/if}
<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 preset-tonal-primary border border-primary-500 w-96"
on:click={() => {
ae_util.handle_url_and_message('event_presenter_id', $slct.event_presenter_id);
modalStore.trigger(modal_edit__event_presenter);
// $ae_loc.mod.events.show_edit__event_presenter_obj = true;
// $slct_trigger = 'load__event_presenter';
// $slct_trigger = 'show_edit__event_presenter';
// modalStore.trigger(modal_edit__event_presenter);
// $ae_trig.m_events__show_modal_edit = true;
}}
>
<span class="fas fa-edit mx-1"></span>
Edit Speaker ({$slct.event_presenter_id})
</button>
{:else}
<button
class="btn preset-tonal-primary border border-primary-500 w-96"
on:click={() => {
ae_util.handle_url_and_message('event_presenter_id', null);
modalStore.trigger(modal_edit__event_presenter);
// $slct_trigger = 'load__event_presenter';
$slct_trigger = 'show_edit__event_presenter';
$ae_loc.mod.events.show_edit__event_presenter_obj = true;
// modalStore.trigger(modal_edit__event_presenter);
}}
>
<span class="fas fa-edit mx-1"></span>
Start Speaker Submission Form
</button>
{/if}
</section>
{#if $ae_loc.ds.hub__page__events_speakers__create_info}
{@html $ae_loc.ds.hub__page__events_speakers__create_info}
{:else}
<section>
<div class="alert alert-info">
More information can go here or this can be hidden.
</div>
</section>
{/if}
</section>

View File

@@ -1,62 +0,0 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data: any;
import { onMount } from 'svelte';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
// 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);
let ae_acct = data[$slct.account_id];
// console.log(`ae_acct = `, ae_acct);
// $ae_loc = ae_acct.loc;
$ae_loc.mod.sponsorships.cfg_id = ae_acct.slct.sponsorship_cfg_id;
$ae_loc.mod.sponsorships.level_guest_max_li = {
0: 0,
1: 4, // CHOW 2024 - Friend
2: 8, // CHOW 2024 - Supporter
3: 8, // CHOW 2024 - Advocate
4: 8, // CHOW 2024 - Champion
5: 8, // CHOW 2024 - Presenting Partner
6: 16, // CHOW 2024 - Signature Partner
7: 16, // CHOW 2024 - Premier Partner
};
// $slct.sponsorship_cfg_id = ae_acct.slct.sponsorship_cfg_id;
// Setting the sponsorship_cfg_obj here seems to be important. It does not behave correctly if you navigate from the main (root) page for the site. The sponsorship level drop down is missing (probably more). - 2024-04-01
$slct.sponsorship_cfg_obj = ae_acct.slct.sponsorship_cfg_obj;
// We want to loop through all of the data store (ds) key value pairs and set them to localStorage
// if (ae_acct.ds) {
// for (let [key, value] of Object.entries(ae_acct.ds)) {
// console.log(`ae_ds__ key: ${key}, value:`, value);
// localStorageStore(`ae_ds__${key}`, value);
// }
// }
onMount(() => {
// console.log($slct.sponsorship_cfg_obj);
if (data.url.searchParams.get('sponsorship_cfg_id')) {
$ae_loc.mod.sponsorships.cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
}
});
</script>
<svelte:head>
<title>Sponsor Hub - {$ae_loc.title ?? 'Æ loading...'}</title>
</svelte:head>
<!-- <h1>Sponsorships Layout?</h1> -->
<!-- <div class="submenu">
{#each data.sections as section}
<a href="/settings/{section.slug}">{section.title}</a>
{/each}
</div> -->
<slot></slot>

View File

@@ -1,107 +0,0 @@
/** @type {import('./$types').LayoutLoad} */
console.log(`ae_sponsorships +layout.ts start`);
// import { browser } from '$app/environment';
// import type { key_val } from '$lib/ae_stores';
// import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { core_func } from '$lib/ae_core/ae_core_functions';
import { spons_func } from '$lib/ae_sponsorships/ae_sponsorships_functions';
export async function load({ parent }) {
let data = await parent();
let account_id = data.account_id;
let ae_acct = data[account_id];
// console.log(`ae_acct = `, ae_acct);
// if (!account_id) {
// console.log(`sponsorships +layout.ts: The account_id was not found in the data!!!`);
// return false;
// }
let sponsorship_cfg_id = ae_acct.slct.sponsorship_cfg_id;
if (!sponsorship_cfg_id) {
console.log(`sponsorships +layout.ts: The sponsorship_cfg_id was not found in the data!!!`);
return false;
}
// The await at this point seems to be important. If it is in the sponsor function then the data is not available to the layout. - 2024-04-01
let load_sponsorship_cfg_obj = await spons_func.load_ae_obj_id__sponsorship_cfg({
api_cfg: ae_acct.api,
sponsorship_cfg_id: sponsorship_cfg_id,
try_cache: false,
log_lvl: 0
});
ae_acct.slct.sponsorship_cfg_id = sponsorship_cfg_id;
ae_acct.slct.sponsorship_cfg_obj = load_sponsorship_cfg_obj;
data.ae_sponsorships_layout_ts = true;
let ds_code_li = {}; //: key_val; // = ae_loc_tmp.ds;
// console.log(`ae_ ds_code_li = `, ds_code_li);
let ds_code: string = '';
let ds_type: null|string = null;
// let loading_results = null;
// ds_code = 'sponsorships__agree_li';
// ds_type = 'json';
ds_code = 'hub__page__sponsorships__create_info_header';
ds_type = 'text';
// ds_code_li[ds_code] =
ae_acct['ds'][ds_code] = core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_acct.api, code: ds_code, data_type: ds_type, save_idb: true})
.then(function (ds_results) {
if (ds_results) {
// console.log(`ae_ ds_results = `, ds_results);
// if (browser) {
// console.log(`ae_ds__ key: ${ds_code}, value:`, ds_results);
// localStorage.setItem(`ae_ds__${ds_code}`, JSON.stringify(ds_results));
// } else {
// console.log('No browser!!!');
// }
return ds_results;
}
}
);
ds_code = 'hub__page__sponsorships__create_info';
ds_type = 'text';
// ds_code_li[ds_code] =
ae_acct['ds'][ds_code] = core_func.handle_load_ae_obj_code__data_store({api_cfg: ae_acct.api, code: ds_code, data_type: ds_type, save_idb: true})
.then(function (ds_results) {
if (ds_results) {
// console.log(`ae_ ds_results = `, ds_results);
// if (browser) {
// console.log(`ae_ds__ key: ${ds_code}, value:`, ds_results);
// localStorage.setItem(`ae_ds__${ds_code}`, JSON.stringify(ds_results));
// } else {
// console.log('No browser!!!');
// }
return ds_results;
}
}
);
data['ae_ds'] = {
...data['ae_ds'],
...ae_acct['ds']
}
// WARNING: Precaution against shared data between sites and sessions.
data[account_id] = ae_acct;
return data;
}
// export const prerender = false;
// export const prerender = true;

View File

@@ -1,543 +0,0 @@
<script lang="ts">
export let data: any;
// console.log(`ae_ Svelte Sponsorships +page data:`, data);
import { onMount } from 'svelte';
// https://github.com/skeletonlabs/skeleton/blob/master/packages/skeleton/src/lib/utilities/Modal/types.ts
// To retrieve the store, getModalStore must be invoked at the top level of your component!
import type {
ModalSettings,
ModalComponent,
} from '@skeletonlabs/skeleton-svelte';
const modalStore = getModalStore();
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { core_func } from '$lib/ae_core/ae_core_functions';
import { ae_util } from '$lib/ae_utils/ae_utils';
import type { key_val } from '$lib/ae_stores';
import { spons_func } from '$lib/ae_sponsorships/ae_sponsorships_functions';
import Edit_modal_sponsorship_obj from './10_edit_modal__sponsorship_obj.svelte';
import List_sponsorship_obj from './10_list__sponsorship_obj.svelte';
import View_modal_sponsorship_obj from './10_view_modal__sponsorship_obj.svelte';
let ae_promises: key_val = {};
// Editing
const modalComponentEditSponsorshipObj: ModalComponent = { ref: Edit_modal_sponsorship_obj, props: {container_class_li: 'w-full p-4 space-y-4 card ae_modal_scrollfix'} };
const modal_edit__sponsorship_obj: ModalSettings = {
type: 'component',
component: modalComponentEditSponsorshipObj,
title: 'Sponsor Form', // Editing Sponsorship
position: '', // default is "items-center"
response: (r: boolean | undefined) => handle_modal_close(r)
};
// Viewing
const modalComponentViewSponsorshipObj: ModalComponent = { ref: View_modal_sponsorship_obj, props: {container_class_li: 'w-full p-4 space-y-4 card ae_modal_scrollfix'} };
const modal_view__sponsorship_obj: ModalSettings = {
type: 'component',
component: modalComponentViewSponsorshipObj,
title: 'Sponsorship Submission', // Viewing Sponsorship
position: '', // default is "items-center"
// Provide arbitrary classes to the backdrop and modal elements:
// backdropClasses: 'bg-green-500!',
// modalClasses: 'w-modal-wide',
// Provide arbitrary metadata to your modal instance:
// meta: { fn: do_something_function }
response: (r: boolean | undefined) => handle_modal_close(r)
};
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response);
ae_util.handle_url_and_message('sponsorship_id', null);
// We do NOT want to keep these values if it is closed and not just switching from view to edit. A "smart" transition?
// if (!$ae_loc.mod.sponsorships.show_edit__sponsorship_obj && !$ae_loc.mod.sponsorships.show_view__sponsorship_obj) {
console.log('Clearing the modal store and the selected sponsorship object.');
$slct.sponsorship_id = null;
$slct.sponsorship_obj = null;
// } else {
// console.log('Not clearing the modal store and the selected sponsorship object.');
// }
}
$ae_loc.hostname = data.url.hostname;
$ae_loc.site_domain = data.url.origin;
// We don't want the edit or view to show up by default. Maybe if we see an object ID param in the URL, we can show a modal.
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = false;
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
if ($ae_loc.trusted_access) {
$ae_loc.mod.sponsorships.show_list__sponsorship_obj_li = true;
} else {
$ae_loc.mod.sponsorships.show_list__sponsorship_obj_li = false;
}
let ae_sponsorship_cfg_obj_get_promise: Promise<any>;
let ae_sponsorship_obj_li_get_promise: Promise<any>;
let ae_sponsorship_obj_get_promise: Promise<any>;
// This might need to be reviewed and compared to speakers version again
if ($ae_loc.account_id) {
$slct.account_id = $ae_loc.account_id;
// handle_load_ae_obj_id__account({account_id: $slct.account_id, try_cache: false});
handle_load_ae_obj_li__sponsorship({account_id: $slct.account_id, try_cache: false});
}
onMount(() => {
console.log('Sponsorships: +page.svelte');
// console.log(`$ae_loc = `, $ae_loc);
let href_url = window.location.href;
// console.log(href_url);
$ae_loc.href_url = href_url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
// $slct_trigger = 'msg_parent';
ae_util.handle_url_and_message('sponsorship_cfg_id', $slct.sponsorship_cfg_id);
ae_util.handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
if ($slct.sponsorship_id) {
console.log(`Got an ID. Let's clear the modal store just in case!`);
modalStore.clear();
// Showing this modal like this seems to cause problems. The styles do not load or something.
// console.log(`Got an ID. Let's clear the modal store and show the modal!`);
// modalStore.trigger(modal_edit__sponsorship_obj);
}
});
$: if ($slct_trigger == 'show_edit__sponsorship_obj' && $ae_loc.mod.sponsorships.show_edit__sponsorship_obj) {
console.log('Show Modal Edit');
$slct_trigger = null;
if ($slct.sponsorship_id) {
let location = window.location.href;
const url = new URL(location);
url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
// history.pushState({}, '', url);
let message = {'sponsorship_id': $slct.sponsorship_id};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
}
// modalStore.clear();
modalStore.trigger(modal_edit__sponsorship_obj);
}
$: if ($slct_trigger == 'show_view__sponsorship_obj' && $ae_loc.mod.sponsorships.show_view__sponsorship_obj) {
console.log('Show Modal View');
$slct_trigger = null;
let location = window.location.href;
const url = new URL(location);
url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
// history.pushState({}, '', url);
// modalStore.clear();
modalStore.trigger(modal_view__sponsorship_obj);
let message = {'sponsorship_id': $slct.sponsorship_id};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
}
$: if ($slct_trigger == 'load__sponsorship_obj_li') {
console.log(`load__sponsorship_obj_li account_id=${$slct.account_id}`);
$slct_trigger = null;
handle_load_ae_obj_li__sponsorship({account_id: $slct.account_id, try_cache: false});
}
async function handle_load_ae_obj_li__sponsorship({account_id, try_cache=true}) {
console.log('*** handle_load_ae_obj_li__sponsorship() ***');
// console.log($ae_loc.mod.sponsorships);
let enabled: string = ($ae_loc.qry__enabled ?? 'enabled'); // all, disabled, enabled
let hidden: string = ($ae_loc.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
let limit: number = ($ae_loc.qry__limit ?? 199); // 99
let offset: number = ($ae_loc.qry__offset ?? 0); // 0
if ($ae_loc.administrator_access) {
enabled = 'all';
// hidden = 'all';
limit = 350;
} else if ($ae_loc.trusted_access) {
enabled = 'enabled';
// hidden = 'not_hidden';
limit = 250;
} else {
enabled = 'enabled';
// hidden = 'not_hidden';
limit = 25;
}
// let enabled = $ae_loc.mod.sponsorships.enabled;
// let hidden = $ae_loc.mod.sponsorships.hidden;
// let limit = $ae_loc.mod.sponsorships.limit;
// let offset = $ae_loc.mod.sponsorships.offset;
let params = {};
let params_json: key_val = {};
// console.log('params_json:', params_json);
// console.log(params_json);
$ae_loc.mod.sponsorships.qry_status = 'loading';
ae_sponsorship_obj_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'sponsorship',
for_obj_type: 'account',
for_obj_id: account_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 in the API config.
enabled: enabled,
hidden: hidden,
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'},
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
limit: limit,
offset: offset,
params_json: params_json,
params: params,
log_lvl: 0
})
.then(function (sponsorship_obj_li_get_result) {
if (sponsorship_obj_li_get_result) {
$slct.sponsorship_obj_li = sponsorship_obj_li_get_result;
} else {
$slct.sponsorship_obj_li = [];
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
})
.finally(function () {
$ae_loc.mod.sponsorships.qry_status = 'done';
// console.log('Object list:', $slct.sponsorship_obj_li);
});
return ae_sponsorship_obj_li_get_promise;
}
// Load the Sponsorship Obj with ID based on the URL param.
$: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) {
console.log('Selected Sponsorship ID:', $slct.sponsorship_id);
$slct_trigger = null;
handle_load_ae_obj_id__sponsorship({sponsorship_id: $slct.sponsorship_id, try_cache: false});
}
async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=false}) {
console.log(`*** handle_load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
let params = {};
// $ae_sess.hub.sponsorship_id_qry_status = 'loading';
ae_sponsorship_obj_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'sponsorship',
obj_id: sponsorship_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 in the API config.
params: params,
log_lvl: 0
})
.then(function (sponsorship_obj_get_result) {
if (sponsorship_obj_get_result) {
if (!sponsorship_obj_get_result.sponsorship_id_random || !sponsorship_obj_get_result.sponsorship_cfg_id_random) {
console.log('WARNING: These results do not seem correct. Trigger a reload of the object.');
$slct_trigger = 'load__sponsorship_obj';
return false;
}
$slct.sponsorship_obj = sponsorship_obj_get_result;
// console.log(`sponsorship object:`, $slct.sponsorship_obj);
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_sponsorship_obj_get_promise;
}
function send_guest_list_email() {
let guest_li_html_table: string;
if ($slct.sponsorship_obj_li && $slct.sponsorship_obj_li.length > 0) {
guest_li_html_table = '<table style="border: thin solid black; border-collapse: collapse; width: 100%;">';
guest_li_html_table += '<tr style="border: thin solid black"><th>Sponsor</th><th>Name</th><th>Title</th><th>Affiliations</th><th>ADA</th><th>Dietary</th><th>Comments</th></tr>';
for (let i = 0; i < $slct.sponsorship_obj_li.length; i++) {
if ($slct.sponsorship_obj_li[i].guest_li_json && $slct.sponsorship_obj_li[i].guest_li_json.length > 0) {
for (let j = 0; j < $slct.sponsorship_obj_li[i].guest_li_json.length; j++) {
guest_li_html_table += '<tr style="border: thin solid black">';
guest_li_html_table += `<td>${$slct.sponsorship_obj_li[i].name} (lvl ${$slct.sponsorship_obj_li[i].level_num})</td>`;
guest_li_html_table += `<td>${$slct.sponsorship_obj_li[i].guest_li_json[j].full_name}</td>`;
guest_li_html_table += `<td>${$slct.sponsorship_obj_li[i].guest_li_json[j].title ?? ''}</td>`;
guest_li_html_table += `<td>${$slct.sponsorship_obj_li[i].guest_li_json[j].affiliations ?? ''}</td>`;
guest_li_html_table += `<td>${$slct.sponsorship_obj_li[i].guest_li_json[j].ada ? `ADA: ${$slct.sponsorship_obj_li[i].guest_li_json[j].ada}` : ''}</td>`;
guest_li_html_table += `<td>${$slct.sponsorship_obj_li[i].guest_li_json[j].dietary ? `Dietary: ${$slct.sponsorship_obj_li[i].guest_li_json[j].dietary}` : ''}</td>`;
guest_li_html_table += `<td>${$slct.sponsorship_obj_li[i].guest_li_json[j].comments ? `Comments: ${$slct.sponsorship_obj_li[i].guest_li_json[j].comments}` : ''}</td>`;
guest_li_html_table += '</tr>';
}
}
// let guest_html_table_row = '<tr>';
// guest_html_table_row += `<td>${$slct.sponsorship_obj_li[i].full_name}</td>`;
// guest_html_table_row += `<td>${$slct.sponsorship_obj_li[i].title ?? ''}</td>`;
// guest_html_table_row += `<td>${$slct.sponsorship_obj_li[i].affiliations ?? ''}</td>`;
// guest_html_table_row += `<td>${$slct.sponsorship_obj_li[i].ada ? `ADA: ${$slct.sponsorship_obj_li[i].ada}` : ''}</td>`;
// guest_html_table_row += `<td>${$slct.sponsorship_obj_li[i].dietary ? `Dietary: ${$slct.sponsorship_obj_li[i].dietary}` : ''}</td>`;
// guest_html_table_row += `<td>${$slct.sponsorship_obj_li[i].comments ? `Comments: ${$slct.sponsorship_obj_li[i].comments}` : ''}</td>`;
}
guest_li_html_table += '</table>';
}
console.log('Guest List HTML Table:', guest_li_html_table);
let subject = `CHOW 2024 Sponsor Hub Sponsors List`;
let body_html = `
<p>The complete guest list is below in a table format.</p>
${guest_li_html_table ? `<div><strong>Guests:</strong></br>${guest_li_html_table}</div>` : '<div>Guests: -- No Guests Added --</div>'}
`;
api.send_email({
api_cfg: $ae_api,
from_email: 'noreply+chow@oneskyit.com',
from_name: 'CHOW 2024 Sponsor Hub',
to_email: $ae_loc.user_email,
subject: subject,
body_html: body_html,
});
}
function generate_guest_list_csv(ae_obj_li) {
console.log(`*** generate_guest_list_csv() ***`, ae_obj_li);
// We need to create a list with the column names and then a list of lists with the data.
let csv_data = [];
let csv_columns = ['Sponsor', 'Level', 'POC', 'Guest', 'Title', 'Affiliations', 'ADA', 'Dietary', 'Comments'];
csv_data.push(csv_columns);
for (let i = 0; i < ae_obj_li.length; i++) {
if (ae_obj_li[i].guest_li_json && ae_obj_li[i].guest_li_json.length > 0) {
for (let j = 0; j < ae_obj_li[i].guest_li_json.length; j++) {
let csv_row = [];
csv_row.push(ae_obj_li[i].name);
csv_row.push(ae_obj_li[i].level_num);
csv_row.push(ae_obj_li[i].poc_json.full_name ?? ae_obj_li[i].poc_json.given_name);
csv_row.push(ae_obj_li[i].guest_li_json[j].full_name);
csv_row.push(ae_obj_li[i].guest_li_json[j].title ?? '');
csv_row.push(ae_obj_li[i].guest_li_json[j].affiliations ?? '');
csv_row.push(ae_obj_li[i].guest_li_json[j].ada ?? '');
csv_row.push(ae_obj_li[i].guest_li_json[j].dietary ?? '');
csv_row.push(ae_obj_li[i].guest_li_json[j].comments ?? '');
csv_data.push(csv_row);
}
}
}
console.log('CSV Data:', csv_data);
let csv_content_str = '';
csv_data.forEach(function(row) {
csv_content_str += row.join(',');
csv_content_str += '\n';
});
const blob = new Blob([csv_content_str], { type: 'text/csv;charset=utf-8;' });
const obj_url = URL.createObjectURL(blob);
const download_link = document.createElement('a');
download_link.setAttribute('href', obj_url);
download_link.setAttribute('download', `CHOW_2024_Sponsor_Hub_guest_list_${ae_util.iso_datetime_formatter()}.csv`);
download_link.setAttribute('style', 'display: none;')
download_link.textContent = 'Download CSV';
// document.querySelector('body').appendChild(download_link);
document.getElementById('download_csv_container').appendChild(download_link);
// Automatically download the file
download_link.click();
return csv_data;
}
</script>
<section class="ae_sponsorships md:container h-full mx-auto flex flex-col items-center space-y-4">
<header>
<h1 class="h1 text-center">
<!-- &AElig; - Sponsorships -->
Sponsor Hub
</h1>
</header>
<section
class="flex flex-col items-center space-y-2"
>
{#if $ae_loc.trusted_access}
<button
class="btn preset-tonal-primary border border-primary-500"
on:click={() => {
// $ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
$slct.sponsorship_id = null;
$slct.sponsorship_obj = null;
// modalStore.trigger(modal_edit__sponsorship_obj);
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
$slct_trigger = 'show_edit__sponsorship_obj';
}}
>
<span class="fas fa-edit mx-1"></span>
Start Sponsor Submission Form
</button>
{:else}
<div class="text-center m-4">
The CHOW 2024 sponsor Hub has closed. If you have changes to your gala RSVP list please email Laurie VanBenschoten, <a href="mailto:lvanbenschoten@marinesanctuary.org" class="text-blue-500">lvanbenschoten@marinesanctuary.org</a>, AND Erin Quigg, <a href="mailto:erinq@preconevents.com" class="text-blue-500">erinq@preconevents.com</a>.
</div>
{/if}
{#if $ae_loc.trusted_access}
<span>
<button
type="button"
on:click={() => {
if (!confirm('Download all data exported to an Excel file?')) {
return false;
}
ae_promises.download__sponsorships_export = core_func.handle_download_export__obj_type({
api_cfg: $ae_api,
get_obj_type: 'sponsorship',
for_obj_type: 'account',
for_obj_id: $slct.account_id,
file_type: 'Excel',
return_file: true,
filename: `${$ae_loc.account_code}_Sponsor_Hub_export_${ae_util.iso_datetime_formatter()}.xlsx`,
auto_download: true,
log_lvl: 2
});
}}
class="btn btn-sm preset-tonal-warning border border-warning-500 w-42 mb-1 export_data_btn text-xs"
title={`Download sponsorship data for ${$ae_loc.account_name}`}
>
{#await ae_promises.download__sponsorship_export}
<span class="fas fa-spinner fa-spin"></span>
{:then}
<!-- Done? -->
{/await}
<span class="fas fa-download mx-1"></span> Export All Data
{#if $ae_sess.api_download_kv[$slct.account_id] && $ae_sess.api_download_kv[$slct.account_id].status == 'downloading'}
{$ae_sess.api_download_kv[$slct.account_id].percent_completed}%
{/if}
</button>
<!-- <button
class="btn btn-sm variant-ghost-primary w-48 mb-1 email_data_btn"
on:click={() => {
if (!confirm(`Are you sure you want to send this email? To: ${$ae_loc.user_email}?`)) {return false;}
// Question pop up to change the email address
$ae_loc.user_email = prompt('Enter the email address to send the guest list to:', $ae_loc.user_email);
if (!$ae_loc.user_email) {
return false;
}
send_guest_list_email();
}}
>
<span class="fas fa-paper-plane mx-1"></span>
Email With Guest List
</button> -->
<button
class="btn btn-sm preset-tonal-warning border border-warning-500 w-42 mb-1 generate_csv_btn text-xs"
on:click={() => {
if (!confirm('Generate and download a CSV file with the guest list?')) {
return false;
}
let csv_data = generate_guest_list_csv($slct.sponsorship_obj_li);
console.log('CSV Data:', csv_data);
}}
>
<span class="fas fa-file-csv mx-1"></span>
Export Guest List CSV
</button>
<span id="download_csv_container"></span>
<button
on:click={async () => {
console.log('Show hidden sponsorships');
if ($ae_loc.qry__hidden == 'all') {
$ae_loc.qry__hidden = 'not_hidden';
$slct_trigger = 'load__sponsorship_obj_li';
} else {
$ae_loc.qry__hidden = 'all';
$slct_trigger = 'load__sponsorship_obj_li';
}
}}
class="btn btn-sm preset-tonal-warning border border-warning-500 w-42 mb-1 text-xs"
>
{#if $ae_loc.qry__hidden == 'all'}
<span class="fas fa-eye mx-1"></span>
Hide Hidden Sponsorships
{:else}
<span class="fas fa-eye-slash mx-1"></span>
Show Hidden Sponsorships
{/if}
</button>
</span>
{/if}
</section>
<section class="sponsorships_list ae_h_scrollfix">
{#await ae_sponsorship_obj_li_get_promise}
<div class="modal-loading">
<span class="fas fa-spinner fa-spin"></span>
<span class="loading-text">
Loading...
</span>
</div>
{/await}
{#if $slct.sponsorship_obj_li && $ae_loc.mod.sponsorships.show_list__sponsorship_obj_li}
<List_sponsorship_obj />
{/if}
</section>
</section>
<style lang="postcss">
</style>

View File

@@ -1,8 +0,0 @@
/** @type {import('./$types').PageLoad} */
console.log(`ae_sponsorships +page.ts start`);
export function load() {
return {
ae_sponsorships_page_ts: true,
};
}

View File

@@ -1,7 +0,0 @@
[Dolphin]
Timestamp=2024,2,20,11,41,17.124
Version=4
ViewMode=1
[Settings]
HiddenFilesShown=true

File diff suppressed because it is too large Load Diff

View File

@@ -1,184 +0,0 @@
<script lang="ts">
// *** Import Svelte core
import { onMount } from 'svelte';
// *** Import Aether core variables and functions
import { ae_util } from '$lib/ae_utils/ae_utils';
// import { ae } from 'aether_npm_lib';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
export let class_li: string = '';
onMount(() => {
console.log('** Component Mounted: ** List - Sponsorships Obj');
});
</script>
<section class="svelte_component ae_section ae_list list__sponsorship_obj sponsorship_obj_li {class_li} ae_h_scrollfix">
{#if $slct.sponsorship_obj_li}
<table class="table table-compact ">
<thead>
<tr>
<th>Options</th>
<th>Name</th> <!-- This is the name of the organization or person -->
<th>Level</th>
{#if $ae_loc.administrator_access}<th>Paid</th>{/if}
<th>Guests</th>
<th>
<!-- Show what POC (Point of Contact) stands for when hovering -->
<abbr title="Point of Contact" class="ae_label">POC</abbr>
</th>
<th>Created</th>
<th>Updated</th>
</tr>
</thead>
<tbody>
{#each $slct.sponsorship_obj_li as ae_sponsorship_obj, index}
<tr
id={`ae_sponsorship_id__${ae_sponsorship_obj.sponsorship_id_random}`}
class="ae_object sponsorship_obj"
class:fade_50={ae_sponsorship_obj.hide}
>
<td class="ae_options sponsorship_obj__options">
<div class=" preset-filled">
<button
on:click={() => {
$slct.sponsorship_id = ae_sponsorship_obj.sponsorship_id_random;
$slct.sponsorship_obj = ae_sponsorship_obj;
console.log(`Selected Sponsorship ID: ${$slct.sponsorship_id}`);
console.log(`Selected Sponsorship Object:`, $slct.sponsorship_obj);
// $slct_trigger = 'load__sponsorship_obj';
$ae_loc.mod.sponsorships.show_main__options = true;
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = false;
$ae_loc.mod.sponsorships.show_list__sponsorship_obj_li = true;
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = true;
$slct_trigger = 'show_view__sponsorship_obj';
}}
class="preset-tonal-primary"
title={`Open to see details: ${ae_sponsorship_obj.name}`}
>
<span class="fas fa-envelope-open mx-1"></span>
<!-- <span class="fas fa-info-circle"></span> -->
View
</button>
{#if $ae_loc.trusted_access}
<button
on:click={() => {
$slct.sponsorship_id = ae_sponsorship_obj.sponsorship_id_random;
$slct.sponsorship_obj = ae_sponsorship_obj;
console.log(`Selected Sponsorship ID: ${$slct.sponsorship_id}`);
console.log(`Selected Sponsorship Object:`, $slct.sponsorship_obj);
// $slct_trigger = 'load__sponsorship_obj';
$ae_loc.mod.sponsorships.show_main__options = true;
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
$ae_loc.mod.sponsorships.show_list__sponsorship_obj_li = true;
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
$slct_trigger = 'show_edit__sponsorship_obj';
}}
class="preset-tonal-warning"
title={`Edit sponsorship: ${ae_sponsorship_obj.name}`}
>
<span class="fas fa-edit mx-1"></span> Edit
</button>
{/if}
</div>
</td>
<td class="ae_value sponsorships__name">{ae_sponsorship_obj.name}</td>
<td class="">
<span class="fas fa-gem"></span>
{#if ae_sponsorship_obj.level_num}{ae_sponsorship_obj.level_num}{/if}
{#if ae_sponsorship_obj.level_str}{ae_sponsorship_obj.level_str}{/if}
</td>
{#if $ae_loc.administrator_access}
<td class="text-center">
{#if ae_sponsorship_obj.paid}
<!-- Show checkmark -->
<span class="fas fa-check"
title="Paid"></span>
{:else}
<!-- Show X or cross -->
<span class="fas fa-times"
title="Not Paid"></span>
{/if}
<!-- {#if ae_sponsorship_obj.amount}
<span class="ae_value sponsorships__amount">${ae_sponsorship_obj.amount/100}</span>
{/if} -->
</td>
{/if}
<td class="text-center">
{#if ae_sponsorship_obj.guest_li_json}
<span class="fas fa-list-ol"></span> {ae_sponsorship_obj.guest_li_json.length}
{:else}
<!-- <span class="fas fa-list-ol"></span> -->
-- None --
{/if}
</td>
<td><span class="ae_flex ae_flex_justify_around">
{#if ae_sponsorship_obj.poc_json}
<span>
<span class="fas fa-user"></span> {ae_sponsorship_obj.poc_json.full_name ?? ae_sponsorship_obj.poc_json.given_name}
</span>
<a href="mailto:{ae_sponsorship_obj.poc_json.email}"><span class="fas fa-envelope"></span> {ae_sponsorship_obj.poc_json.email}</a>
{/if}
</span></td>
<td><span class="text-xs">{ae_util.iso_datetime_formatter(ae_sponsorship_obj.created_on, 'datetime_short')}</span></td>
<td><span class="text-xs">{ae_util.iso_datetime_formatter(ae_sponsorship_obj.updated_on, 'datetime_short')}</span></td>
</tr>
{/each}
</tbody>
<tfoot>
<tr>
<th colspan="8" class="">
Total Count:
{$slct.sponsorship_obj_li.length}
</th>
</tr>
</tfoot>
</table>
{:else}
<div>No sponsorships avalible to show at this time</div>
{/if}
</section>
<style>
.ae_label {
font-size: smaller;
}
.ae_value {
font-weight: bold;
}
.ae_header h3 {
font-size: 1.2em;
margin: 0;
/* padding: 0; */
}
.sponsorship_obj .ae_meta {
flex-direction: column;
/* justify-content: space-between; */
}
.sponsorship_obj .ae_meta .ae_group {
flex-direction: row;
}
.sponsorship_obj .ae_meta .ae_options {
flex-direction: row;
justify-content: space-between;
}
</style>

View File

@@ -1,421 +0,0 @@
<script lang="ts">
import type { SvelteComponent } from 'svelte';
import { onMount } from 'svelte';
// This works and uses local storage:
// store_current_tab must be prefixed with $ to be reactive.
import { Tab, FileUpload, ProgressRing, Segment, Tabs } from '@skeletonlabs/skeleton-svelte';
import type { Writable } from 'svelte/store';
const store_current_tab: Writable<string> = localStorageStore('ae_sponsorships_current_tab', 'start');
console.log(`store_current_tab:`, $store_current_tab);
import { ae_util } from '$lib/ae_utils/ae_utils';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import type { key_val } from '$lib/ae_stores';
// Stores
// Props
/** Exposes parent props to this component. */
export let parent: SvelteComponent;
console.log(`Parent:`, parent);
export let container_class_li = '';
const modalStore = getModalStore();
let placeholder_li: key_val = {
file_logo_primary: '-- No File Uploaded --',
file_logo_light: '-- No File Uploaded --',
file_logo_dark: '-- No File Uploaded --',
file_media_promo_video: '-- No File Uploaded --',
};
if ($slct.sponsorship_id) {
console.log(`Sponsorship ID selected: ${$slct.sponsorship_id}`);
console.log(`Sponsorship object selected:`, $slct.sponsorship_obj);
$slct_trigger = 'load__sponsorship_obj';
}
onMount(() => {
console.log('** Component Mounted: ** View Modal - Sponsorship Obj');
});
$: if ($slct.sponsorship_obj) {
console.log(`Sponsorship object selected:`, $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 = ae_util.create_img_element({
account_id: $ae_loc.account_id,
base_url: $ae_api.base_url,
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,
})
// `<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 = ae_util.create_img_element({
account_id: $ae_loc.account_id,
base_url: $ae_api.base_url,
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,
})
// `<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 = ae_util.create_img_element({
account_id: $ae_loc.account_id,
base_url: $ae_api.base_url,
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,
})
// `<img src="https://dev-demo.oneskyit.com/hosted_file/download/${$slct.sponsorship_obj.logo_li_json.dark.hosted_file_id_random}" class="max-w-64">${$slct.sponsorship_obj.logo_li_json.dark.filename}`;
}
}
// 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 = ae_util.create_video_element({
account_id: $ae_loc.account_id,
base_url: $ae_api.base_url,
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,
})
// `<video src="https://dev-demo.oneskyit.com/hosted_file/download/${$slct.sponsorship_obj.media_li_json.promo_video.hosted_file_id_random}" controls class="max-w-64"></video>${$slct.sponsorship_obj.media_li_json.promo_video.filename}`;
}
}
}
</script>
<!-- @component This is the Sponsorships modal view form. -->
{#if $modalStore[0]}
<section class="svelte_component ae_view_modal ae_obj__sponsorship_obj {container_class_li} p-4 space-y-4">
<header class={parent.regionHeader}>
{@html $slct.sponsorship_obj.name}
<button class="btn preset-tonal-primary float-end" on:click={parent.onClose}>
<span class="fas fa-times mx-1"></span>
Close
</button>
</header>
<p>This quick view of a sponsorship's information is customizable or can be hidden completely.</p>
<div class="sponsorship__content space-y-4">
<div class="sponsorship__poc">
<h2 class="h4">Point of Contact</h2>
<!-- <span class="ae_label">Point of Contact:</span> -->
<span class="ae_value">{@html $slct.sponsorship_obj.poc_json.full_name}</span>
<span class="ae_label">| Email:</span>
<span class="ae_value"><span class="fas fa-envelope"></span>
<a href="mailto:{$slct.sponsorship_obj.poc_json.email}?Subject={$slct.sponsorship_obj.full_name}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.sponsorship_obj.poc_json.email}</a></span>
<span class="ae_label">| Mobile:</span>
<span class="ae_value"><span class="fas fa-mobile-alt"></span>
<a href="tel:{$slct.sponsorship_obj.poc_json.phone_mobile}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.sponsorship_obj.poc_json.phone_mobile ?? '-- Not Given --'}</span>
</div>
<!-- <div
class="sponsorship_description description"
>
<div class="ae_label sponsorship__description">Description:</div>
<pre class="ae_value sponsorship__description pre_wrap">{@html $slct.sponsorship_obj.description ? $slct.sponsorship_obj.description : '-- No Description Given --'}</pre>
</div> -->
<div
class:ae_d_none={!$slct.sponsorship_obj.level_num}
class="sponsorship_level"
>
<h2 class="h4">Level of Sponsorship</h2>
<!-- <span class="ae_label">Level of Sponsorship:</span> -->
<span class=""><span class="fas fa-gem"></span> {$slct.sponsorship_obj.level_str} ({$slct.sponsorship_obj.level_num})</span>
</div>
<!-- <div
class:hidden={!$slct.sponsorship_obj.amount}
class="sponsorship_amount"
>
<span class="ae_label">Amount:</span>
<span class="ae_value">
${$slct.sponsorship_obj.amount/100}
</span>
</div> -->
<!-- <div>
<span class="ae_label">Paid:</span>
$
<span class="ae_value">
{$slct.sponsorship_obj.paid ? 'Yes, marked as paid' : 'Not yet marked as paid'}
</span>
</div> -->
<div
class="mailing_address">
<h2 class="h4">Mailing Address</h2>
<div>
{#if $slct.sponsorship_obj.address_li_json.mailing}
{#if $slct.sponsorship_obj.address_li_json.mailing.line_1}{$slct.sponsorship_obj.address_li_json.mailing.line_1}<br>{/if}
{#if $slct.sponsorship_obj.address_li_json.mailing.line_2}{$slct.sponsorship_obj.address_li_json.mailing.line_2}<br>{/if}
{#if $slct.sponsorship_obj.address_li_json.mailing.city}{$slct.sponsorship_obj.address_li_json.mailing.city}{/if}
{#if $slct.sponsorship_obj.address_li_json.mailing.state_province}, {$slct.sponsorship_obj.address_li_json.mailing.state_province}{/if}
{#if $slct.sponsorship_obj.address_li_json.mailing.postal_code} {$slct.sponsorship_obj.address_li_json.mailing.postal_code}{/if}
{#if $slct.sponsorship_obj.address_li_json.mailing.country} {$slct.sponsorship_obj.address_li_json.mailing.country}{/if}
<!-- {#if $slct.sponsorship_obj.address_li_json.mailing.other_text}, {$slct.sponsorship_obj.address_li_json.mailing.other_text}{/if} -->
{/if}
</div>
</div>
<div
class="accommodations">
<h2 class="h4">Accommodations</h2>
{#if $slct.sponsorship_obj.questions_li_json && $slct.sponsorship_obj.questions_li_json.accommodations_text}
<div class="">
{$slct.sponsorship_obj.questions_li_json.accommodations_text}
</div>
{/if}
</div>
<div
class="marketing">
<h2 class="h4">Marketing</h2>
{#if $slct.sponsorship_obj.website_url}
<div class="">
<span class="fas fa-globe"></span> Organization website: <a href="{$slct.sponsorship_obj.website_url}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.sponsorship_obj.website_url}</a>
</div>
{/if}
{#if $slct.sponsorship_obj.social_li_json}
{#if $slct.sponsorship_obj.social_li_json.facebook}
<div class="">
<span class="fab fa-facebook"></span> Facebook: <a href="{$slct.sponsorship_obj.social_li_json.facebook}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.sponsorship_obj.social_li_json.facebook}</a>
</div>
{/if}
{#if $slct.sponsorship_obj.social_li_json.instagram}
<div class="">
<span class="fab fa-instagram"></span> Instagram:<a href="{$slct.sponsorship_obj.social_li_json.instagram}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.sponsorship_obj.social_li_json.instagram}</a>
</div>
{/if}
{#if $slct.sponsorship_obj.social_li_json.linkedin}
<div class="">
<span class="fab fa-linkedin"></span> LinkedIn: <a href="{$slct.sponsorship_obj.social_li_json.linkedin}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.sponsorship_obj.social_li_json.linkedin}</a>
</div>
{/if}
{#if $slct.sponsorship_obj.social_li_json.twitter}
<div class="">
<span class="fab fa-twitter"></span> Twitter: <a href="{$slct.sponsorship_obj.social_li_json.twitter}" class="font-medium text-blue-600 dark:text-blue-500 hover:underline">{$slct.sponsorship_obj.social_li_json.twitter}</a>
</div>
{/if}
{/if}
</div>
<div
class="file_uploads">
<h2 class="h4">File Uploads</h2>
{#if placeholder_li.file_logo_primary}
<div class="">
<span class="fas fa-image"></span> Logo (Primary): {@html placeholder_li.file_logo_primary}
</div>
{/if}
{#if placeholder_li.file_logo_light}
<div class="">
<span class="fas fa-image"></span> Logo (Light): {@html placeholder_li.file_logo_light}
</div>
{/if}
{#if placeholder_li.file_logo_dark}
<div class="">
<span class="fas fa-image"></span> Logo (Dark): {@html placeholder_li.file_logo_dark}
</div>
{/if}
{#if placeholder_li.file_media_promo_video}
<div class="">
<span class="fas fa-video"></span> Promo Video: {@html placeholder_li.file_media_promo_video}
</div>
{/if}
</div>
<div class="ae_list sponsorship__guests">
<h2 class="h4">Guest List</h2>
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length && $slct.sponsorship_obj.guest_li_json[0].full_name}
<ul>
{#each $slct.sponsorship_obj.guest_li_json as guest, index}
<li class="sponsorship__guest"
class:ae_d_none={!$slct.sponsorship_obj.guest_li_json[index].full_name}
>
<span class="ae_label">
<span class="fas fa-user"></span>
<!-- Contact: -->
</span>
{$slct.sponsorship_obj.guest_li_json[index].full_name}
{$slct.sponsorship_obj.guest_li_json[index].title ?? ''}
{$slct.sponsorship_obj.guest_li_json[index].affiliations ?? ''}
{$slct.sponsorship_obj.guest_li_json[index].ada ? `ADA: ${$slct.sponsorship_obj.guest_li_json[index].ada}` : ''}
{$slct.sponsorship_obj.guest_li_json[index].dietary ? `Dietary: ${$slct.sponsorship_obj.guest_li_json[index].dietary}` : ''}
{$slct.sponsorship_obj.guest_li_json[index].comments ? `Comments: ${$slct.sponsorship_obj.guest_li_json[index].comments}` : ''}
<!-- {#if $slct.sponsorship_obj.guest_li_json[index].email}
| <a href="mailto:{$slct.sponsorship_obj.guest_li_json[index].email}?Subject={$slct.sponsorship_obj.full_name}">{$slct.sponsorship_obj.guest_li_json[index].email}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].phone_mobile}
<span class="ae_label">| Mobile:</span>
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_mobile}">{$slct.sponsorship_obj.guest_li_json[index].phone_mobile}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].phone_home}
<span class="ae_label">| Home:</span>
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_home}">{$slct.sponsorship_obj.guest_li_json[index].phone_home}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].phone_office}
<span class="ae_label">| Office:</span>
<a href="tel:{$slct.sponsorship_obj.guest_li_json[index].phone_office}">{$slct.sponsorship_obj.guest_li_json[index].phone_office}</a>
{/if}
{#if $slct.sponsorship_obj.guest_li_json[index].other_text}| {$slct.sponsorship_obj.guest_li_json[index].other_text}{/if} -->
</li>
{/each}
</ul>
{:else}
<div class="ae_warning">No guest have been added</div>
{/if}
</div>
<section class="card-footer ae_section ae_meta sponsorship__meta">
<div class="ae_group">
<span
class="sponsorship__id"
class:ae_d_none={!$ae_loc.administrator_access}>
ID:
{$slct.sponsorship_obj.sponsorship_id_random}
</span>
<span
class="sponsorship__created_on"
>
Created on: {ae_util.iso_datetime_formatter($slct.sponsorship_obj.created_on, 'datetime_short')}
</span>
<span
class="sponsorship__updated_on"
class:ae_d_none={!$slct.sponsorship_obj.updated_on}
>
Updated on: {ae_util.iso_datetime_formatter($slct.sponsorship_obj.updated_on, 'datetime_short')}
</span>
</div>
</section>
</div>
<footer class="{parent.regionFooter}">
{#if $ae_loc.administrator_access}
<div class="ae_options mx-1">
<button
class="btn preset-tonal-warning mx-1"
on:click={() => {
if (!confirm(`Are you sure you want to send this email to ${$slct.sponsorship_obj.poc_json.email}?`)) {return false;}
api.send_email({
api_cfg: $ae_api,
from_email: 'scott.idem+from@oneskyit.com',
from_name: 'Scott Idem',
to_email: $slct.sponsorship_obj.poc_json.email,
subject: 'Test Email',
body_html: 'This is a test email from the AE system.',
});
}}
>
<span class="fas fa-paper-plane mx-1"></span>
Send Email
</button>
<button
on:click={() => {
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
parent.onClose();
$slct_trigger = 'show_edit__sponsorship_obj';
}}
class="btn preset-tonal-warning mx-1"
title={`Edit sponsorship: ${$slct.sponsorship_obj.name}`}
>
<span class="fas fa-edit mx-1"></span> Edit
</button>
</div>
{/if}
<button
class="btn preset-tonal-primary mx-1"
on:click={parent.onClose}
>
<span class="fas fa-times mx-1"></span>
Close
</button>
</footer>
</section>
{/if}
<style>
.ae_label {
font-size: smaller;
}
.ae_value {
font-weight: bold;
}
.sponsorship__user_timezone {
font-size: smaller;
font-style: italic;
}
.sponsorship_obj .ae_meta {
flex-direction: column;
/* justify-content: space-between; */
}
.sponsorship_obj .ae_meta .ae_group {
flex-direction: row;
}
.sponsorship_obj .ae_meta .ae_options {
flex-direction: row;
justify-content: space-between;
}
/* a {
color: #82B6E1;
} */
</style>

View File

@@ -1,12 +0,0 @@
/** @type {import('./$types').LayoutLoad} */
console.log(`ae_sponsorships [slug] +layout.ts start`);
import { get } from 'svelte/store';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import type { key_val } from '$lib/ae_stores';
export async function load({ params, url }) {
}

View File

@@ -1,324 +0,0 @@
<script lang="ts">
export let data: any;
console.log(`ae_ Svelte Sponsorships [slug] +page data:`, data);
import { onMount } from 'svelte';
// https://github.com/skeletonlabs/skeleton/blob/master/packages/skeleton/src/lib/utilities/Modal/types.ts
// To retrieve the store, getModalStore must be invoked at the top level of your component!
import type {
DrawerSettings,
ModalSettings,
ModalComponent,
ModalStore
} from '@skeletonlabs/skeleton-svelte';
const modalStore = getModalStore();
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils/ae_utils';
import type { key_val } from '$lib/ae_stores';
import Edit_modal_sponsorship_obj from '../10_edit_modal__sponsorship_obj.svelte';
// Editing
const modalComponentEditSponsorshipObj: ModalComponent = { ref: Edit_modal_sponsorship_obj, props: {container_class_li: 'w-full p-4 space-y-4 card'} };
const modal_edit__sponsorship_obj: ModalSettings = {
type: 'component',
component: modalComponentEditSponsorshipObj,
title: 'Edit Your Sponsorship Submission',
position: '', // default is "items-center"
response: (r: boolean | undefined) => handle_modal_close(r)
};
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response);
ae_util.handle_url_and_message('sponsorship_id', null);
// We want to keep these values in case they want to re-open the modal. Do NOT clear.
// $slct.sponsorship_id = null;
// $slct.sponsorship_obj = null;
}
if ($slct_trigger == 'msg_parent' && $slct.sponsorship_cfg_id) {
console.log(`Message parent with sponsorship_cfg_id ${$slct.sponsorship_cfg_id}`);
$slct_trigger = null
let message = {'sponsorship_cfg_id': $slct.sponsorship_cfg_id};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
}
$ae_loc.hostname = data.url.hostname;
$ae_loc.site_domain = data.url.origin;
// We don't want the edit or view to show up by default. Maybe if we see an object ID param in the URL, we can show a modal.
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = false;
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
let ae_sponsorship_obj_get_promise: Promise<any>;
let ae_sponsorship_cfg_obj_get_promise;
onMount(() => {
console.log('Sponsorships [New/Edit]: +page.svelte');
// console.log(`$ae_loc = `, $ae_loc);
let url = window.location.href;
// console.log(url);
$ae_loc.href_url = url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
ae_util.handle_url_and_message('sponsorship_cfg_id', $slct.sponsorship_id);
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!`);
// This causes a problem frequently... See through...
// modalStore.trigger(modal_edit__sponsorship_obj);
} else {
console.log(`No ID. Nothing to show.`);
}
});
// console.log(`$ae_loc = `, $ae_loc);
// $ae_loc.href_url = url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
// Load the Sponsorship Cfg Obj with ID based on the URL param.
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
$slct_trigger = 'load__sponsorship_cfg_obj';
$: if ($slct_trigger == 'load__sponsorship_cfg_obj' && $slct.sponsorship_cfg_id) {
console.log('Selected Sponsorship Cfg ID:', $slct.sponsorship_cfg_id);
$slct_trigger = null;
handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id: $slct.sponsorship_cfg_id, try_cache: false});
}
async function handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id, try_cache=false}) {
console.log(`*** handle_load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`);
let params = {};
// $ae_sess.hub.sponsorship_cfg_id_qry_status = 'loading';
ae_sponsorship_cfg_obj_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'sponsorship_cfg',
obj_id: sponsorship_cfg_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 in the API config.
params: params,
log_lvl: 0
})
.then(function (sponsorship_cfg_obj_get_result) {
if (sponsorship_cfg_obj_get_result) {
$slct.sponsorship_cfg_obj = sponsorship_cfg_obj_get_result;
console.log(`sponsorship_cfg object:`, $slct.sponsorship_cfg_obj);
}
// Auto show the selected sponsorship ID
// Is this pushState needed here?
// Set the URL param "sponsorship_cfg_id" to the current sponsorship ID.
// const url = new URL(location);
// url.searchParams.set('sponsorship_cfg_id', $slct.sponsorship_cfg_id);
// history.pushState({}, '', url);
// Is this postMessage needed here?
// let message = {'sponsorship_cfg_id': $slct.sponsorship_cfg_id};
// window.parent.postMessage(message, "*");
// modalStore.trigger(modal_view__sponsorship_cfg_obj);
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_sponsorship_cfg_obj_get_promise;
}
// Load the Sponsorship Obj with ID based on the URL param.
// $slct.sponsorship_id = data.url.searchParams.get('ae_id');
$slct.sponsorship_id = data.url.searchParams.get('sponsorship_id');
if ($slct.sponsorship_id) {
console.log('Selected Sponsorship ID:', $slct.sponsorship_id);
$slct_trigger = 'load__sponsorship_obj';
// $ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
// $slct_trigger = 'show_edit__sponsorship_obj';
}
$: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) {
console.log('Selected Sponsorship ID:', $slct.sponsorship_id);
$slct_trigger = null;
handle_load_ae_obj_id__sponsorship({sponsorship_id: $slct.sponsorship_id, try_cache: false});
// modalStore.trigger(modal_edit__sponsorship_obj);
// $slct_trigger = 'show_edit__sponsorship_obj';
}
async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=false}) {
console.log(`*** handle_load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
let params = {};
// $ae_sess.hub.sponsorship_id_qry_status = 'loading';
ae_sponsorship_obj_get_promise = api.get_ae_obj_id_crud({
api_cfg: $ae_api,
obj_type: 'sponsorship',
obj_id: sponsorship_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 in the API config.
params: params,
log_lvl: 0
})
.then(function (sponsorship_obj_get_result) {
if (sponsorship_obj_get_result) {
$slct.sponsorship_obj = sponsorship_obj_get_result;
console.log(`sponsorship object:`, $slct.sponsorship_obj);
}
// Auto show the selected sponsorship ID
// Is this pushState needed here?
// Set the URL param "sponsorship_id" to the current sponsorship ID.
// const url = new URL(location);
// url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
// history.pushState({}, '', url);
// Is this postMessage needed here?
// let message = {'sponsorship_id': $slct.sponsorship_id};
// window.parent.postMessage(message, "*");
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_sponsorship_obj_get_promise;
}
let testing = false;
// $: if ($slct_trigger == 'show_edit__sponsorship_obj' && $ae_loc.mod.sponsorships.show_edit__sponsorship_obj) {
$: if (testing) {
// && $ae_loc.mod.sponsorships.show_edit__sponsorship_obj
// $: if ($slct_trigger == 'show_edit__sponsorship_obj') {
console.log('Show Modal Edit');
$slct_trigger = null;
testing = false;
// $ae_trig.m_sponsorships__show_modal_edit = false;
// if ($slct.sponsorship_id) {
// let location = window.location.href;
// const url = new URL(location);
// url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
// history.pushState({}, '', url);
// let message = {'sponsorship_id': $slct.sponsorship_id};
// window.parent.postMessage(message, "*");
// // console.log('Message sent to parent (iframe):', message);
// }
// modalStore.clear();
modalStore.trigger(modal_edit__sponsorship_obj);
}
</script>
<section
class="ae_sponsorships md:container h-full mx-auto flex flex-col items-center space-y-4"
>
{#if $ae_loc.ds.hub__page__sponsorships__create_info_header}
{@html $ae_loc.ds.hub__page__sponsorships__create_info_header}
{:else}
<header>
<h1 class="h2">Sponsor Hub Info Goes Here</h1>
</header>
{/if}
<section>
{#if $slct.sponsorship_id}
<div class="text-center m-4">
{#if $slct.sponsorship_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>
{#if $ae_loc.trusted_access}
<button
class="btn preset-tonal-primary border border-primary-500 w-96"
on:click={() => {
ae_util.handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
modalStore.trigger(modal_edit__sponsorship_obj);
// $ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
// $slct_trigger = 'load__sponsorship_obj';
// $slct_trigger = 'show_edit__sponsorship_obj';
// modalStore.trigger(modal_edit__sponsorship_obj);
// $ae_trig.m_sponsorships__show_modal_edit = true;
}}
>
<span class="fas fa-edit mx-1"></span>
Edit Sponsor {$slct.sponsorship_id}
</button>
{:else}
<button
class="btn preset-tonal-primary border border-primary-500 w-96"
on:click={() => {
ae_util.handle_url_and_message('sponsorship_id', null);
modalStore.trigger(modal_edit__sponsorship_obj);
// $slct_trigger = 'load__sponsorship_obj';
$slct_trigger = 'show_edit__sponsorship_obj';
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
// modalStore.trigger(modal_edit__sponsorship_obj);
}}
>
<span class="fas fa-edit mx-1"></span>
Start Sponsor Submission Form
</button>
{/if}
{:else}
<div class="text-center m-4">
The CHOW 2024 sponsor Hub has closed. If you have changes to your gala RSVP list please email Laurie VanBenschoten, <a href="mailto:lvanbenschoten@marinesanctuary.org" class="text-blue-500">lvanbenschoten@marinesanctuary.org</a>, AND Erin Quigg, <a href="mailto:erinq@preconevents.com" class="text-blue-500">erinq@preconevents.com</a>.
</div>
{/if}
</section>
{#if $ae_loc.ds.hub__page__sponsorships__create_info}
{@html $ae_loc.ds.hub__page__sponsorships__create_info}
{:else}
<section>
<div class="alert alert-info">
More information can go here or this can be hidden.
</div>
</section>
{/if}
</section>