From 64589ec11ce7c7ce8af0bc01160a257dca6a494a Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Sun, 3 Mar 2024 12:31:32 -0500 Subject: [PATCH] Too many changes. Getting ready to show Jordan. --- src/app.postcss | 41 ++++- src/lib/ae_stores.ts | 6 + src/lib/ae_utils.ts | 40 +++++ src/routes/+layout.svelte | 8 +- src/routes/events_speakers/+page.svelte | 164 ++++++++++-------- .../10_edit_modal__event_presenter_obj.svelte | 83 +++++---- .../10_view_modal__event_presenter_obj.svelte | 10 +- src/routes/sponsorships/+page.svelte | 131 +------------- .../10_edit_modal__sponsorship_obj.svelte | 74 ++++---- .../10_list__sponsorship_obj.svelte | 2 +- .../10_view_modal__sponsorship_obj.svelte | 7 + src/routes/sponsorships/[slug]/+page.svelte | 8 +- 12 files changed, 296 insertions(+), 278 deletions(-) diff --git a/src/app.postcss b/src/app.postcss index 348495f1..7fe60d20 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -86,4 +86,43 @@ pre.pre_wrap { max-width: 100%; overflow-x: auto; -} \ No newline at end of file +} + + +input.required { + /* border-right: solid medium var(--color-warning-500); */ + /* color: var(--color-warning-500); */ +} + +input:required { + /* background-color: var(--alert-color-lightest); */ + /* border: solid 2px red; */ + /* outline: dashed thin var(--alert-color-lighter); */ + + /* border-right: solid medium var(--alert-color-mid); */ + /* border-right: solid medium var(--warning-color-mid); */ + /* border-right: solid medium var(--error-color-mid); */ +} +/* input:required:hover { + background-color: var(--alert-color-lighter); + border-right: solid thick var(--alert-color-darker); +} */ + +/* input:required::before { + display: block; + + content: '*'; + color: var(--warning-color-darker); + + top: 5px; + left: 5px; +} */ + +/* .input_required::after { + content: '*'; + color: var(--warning-color-darker); + + position: relative; + top: 5px; + left: 5px; +} */ \ No newline at end of file diff --git a/src/lib/ae_stores.ts b/src/lib/ae_stores.ts index 976a683a..71394b34 100644 --- a/src/lib/ae_stores.ts +++ b/src/lib/ae_stores.ts @@ -68,6 +68,12 @@ export let ae_app_local_data_struct: key_val = { 'events': { 'event_id': null, + show_edit__event_presenter_obj: false, + show_list__event_presenter_obj_li: true, + show_view__event_presenter_obj: false, + + submit_status: null, // 'saving', 'created', 'updated' + // Badge Printing // Lead Retrievals diff --git a/src/lib/ae_utils.ts b/src/lib/ae_utils.ts index 8057dc3f..b006bdde 100644 --- a/src/lib/ae_utils.ts +++ b/src/lib/ae_utils.ts @@ -434,10 +434,50 @@ function handle_url_and_message(name: string, value: null|string) { } +function create_a_element({account_id, base_url, hosted_file_id, filename=null, extension=null, text="Download", class_li='text-blue-500'}) { + return `${text}`; +} + +function create_img_element({account_id, base_url, hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) { + let img_html = ''; + if (filename) { + img_html = ``; + } else { + img_html = ``; + } + + if (inc_link) { + let a_html = create_a_element({account_id: account_id, base_url: base_url, hosted_file_id: hosted_file_id, filename: filename, extension: extension}); + img_html = `
${img_html}${a_html}
`; + } + + return img_html; +} + +function create_video_element({account_id, base_url, hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) { + let video_html = ''; + if (filename) { + video_html = ``; + } else { + video_html = ``; + } + + if (inc_link) { + let a_html = create_a_element({account_id: account_id, base_url: base_url, hosted_file_id: hosted_file_id, filename: filename, extension: extension}); + video_html = `
${video_html}${a_html}
`; + } + + return video_html; +} + + export let ae_util = { iso_datetime_formatter: iso_datetime_formatter, extract_prefixed_form_data: extract_prefixed_form_data, process_permission_checks: process_permission_checks, handle_url_and_message: handle_url_and_message, + create_a_element: create_a_element, + create_img_element: create_img_element, + create_video_element: create_video_element, }; // export default ae_util; \ No newline at end of file diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index fba46b41..656995e2 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -220,7 +220,7 @@ $: if ($slct_trigger == 'set_access_code_li' && !$ae_loc.ds['hub__page__access_c /> - + {:else} (fallback contents) {/if} - + --> diff --git a/src/routes/events_speakers/+page.svelte b/src/routes/events_speakers/+page.svelte index 606be409..b3660b83 100644 --- a/src/routes/events_speakers/+page.svelte +++ b/src/routes/events_speakers/+page.svelte @@ -1,12 +1,11 @@
-

Æ - Events: Speakers

+

+ + Speakers Hub +

+ {#await ae_event_presenter_obj_li_get_promise} + + + Loading... + + {/await} + {#if $slct.event_presenter_obj_li && $ae_loc.mod.events.show_list__event_presenter_obj_li} - - - + {/if}
diff --git a/src/routes/events_speakers/10_edit_modal__event_presenter_obj.svelte b/src/routes/events_speakers/10_edit_modal__event_presenter_obj.svelte index 2d5d1a45..71075de4 100644 --- a/src/routes/events_speakers/10_edit_modal__event_presenter_obj.svelte +++ b/src/routes/events_speakers/10_edit_modal__event_presenter_obj.svelte @@ -63,6 +63,7 @@ if ($slct.event_presenter_id) { console.log(`Presenter object selected:`, $slct.event_presenter_obj); } else { $store_current_tab = 'start'; + $slct.event_presenter_id = null; $slct.event_presenter_obj = { event_id_random: $ae_loc.mod.events.event_id, @@ -96,7 +97,15 @@ $: if ($slct.event_presenter_obj) { // Create HTML for showing pictures here? if ($slct.event_presenter_obj.image_li_json) { if ($slct.event_presenter_obj.image_li_json.headshot.hosted_file_id_random) { - placeholder_li.image_headshot = `${$slct.event_presenter_obj.image_li_json.headshot.filename}`; + placeholder_li.image_headshot = ae_util.create_img_element({ + account_id: $ae_loc.account_id, + base_url: $ae_api.base_url, + hosted_file_id: $slct.event_presenter_obj.image_li_json.headshot.hosted_file_id_random, + filename: `${$slct.event_presenter_obj.full_name} [headshot]`, + inc_link: true, + }) + + // `${$slct.event_presenter_obj.image_li_json.headshot.filename}`; } } // if ($slct.event_presenter_obj.logo_li_json.secondary.hosted_file_id_random) { @@ -438,11 +447,16 @@ async function handle_update__event_presenter({ Error: {error.message} {/await} + + {#if $slct.event_presenter_id && $ae_loc.mod.events.presenter_link} -
+
+ +
{/if} @@ -518,17 +555,9 @@ async function handle_update__event_presenter({ -
+
{@html $slct.event_presenter_obj.full_name} @@ -134,8 +134,8 @@ onMount(() => { --> + diff --git a/src/routes/sponsorships/+page.svelte b/src/routes/sponsorships/+page.svelte index b8c41bfd..0633e6a9 100644 --- a/src/routes/sponsorships/+page.svelte +++ b/src/routes/sponsorships/+page.svelte @@ -32,7 +32,7 @@ const modalComponentEditSponsorshipObj: ModalComponent = { ref: Edit_modal_spons const modal_edit__sponsorship_obj: ModalSettings = { type: 'component', component: modalComponentEditSponsorshipObj, - title: 'Sponsor Submission Form', // Edit Sponsorship + title: 'Sponsor Submission Form', // Editing Sponsorship position: '', // default is "items-center" response: (r: boolean | undefined) => handle_modal_close(r) @@ -67,9 +67,7 @@ function handle_modal_close(response: boolean | undefined) { if (!$ae_loc.mod.sponsorships.show_edit__sponsorship_obj && !$ae_loc.mod.sponsorships.show_view__sponsorship_obj) { $slct.sponsorship_id = null; $slct.sponsorship_obj = null; - } - } @@ -80,6 +78,10 @@ $ae_loc.site_domain = data.url.origin; $ae_loc.mod.sponsorships.show_edit__sponsorship_obj = false; $ae_loc.mod.sponsorships.show_view__sponsorship_obj = false; +let ae_sponsorship_cfg_obj_get_promise: Promise; +let ae_sponsorship_obj_li_get_promise: Promise; +let ae_sponsorship_obj_get_promise: Promise; + onMount(() => { console.log('Sponsorships: +page.svelte'); @@ -120,6 +122,7 @@ $: if ($slct_trigger == 'show_edit__sponsorship_obj' && $ae_loc.mod.sponsorships // 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; @@ -137,11 +140,7 @@ $: if ($slct_trigger == 'show_view__sponsorship_obj' && $ae_loc.mod.sponsorships // console.log('Message sent to parent (iframe):', message); } - -let ae_sponsorship_obj_li_get_promise; - - - +// 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}); @@ -152,45 +151,18 @@ 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 fulltext_search_qry_str = ($ae_loc.mod.sponsorships && $ae_loc.mod.sponsorships.fulltext_search_qry_str ? $ae_loc.mod.sponsorships.fulltext_search_qry_str : ''); - // let qry_virtual = $ae_loc.mod.sponsorships.qry_virtual; - // let qry_physical = $ae_loc.mod.sponsorships.qry_physical; - // let qry_type = $ae_loc.mod.sponsorships.qry_type; - 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 = {}; - // params['example1'] = 'all'; - // params['example2'] = false; let params_json: key_val = {}; - // if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { - // params_json['ft_qry'] = { - // 'default_qry_str': fulltext_search_qry_str, - // 'location_address_json': fulltext_search_qry_str, - // 'contact_li_json': fulltext_search_qry_str, - // 'address_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with OSIT ae? - // 'contact_1_default_qry_str': fulltext_search_qry_str, // NOTE: Remove after going live with OSIT ae? - // }; - // } - - // if (qry_virtual || qry_physical || qry_type) { - // params_json['and_qry'] = {}; - // if (qry_virtual) params_json['and_qry']['virtual'] = true; - // if (qry_physical) params_json['and_qry']['physical'] = true; - // if (qry_type) params_json['and_qry']['type'] = qry_type; - // } // console.log('params_json:', params_json); // console.log(params_json); - // NOTE: I am not sure if this is actually needed. It may save a little space in the URL. - // if (JSON.stringify(params_json) == JSON.stringify({})) { - // params_json = null; - // } $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, @@ -248,8 +220,6 @@ $: if ($slct_trigger == 'load__sponsorship_cfg_obj' && $slct.sponsorship_cfg_id) handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id: $slct.sponsorship_cfg_id, try_cache: false}); } -let ae_sponsorship_cfg_obj_get_promise; - 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}`); @@ -323,17 +293,9 @@ $: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) { $slct_trigger = null; - // $ae_loc.mod.sponsorships.link = `${$ae_loc.href_url}/id/${$slct.sponsorship_id}`; - - // $ae_loc.mod.sponsorships.link = `${data.url.origin}/sponsorships/${$slct.sponsorship_id}`; - // console.log('Sponsorship link:', $ae_loc.mod.sponsorships.link); - // $ae_loc = $ae_loc; - handle_load_ae_obj_id__sponsorship({sponsorship_id: $slct.sponsorship_id, try_cache: false}); } -let ae_sponsorship_obj_get_promise; - 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}`); @@ -347,26 +309,13 @@ async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=fal 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 + 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, "*"); - - // modalStore.trigger(modal_view__sponsorship_obj); }) .catch(function (error) { console.log('No results returned or failed.', error); @@ -374,54 +323,6 @@ async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=fal return ae_sponsorship_obj_get_promise; } - - -// const modal_view__sponsorship_obj: ModalSettings = { -// type: 'component', -// component: 'modal_component_view__sponsorship_obj', -// }; - -// $: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) { -// console.log('Selected Sponsorship ID:', $slct.sponsorship_id); -// console.log('Selected Sponsorship Object:', $slct.sponsorship_obj); - -// $slct_trigger = null; -// } - - - -// const modal: ModalSettings = { -// type: 'alert', -// // Data -// title: 'Example Alert', -// body: 'This is an example modal.', -// image: 'https://i.imgur.com/WOgTG96.gif', -// }; -// modalStore.trigger(modal); - - -// const drawerStore = getDrawerStore(); - -// const drawer_settings_edit: DrawerSettings = { -// id: 'sponsorships__edit', -// meta: { foo: 'bar', fizz: 'buzz', age: 40 } -// }; - -// const drawer_settings_x: DrawerSettings = { -// id: 'example-1', -// meta: { foo: 'bar', fizz: 'buzz', age: 40 } -// }; - -// const drawer_settings_y: DrawerSettings = { -// id: 'example-2', -// // Provide your property overrides: -// bgDrawer: 'bg-purple-900 text-white', -// bgBackdrop: 'bg-gradient-to-tr from-indigo-500/50 via-purple-500/50 to-pink-500/50', -// width: 'w-[280px] md:w-[480px]', -// padding: 'p-4', -// rounded: 'rounded-xl', -// }; - @@ -487,25 +388,9 @@ async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=fal
{/await} {#if $slct.sponsorship_obj_li && $ae_loc.mod.sponsorships.show_list__sponsorship_obj_li} - {/if} - - - - - diff --git a/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte b/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte index 8dd6deca..ad55a071 100644 --- a/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte +++ b/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte @@ -35,7 +35,6 @@ import { ae_util } from '$lib/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'; - import ListSponsorshipObj from './10_list__sponsorship_obj.svelte'; onMount(() => { @@ -96,6 +95,7 @@ if ($slct.sponsorship_id) { console.log(`Sponsorship object selected:`, $slct.sponsorship_obj); } else { $store_current_tab = 'start'; + $slct.sponsorship_id = null; $slct.sponsorship_obj = { sponsorship_cfg_id_random: $ae_loc.mod.sponsorships.cfg_id, @@ -733,17 +733,20 @@ async function handle_update__sponsorship({ diff --git a/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte b/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte index 34ab005d..da6df926 100644 --- a/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte +++ b/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte @@ -33,8 +33,15 @@ onMount(() => {
{@html $slct.sponsorship_obj.name} + +
+

This quick view of a sponsorship's information is customizable or can be hidden completely.

+
Point of Contact: diff --git a/src/routes/sponsorships/[slug]/+page.svelte b/src/routes/sponsorships/[slug]/+page.svelte index bc174067..bbfd3e66 100644 --- a/src/routes/sponsorships/[slug]/+page.svelte +++ b/src/routes/sponsorships/[slug]/+page.svelte @@ -30,7 +30,7 @@ const modalComponentEditSponsorshipObj: ModalComponent = { ref: Edit_modal_spons const modal_edit__sponsorship_obj: ModalSettings = { type: 'component', component: modalComponentEditSponsorshipObj, - title: 'Edit Your Sponsorship', + title: 'Edit Your Sponsorship Submission', position: '', // default is "items-center" response: (r: boolean | undefined) => handle_modal_close(r) @@ -64,6 +64,8 @@ $ae_loc.site_domain = data.url.origin; $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; + onMount(() => { console.log('Sponsorships [New/Edit]: +page.svelte'); @@ -169,8 +171,6 @@ $: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) { // $slct_trigger = 'show_edit__sponsorship_obj'; } -let ae_sponsorship_obj_get_promise; - 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}`); @@ -184,7 +184,7 @@ async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=fal 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 + log_lvl: 0 }) .then(function (sponsorship_obj_get_result) { if (sponsorship_obj_get_result) {