Bug fixes and clean up for CHOW

This commit is contained in:
Scott Idem
2024-03-11 12:48:23 -04:00
parent 1559bae11c
commit ef2597d114
2 changed files with 78 additions and 37 deletions

View File

@@ -116,6 +116,8 @@ export let ae_app_local_data_struct: key_val = {
show_list__sponsorship_obj_li: true, show_list__sponsorship_obj_li: true,
show_view__sponsorship_obj: false, show_view__sponsorship_obj: false,
show_question__accommodations: false,
submit_status: null, // 'saving', 'created', 'updated' submit_status: null, // 'saving', 'created', 'updated'
}, },

View File

@@ -78,6 +78,7 @@ if ($slct.sponsorship_id) {
media_li_json: null, media_li_json: null,
questions_li_json: { questions_li_json: {
accommodations: null,
accommodations_text: null, accommodations_text: null,
public_recognition: null, public_recognition: null,
social_email: null, social_email: null,
@@ -146,11 +147,24 @@ onMount(() => {
}); });
let show_question__accommodations = false;
$: if ($slct.sponsorship_obj) { $: if ($slct.sponsorship_obj) {
if ($slct.sponsorship_obj.questions_li_json && $slct.sponsorship_obj.questions_li_json.accommodations_text) {
console.log('Set q_accodomations to true.');
// $ae_loc.mod.sponsorships.show_question__accommodations = true;
// show_question__accommodations = true;
// $slct.sponsorship_obj.q_accommodations = true;
// $slct.sponsorship_obj.questions_li_json.accommodations
}
// Logo related // Logo related
if ($slct.sponsorship_obj.logo_li_json) { 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) { 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({ 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, 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}`, filename: `${$slct.sponsorship_obj.name} [logo_primary].${$slct.sponsorship_obj.logo_li_json.primary.extension}`,
inc_link: true, inc_link: true,
@@ -160,6 +174,8 @@ $: if ($slct.sponsorship_obj) {
} }
if ($slct.sponsorship_obj.logo_li_json.light && $slct.sponsorship_obj.logo_li_json.light.hosted_file_id_random) { 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({ 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, 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}`, filename: `${$slct.sponsorship_obj.name} [logo_light].${$slct.sponsorship_obj.logo_li_json.light.extension}`,
inc_link: true, inc_link: true,
@@ -169,6 +185,8 @@ $: if ($slct.sponsorship_obj) {
} }
if ($slct.sponsorship_obj.logo_li_json.dark && $slct.sponsorship_obj.logo_li_json.dark.hosted_file_id_random) { 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({ 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, 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}`, filename: `${$slct.sponsorship_obj.name} [logo_dark].${$slct.sponsorship_obj.logo_li_json.dark.extension}`,
inc_link: true, inc_link: true,
@@ -181,6 +199,8 @@ $: if ($slct.sponsorship_obj) {
if ($slct.sponsorship_obj.media_li_json) { 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) { 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({ 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, 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}`, filename: `${$slct.sponsorship_obj.name} [promo_video].${$slct.sponsorship_obj.media_li_json.promo_video.extension}`,
inc_link: true, inc_link: true,
@@ -191,41 +211,41 @@ $: if ($slct.sponsorship_obj) {
} }
} }
function create_a_element({hosted_file_id, filename=null, extension=null, text="Download", class_li='text-blue-500'}) { // function create_a_element({hosted_file_id, filename=null, extension=null, text="Download", class_li='text-blue-500'}) {
return `<a href="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}&filename=${filename}" class="${class_li}">${text}</a>`; // return `<a href="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}&filename=${filename}" class="${class_li}">${text}</a>`;
} // }
function create_img_element({hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) { // function create_img_element({hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) {
let img_html = ''; // let img_html = '';
if (filename) { // if (filename) {
img_html = `<img src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}&filename=${filename}" class="${class_li}" />`; // img_html = `<img src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}&filename=${filename}" class="${class_li}" />`;
} else { // } else {
img_html = `<img src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}" class="${class_li}" />`; // img_html = `<img src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}" class="${class_li}" />`;
} // }
if (inc_link) { // if (inc_link) {
let a_html = create_a_element({hosted_file_id: hosted_file_id, filename: filename, extension: extension}); // let a_html = create_a_element({hosted_file_id: hosted_file_id, filename: filename, extension: extension});
img_html = `<div class="ae_img ae_a">${img_html}${a_html}</div>`; // img_html = `<div class="ae_img ae_a">${img_html}${a_html}</div>`;
} // }
return img_html; // return img_html;
} // }
function create_video_element({hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) { // function create_video_element({hosted_file_id, filename=null, extension=null, class_li='max-w-64', inc_link=false}) {
let video_html = ''; // let video_html = '';
if (filename) { // if (filename) {
video_html = `<video src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}&filename=${filename}" controls class="${class_li}"></video>`; // video_html = `<video src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}&filename=${filename}" controls class="${class_li}"></video>`;
} else { // } else {
video_html = `<video src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}" controls class="${class_li}"></video>`; // video_html = `<video src="${$ae_api.base_url}/hosted_file/${hosted_file_id}/download?x_no_account_id_token=${$ae_loc.account_id}" controls class="${class_li}"></video>`;
} // }
if (inc_link) { // if (inc_link) {
let a_html = create_a_element({hosted_file_id: hosted_file_id, filename: filename, extension: extension}); // let a_html = create_a_element({hosted_file_id: hosted_file_id, filename: filename, extension: extension});
video_html = `<div class="ae_video ae_a">${video_html}${a_html}</div>`; // video_html = `<div class="ae_video ae_a">${video_html}${a_html}</div>`;
} // }
return video_html; // return video_html;
} // }
async function handle_submit_form(event) { async function handle_submit_form(event) {
console.log('*** handle_submit_form() ***'); console.log('*** handle_submit_form() ***');
@@ -340,6 +360,11 @@ async function handle_submit_form(event) {
// These questions are coming in from multiple forms. We need to make sure we do not clear out any existing question responses. // These questions are coming in from multiple forms. We need to make sure we do not clear out any existing question responses.
let temp_questions = $slct.sponsorship_obj.questions_li_json; let temp_questions = $slct.sponsorship_obj.questions_li_json;
// q_accomodations // q_accomodations
if (typeof sponsorship_di.q_accommodations !== 'undefined') {
temp_questions['accommodations'] = Number(sponsorship_di.q_accommodations);
}
if (typeof sponsorship_di.accommodations_text !== 'undefined') { if (typeof sponsorship_di.accommodations_text !== 'undefined') {
temp_questions['accommodations_text'] = sponsorship_di.accommodations_text; temp_questions['accommodations_text'] = sponsorship_di.accommodations_text;
@@ -986,7 +1011,7 @@ async function handle_delete_sponsorship_obj({sponsorship_id, hosted_file_id=nul
<!-- Start --> <!-- Start -->
General Info General Info
</Tab> </Tab>
<!-- Marketing for social media and email Level 1 and above with other restrictions --> <!-- Marketing - For social media and email Level 1 and above with other restrictions -->
<Tab <Tab
bind:group={$store_current_tab} bind:group={$store_current_tab}
name="tab_marketing" value={'marketing'} name="tab_marketing" value={'marketing'}
@@ -1001,9 +1026,13 @@ async function handle_delete_sponsorship_obj({sponsorship_id, hosted_file_id=nul
</svelte:fragment> </svelte:fragment>
Marketing Marketing
</Tab> </Tab>
<!-- Exhibit Level 2 and above --> <!-- Exhibit - Level 2 and above -->
{#if $slct.sponsorship_obj.level_num >= 2} {#if $slct.sponsorship_obj.level_num >= 2}
<Tab bind:group={$store_current_tab} name="tab_exhibit" value={'exhibit'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 2} <Tab
bind:group={$store_current_tab}
name="tab_exhibit"
value={'exhibit'}
disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 2}
regionTab={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 2 ? 'text-slate-400' : ''} regionTab={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 2 ? 'text-slate-400' : ''}
> >
<svelte:fragment slot="lead"> <svelte:fragment slot="lead">
@@ -1015,8 +1044,15 @@ async function handle_delete_sponsorship_obj({sponsorship_id, hosted_file_id=nul
Exhibitor Info Exhibitor Info
</Tab> </Tab>
{/if} {/if}
{#if $slct.sponsorship_obj.level_num >= 3} {#if $slct.sponsorship_obj.level_num >= 3}
<Tab bind:group={$store_current_tab} name="tab_session" value={'sessions'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 3}> <Tab
bind:group={$store_current_tab}
name="tab_session"
value={'sessions'}
disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 3}
regionTab={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 3 ? 'text-slate-400' : ''}
>
<svelte:fragment slot="lead"> <svelte:fragment slot="lead">
{#if $slct.sponsorship_obj.questions_li_json && ($slct.sponsorship_obj.questions_li_json.virtual_session || $slct.sponsorship_obj.questions_li_json.virtual_session === 0)} {#if $slct.sponsorship_obj.questions_li_json && ($slct.sponsorship_obj.questions_li_json.virtual_session || $slct.sponsorship_obj.questions_li_json.virtual_session === 0)}
<span class="fas fa-check text-green-500"></span> <span class="fas fa-check text-green-500"></span>
@@ -1468,24 +1504,27 @@ async function handle_delete_sponsorship_obj({sponsorship_id, hosted_file_id=nul
/> />
<!-- <h3 class="h4">Special Accommodations</h3> <!-- <h3 class="h4">Special Accommodations</h3>
<p class="text-sm">If you require any special accommodations in order to enhance/enable your involvement with CHOW please provide details in the text box below. A member of the CHOW team will reach out to assist.</p> --> <p class="text-sm">If you require any special accommodations in order to enhance/enable your involvement with CHOW please provide details in the text box below. A member of the CHOW team will reach out to assist.</p> -->
<!-- bind:group={$ae_loc.mod.sponsorships.show_question__accommodations} -->
<!-- bind:group={$slct.sponsorship_obj.questions_li_json.accommodations} -->
<label for="q_accommodations" class="label"> <label for="q_accommodations" class="label">
<input <input
type="checkbox" type="checkbox"
class="checkbox" class="checkbox"
id="q_accommodations" id="q_accommodations"
name="q_accommodations" name="q_accommodations"
bind:group={$ae_loc.mod.sponsorships.show_question__accommodations} value={1}
value="show" bind:checked={$slct.sponsorship_obj.questions_li_json.accommodations}
checked={($slct.sponsorship_obj.questions_li_json && $slct.sponsorship_obj.questions_li_json.accommodations_text)}
> >
Yes, please have a member of the CHOW team reach out for special accommodations or assistance. Yes, please have a member of the CHOW team reach out for special accommodations or assistance.
</label> </label>
{#if ($ae_loc.mod.sponsorships.show_question__accommodations == 'show')} <!-- x{$ae_loc.mod.sponsorships.show_question__accommodations}z -->
{#if ($slct.sponsorship_obj.questions_li_json.accommodations == true)}
<p class="text-sm">If you require any special accommodations in order to enhance/enable your involvement with CHOW please provide details in the text box below. A member of the CHOW team will reach out to assist.</p> <p class="text-sm">If you require any special accommodations in order to enhance/enable your involvement with CHOW please provide details in the text box below. A member of the CHOW team will reach out to assist.</p>
<label for="accommodations_text" class="label"> <label for="accommodations_text" class="label">
<textarea <textarea
class="textarea" class="textarea"
id="accommodations_text" id="accommodations_text"
name="accommodations_text" name="accommodations_text"
rows="5" rows="5"