From b21f9c0437557123cac8ad5e8a8bce79f0a29ab7 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 29 Feb 2024 20:24:08 -0500 Subject: [PATCH] Wrapping up for the night. Mostly good for demo tomorrow morning. --- src/app.postcss | 11 ++ src/lib/ae_stores.ts | 23 ++- .../10_edit_modal__event_presenter_obj.svelte | 31 ++-- .../10_view_modal__event_presenter_obj.svelte | 7 +- src/routes/sponsorships/+page.svelte | 26 ++- .../10_edit_modal__sponsorship_obj.svelte | 172 ++++++++++++++---- .../10_view_modal__sponsorship_obj.svelte | 2 +- 7 files changed, 206 insertions(+), 66 deletions(-) diff --git a/src/app.postcss b/src/app.postcss index 0040f2a3..348495f1 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -76,3 +76,14 @@ body[data-theme]:has(#page.iframe) { background: none; background-image: none; } + +pre.pre_wrap { + white-space: pre-wrap; + word-break: normal; + word-wrap: normal; + + border: none; + + max-width: 100%; + overflow-x: auto; +} \ No newline at end of file diff --git a/src/lib/ae_stores.ts b/src/lib/ae_stores.ts index 1c116ba8..7c90c59c 100644 --- a/src/lib/ae_stores.ts +++ b/src/lib/ae_stores.ts @@ -88,10 +88,19 @@ export let ae_app_local_data_struct: key_val = { for_type: null, for_id: null, + level_guest_max_li: { + 0: 0, + 1: 4, + 2: 8, + 3: 8, + 4: 8, + 5: 16, // This is a guess for CHOW 2024!!! + 6: 16, // This is a guess for CHOW 2024!!! + }, + show_edit__sponsorship_obj: false, show_list__sponsorship_obj_li: true, show_view__sponsorship_obj: false, - disable_submit__sponsorship_obj: false, submit_status: null, // 'saving', 'created', 'updated' }, @@ -109,11 +118,6 @@ export let ae_loc: Writable = localStorageStore('ae_loc', ae_app_local_ // console.log(`AE Stores - App Local Storage Data:`, get(ae_loc)); -// This does not work yet...? Don't use. -// const ae_loc_store: Writable = localStorageStore('ae_loc', ae_app_local_data_struct); -// console.log(`store - $ae_loc:`, ae_loc_store); - - // *** BEGIN *** Temporary app data. This should be stored to session storage. export let ae_app_session_data_struct: key_val = { 'ver': '2024-02-27_13', @@ -139,7 +143,12 @@ export let ae_app_session_data_struct: key_val = { }, 'journals': {}, 'posts': {}, - 'sponsorships': {}, + 'sponsorships': { + disable_submit__sponsorship_obj: false, + slct__level_num: 0, + show_question__accommodations: false, + submit_status: null, // 'saving', 'created', 'updated', 'saved' + }, 'testing': {}, }, }; 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 9af8fb90..266927d9 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 @@ -54,9 +54,8 @@ let ae_promises: key_val = {}; // Promise; $ae_loc.mod.events.submit_status = null; $ae_loc.mod.events.disable_submit__event_presenter_obj = false; let placeholder_li: key_val = { - file_logo_primary: '-- No File Selected --', - file_logo_secondary: '-- No File Selected --', - file_media_promo_video: '-- No File Selected --', + image_headshot: '-- No File Selected --', + image_example: '-- No File Selected --', }; if ($slct.event_presenter_id) { @@ -81,12 +80,12 @@ if ($slct.event_presenter_id) { biography: null, - picture_path: null, + // picture_path: null, - // logo_li_json: null, + image_li_json: null, // media_li_json: null, - social_li_json: null, + // social_li_json: null, enable: null, }; @@ -95,10 +94,11 @@ if ($slct.event_presenter_id) { $: if ($slct.event_presenter_obj) { // Create HTML for showing pictures here? - // if ($slct.event_presenter_obj.logo_li_json) { - // if ($slct.event_presenter_obj.logo_li_json.primary.hosted_file_id_random) { - // placeholder_li.file_logo_primary = `${$slct.event_presenter_obj.logo_li_json.primary.filename}`; - // } + 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}`; + } + } // if ($slct.event_presenter_obj.logo_li_json.secondary.hosted_file_id_random) { // placeholder_li.file_logo_secondary = `${$slct.event_presenter_obj.logo_li_json.secondary.filename}`; // } @@ -260,8 +260,11 @@ async function handle_submit_form_files(event) { if (event.target.image_headshot.files.length > 0) { console.log('The headshot image file was found.'); + hosted_file_results = await handle_input_upload_files(event.target.image_headshot.files); + event_presenter_do.image_li_json = {}; + if (hosted_file_results) { event_presenter_do.image_li_json.headshot = hosted_file_results[0]; console.log(event_presenter_do.image_li_json); @@ -658,7 +661,7 @@ async function handle_update__event_presenter({ - +

Biography length: {($slct.event_presenter_obj.biography ? $slct.event_presenter_obj.biography.length : 0)} characters

1,375 is roughly 250 to 300 words

@@ -706,9 +709,9 @@ async function handle_update__event_presenter({ console.log('*** FileDropzone change event ***', e); if (e.target.files.length) { - placeholder_li.file_logo_primary = `Ready to upload: ${e.target.files[0].name}`; + placeholder_li.image_headshot = `Ready to upload: ${e.target.files[0].name}`; } else { - placeholder_li.file_logo_primary = 'No files selected.'; + placeholder_li.image_headshot = 'No files selected.'; } }} > @@ -716,7 +719,7 @@ async function handle_update__event_presenter({ Upload your file (drag and drop) PNG, WEBP, JPG only image types - {@html placeholder_li.file_logo_primary} + {@html placeholder_li.image_headshot} diff --git a/src/routes/events_speakers/10_view_modal__event_presenter_obj.svelte b/src/routes/events_speakers/10_view_modal__event_presenter_obj.svelte index ef15f530..8d66ffb1 100644 --- a/src/routes/events_speakers/10_view_modal__event_presenter_obj.svelte +++ b/src/routes/events_speakers/10_view_modal__event_presenter_obj.svelte @@ -35,12 +35,14 @@ onMount(() => { {@html $slct.event_presenter_obj.full_name} +

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

+
Biography:
-
{@html $slct.event_presenter_obj.biography ? $slct.event_presenter_obj.biography : '-- No Bio Given --'}
+
{@html $slct.event_presenter_obj.biography ? $slct.event_presenter_obj.biography : '-- No Bio Given --'}
{
Approved: - $ {$slct.event_presenter_obj.approve ? 'Yes, marked as approved' : 'Not yet marked as approved'} @@ -77,7 +78,7 @@ onMount(() => {

More Information

-
More info will go here
+
More info can go here
diff --git a/src/routes/sponsorships/+page.svelte b/src/routes/sponsorships/+page.svelte index 30db1c80..229124f5 100644 --- a/src/routes/sponsorships/+page.svelte +++ b/src/routes/sponsorships/+page.svelte @@ -253,7 +253,7 @@ async function handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id, try_c let params = {}; - // $ae_loc.hub.sponsorship_cfg_id_qry_status = 'loading'; + // $ae_loc.mod.sponsorships.qry_status = 'loading'; ae_sponsorship_cfg_obj_get_promise = api.get_ae_obj_id_crud({ api_cfg: $ae_api, obj_type: 'sponsorship_cfg', @@ -284,6 +284,30 @@ async function handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id, try_c }) .catch(function (error) { console.log('No results returned or failed.', error); + }) + .finally(function () { + $ae_loc.mod.sponsorships.level_guest_max_li = { + 0: 0, + 1: 4, + 2: 8, + 3: 8, + 4: 8, + 5: 16, // This is a guess for CHOW 2024!!! + 6: 16, // This is a guess for CHOW 2024!!! + }; + // $ae_loc.mod.sponsorships.level_guest_max_li = { + // '0': 0, + // '1': 4, + // '2': 8, + // '3': 8, + // '4': 8, + // '5': 16, // This is a guess for CHOW 2024!!! + // '6': 16, // This is a guess for CHOW 2024!!! + // }; + // if ($slct.sponsorship_cfg_obj.info_about_levels) { + // $slct.sponsorship_cfg_obj.info_about_levels = JSON.parse($slct.sponsorship_cfg_obj.info_about_levels); + // } + // $ae_loc.hub.sponsorship_cfg_id_qry_status = 'done'; }); return ae_sponsorship_cfg_obj_get_promise; diff --git a/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte b/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte index b797537d..80ed9f0d 100644 --- a/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte +++ b/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte @@ -35,6 +35,7 @@ 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(() => { @@ -79,8 +80,8 @@ const cForm = 'border border-surface-500 p-4 space-y-4 rounded-container-token'; let ae_promises: key_val = {}; // Promise; -$ae_loc.mod.sponsorships.submit_status = null; -$ae_loc.mod.sponsorships.disable_submit__sponsorship_obj = false; +$ae_sess.mod.sponsorships.submit_status = null; +$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false; let placeholder_li: key_val = { file_logo_primary: '-- No File Selected --', file_logo_secondary: '-- No File Selected --', @@ -104,6 +105,8 @@ if ($slct.sponsorship_id) { logo_li_json: null, media_li_json: null, + questions_li_json: null, + social_li_json: null, guest_li_json: null, @@ -121,16 +124,16 @@ $: if ($slct.sponsorship_obj) { // Logo related if ($slct.sponsorship_obj.logo_li_json) { if ($slct.sponsorship_obj.logo_li_json.primary.hosted_file_id_random) { - placeholder_li.file_logo_primary = `${$slct.sponsorship_obj.logo_li_json.primary.filename}`; + placeholder_li.file_logo_primary = `${$slct.sponsorship_obj.logo_li_json.primary.filename}`; } if ($slct.sponsorship_obj.logo_li_json.secondary.hosted_file_id_random) { - placeholder_li.file_logo_secondary = `${$slct.sponsorship_obj.logo_li_json.secondary.filename}`; + placeholder_li.file_logo_secondary = `${$slct.sponsorship_obj.logo_li_json.secondary.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 = `${$slct.sponsorship_obj.media_li_json.promo_video.filename}`; + placeholder_li.file_media_promo_video = `${$slct.sponsorship_obj.media_li_json.promo_video.filename}`; } } } @@ -138,8 +141,8 @@ $: if ($slct.sponsorship_obj) { async function handle_submit_form(event) { console.log('*** handle_submit_form() ***'); - $ae_loc.mod.sponsorships.disable_submit__sponsorship_obj = true; - $ae_loc.mod.sponsorships.submit_status = 'saving'; + $ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = true; + $ae_sess.mod.sponsorships.submit_status = 'saving'; // Data in let form_data = new FormData(event.target); @@ -211,6 +214,41 @@ async function handle_submit_form(event) { sponsorship_do['amount'] = Number(sponsorship_di.amount)*100; } + let temp_questions = {}; + // q_accomodations + if (typeof sponsorship_di.accommodations !== 'undefined') { + + temp_questions['accommodations'] = sponsorship_di.accommodations_text; + } + + // Marketing for ocial media and email related questions + // q_public_recognition - Friend level and above + + // q_social_email - Champion level and above + + // q_social_promos - Signature Partner level only + + // Exibit booth related questions + // q_table_exhibit - Supporter level and above + if (typeof sponsorship_di.table_exhibit !== 'undefined') { + temp_questions['table_exhibit'] = sponsorship_di.table_exhibit; + } + + // q_table_power - Supporter level and above + if (typeof sponsorship_di.table_power !== 'undefined') { + temp_questions['table_power'] = sponsorship_di.table_power; + } + + // Virtual sessions related questions + // q_virtual_sessions - Champion level and above + + // Plenary sessions related questions + // q_plenary_sessions - Advocate level and above + // q_plenary_opening - Advocate level and above + + // q_promo_video - Presenting Partner level and above + // This is taken care of below with the file uploads. + // Loop through possible guest list (up to 20) and add to the guest_li_json array. let temp_guest_li = []; @@ -278,8 +316,8 @@ async function handle_submit_form(event) { // $ae_loc.mod.sponsorships.link = `${$ae_loc.href_url}/load?sponsorship_id=${$slct.sponsorship_id}`; $ae_loc.mod.sponsorships.link = `${$ae_loc.site_domain}/sponsorships/load?sponsorship_id=${$slct.sponsorship_id}`; console.log('Sponsorship link:', $ae_loc.mod.sponsorships.link); - $ae_loc.mod.sponsorships.disable_submit__sponsorship_obj = false; - $ae_loc.mod.sponsorships.submit_status = 'created'; + $ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false; + $ae_sess.mod.sponsorships.submit_status = 'created'; } else { ae_promises.update__sponsorship_obj = await handle_update__sponsorship({ @@ -287,16 +325,16 @@ async function handle_submit_form(event) { obj_id: $slct.sponsorship_id, data: sponsorship_do }); - $ae_loc.mod.sponsorships.disable_submit__sponsorship_obj = false; - $ae_loc.mod.sponsorships.submit_status = 'updated'; + $ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false; + $ae_sess.mod.sponsorships.submit_status = 'updated'; } } async function handle_submit_form_files(event) { console.log('*** handle_submit_form() ***'); - $ae_loc.mod.sponsorships.disable_submit__sponsorship_obj = true; - $ae_loc.mod.sponsorships.submit_status = 'saving'; + $ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = true; + $ae_sess.mod.sponsorships.submit_status = 'saving'; let sponsorship_do: key_val = {}; @@ -327,7 +365,7 @@ async function handle_submit_form_files(event) { if (hosted_file_results) { sponsorship_do.logo_li_json.primary = hosted_file_results[0]; console.log(sponsorship_do.logo_li_json); - placeholder_li.file_logo_primary = `${sponsorship_do.logo_li_json.primary.filename}`; + placeholder_li.file_logo_primary = `${sponsorship_do.logo_li_json.primary.filename}`; } } @@ -359,7 +397,7 @@ async function handle_submit_form_files(event) { obj_id: $slct.sponsorship_id, data: sponsorship_do }); - $ae_loc.mod.sponsorships.submit_status = 'updated'; + $ae_sess.mod.sponsorships.submit_status = 'updated'; // let sponsorship_do: key_val = { // logo_li_json: { @@ -728,7 +766,7 @@ async function handle_update__sponsorship({ + {/if} @@ -1170,16 +1262,16 @@ async function handle_update__sponsorship({ Social Media @@ -1210,7 +1302,7 @@ async function handle_update__sponsorship({