Wrapping up for Friday night

This commit is contained in:
Scott Idem
2024-03-01 18:55:26 -05:00
parent f4ed04497e
commit 9fe4c51a67

View File

@@ -74,6 +74,8 @@ onMount(() => {
// console.log(`ae_loc = `, get(ae_loc));
return true;
});
// console.log($slct.sponsorship_obj.address_li_json.mailing);
});
const cForm = 'border border-surface-200 p-4 space-y-4 rounded-container-token';
@@ -246,7 +248,9 @@ async function handle_submit_form(event) {
sponsorship_do['paid'] = !!sponsorship_di.paid;
}
let temp_questions = {};
// 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;
// q_accomodations
if (typeof sponsorship_di.accommodations_text !== 'undefined') {
@@ -266,20 +270,46 @@ async function handle_submit_form(event) {
// q_public_recognition - Friend level and above
if (typeof sponsorship_di.q_public_recognition !== 'undefined') {
temp_questions['public_recognition'] = Number(sponsorship_di.q_public_recognition);
}
// q_social_email - Champion level and above
if (typeof sponsorship_di.q_social_email !== 'undefined') {
temp_questions['social_email'] = Number(sponsorship_di.q_social_email);
}
// q_dedicated_promos - Signature Partner level only
if (typeof sponsorship_di.q_dedicated_promos !== 'undefined') {
temp_questions['dedicated_promos'] = Number(sponsorship_di.q_dedicated_promos);
}
// Exibit booth related questions
// q_table_exhibit - Supporter level and above
if (typeof sponsorship_di.q_table_exhibit !== 'undefined') {
temp_questions['table_exhibit'] = sponsorship_di.q_table_exhibit;
temp_questions['table_exhibit'] = Number(sponsorship_di.q_table_exhibit);
}
// q_table_power - Supporter level and above
if (typeof sponsorship_di.q_table_power !== 'undefined') {
temp_questions['table_power'] = sponsorship_di.q_table_power;
temp_questions['table_power'] = Number(sponsorship_di.q_table_power);
}
// Virtual sessions related questions
// q_virtual_session - Champion level and above
if (typeof sponsorship_di.q_virtual_session !== 'undefined') {
temp_questions['virtual_session'] = Number(sponsorship_di.q_virtual_session);
}
// Plenary sessions related questions
// q_plenary_session - Advocate level and above
if (typeof sponsorship_di.q_plenary_session !== 'undefined') {
temp_questions['plenary_session'] = Number(sponsorship_di.q_plenary_session);
}
// q_plenary_opening - Advocate level and above
if (typeof sponsorship_di.q_plenary_opening !== 'undefined') {
temp_questions['plenary_opening'] = Number(sponsorship_di.q_plenary_opening);
}
console.log(temp_questions);
@@ -288,16 +318,11 @@ async function handle_submit_form(event) {
sponsorship_do['questions_li_json'] = temp_questions;
}
// Virtual sessions related questions
// q_virtual_session - Champion level and above
// Plenary sessions related questions
// q_plenary_session - 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 = [];
@@ -308,12 +333,18 @@ async function handle_submit_form(event) {
given_name: sponsorship_di[`guest_${i}_given_name`],
family_name: sponsorship_di[`guest_${i}_family_name`],
full_name: guest_x_full_name,
email: sponsorship_di[`guest_${i}_email`],
phone_mobile: sponsorship_di[`guest_${i}_phone_mobile`],
phone_home: sponsorship_di[`guest_${i}_phone_home`],
phone_office: sponsorship_di[`guest_${i}_phone_office`],
city: sponsorship_di[`guest_${i}_city`],
other_text: sponsorship_di[`guest_${i}_other_text`],
title: sponsorship_di[`guest_${i}_title`],
affiliations: sponsorship_di[`guest_${i}_affiliations`],
ada: sponsorship_di[`guest_${i}_ada`],
dietary: sponsorship_di[`guest_${i}_dietary`],
// email: sponsorship_di[`guest_${i}_email`],
// phone_mobile: sponsorship_di[`guest_${i}_phone_mobile`],
// phone_home: sponsorship_di[`guest_${i}_phone_home`],
// phone_office: sponsorship_di[`guest_${i}_phone_office`],
// city: sponsorship_di[`guest_${i}_city`],
comments: sponsorship_di[`guest_${i}_comments`],
});
}
}
@@ -372,6 +403,19 @@ async function handle_submit_form(event) {
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
$ae_sess.mod.sponsorships.submit_status = 'updated';
}
if ($store_current_tab == 'start') {
$store_current_tab = 'marketing';
} else if ($store_current_tab == 'marketing') {
$store_current_tab = 'exhibit';
} else if ($store_current_tab == 'exhibit') {
$store_current_tab = 'sessions';
} else if ($store_current_tab == 'sessions') {
$store_current_tab = 'files';
} else if ($store_current_tab == 'files') {
$store_current_tab = 'guests';
}
}
async function handle_submit_form_files(event) {
@@ -659,10 +703,12 @@ async function handle_update__sponsorship({
Marketing
</Tab>
<!-- Exhibit Level 2 and above -->
{#if $slct.sponsorship_obj.level_num > 1}
<Tab bind:group={$store_current_tab} name="tab_exhibit" value={'exhibit'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 2}>
<svelte:fragment slot="lead"><span class="fas fa-store"></span></svelte:fragment>
Exhibitor Info
</Tab>
{/if}
<Tab bind:group={$store_current_tab} name="tab_session" value={'session'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 3}>
<svelte:fragment slot="lead"><span class="fas fa-chalkboard-teacher"></span></svelte:fragment>
Session Info
@@ -819,7 +865,7 @@ async function handle_update__sponsorship({
<label for="address_line_1" class="label max-w-64">
<!-- Line 1 (Street) -->
<input type="text" id="address_line_1" name="address_line_1" value={$slct.sponsorship_obj.address_li_json && $slct.sponsorship_obj.address_li_json.mailing && $slct.sponsorship_obj.address_li_json.mailing.line_1 ? $slct.sponsorship_obj.address_li_json.mailing.line_1 : ''} placeholder="Line 1 (street)" autocomplete="street-address" class="input text-xs" required />
<input type="text" id="address_line_1" name="address_line_1" value={$slct.sponsorship_obj.address_li_json && $slct.sponsorship_obj.address_li_json.mailing && $slct.sponsorship_obj.address_li_json.mailing.line_1 ? $slct.sponsorship_obj.address_li_json.mailing.line_1 : 'x'} placeholder="Line 1 (street)" autocomplete="street-address" class="input text-xs" required />
</label>
<label for="address_line_2" class="label max-w-64">
<!-- Line 2 (Suite) -->
@@ -1148,48 +1194,105 @@ async function handle_update__sponsorship({
<h3 class="h4">Public Recognition</h3>
<label for="q_public_recognition" class="label">
<div>Would you like public reognition at CHOW?</div>
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.public_recognition} name="q_public_recognition" value={1}>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_public_recognition"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.public_recognition}
/>
<span class="fas fa-check"></span>
Yes, please recognize me publicly as a CHOW sponsor (logo/name on website).
</RadioItem>
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.public_recognition} name="q_table_exhibit" value={0} required>
<span>Yes, please recognize me publicly as a CHOW sponsor (logo/name on website).</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_public_recognition"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.public_recognition}
/>
<span class="fas fa-times"></span>
No, I wish to remain an anonymous sponsor. Please DO NOT recognize me publicly.
</RadioItem>
</RadioGroup>
<span>No, I wish to remain an anonymous sponsor. Please DO NOT recognize me publicly.</span>
</label>
</div>
</label>
<h3 class="h4">Social Media &amp; Email Inclusion</h3>
<label for="q_social_email" class="label">
<div>Would you like social and email inclusion at CHOW?</div>
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.social_email} name="q_social_email" value={1}>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_social_email"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.social_email}
/>
<span class="fas fa-check"></span>
Yes, we would like to be included in general CHOW social media and email communications.
</RadioItem>
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.social_email} name="q_social_email" value={0} required>
<span>Yes, we would like to be included in general CHOW social media and email communications.</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_social_email"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.social_email}
/>
<span class="fas fa-times"></span>
No, we would NOT like to be included in general CHOW social media and email communications.
</RadioItem>
</RadioGroup>
<span>No, we would NOT like to be included in general CHOW social media and email communications.</span>
</label>
</div>
</label>
<h3 class="h4">Dedicated Social Promos</h3>
<label for="q_dedicated_promos" class="label">
<div>Would you like dedicated social media promotions at CHOW?</div>
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.dedicated_promos} name="q_dedicated_promos" value={1}>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_dedicated_promos"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.dedicated_promos}
/>
<span class="fas fa-check"></span>
Yes, we would like to take advantage of dedicated social media and email promotion.
</RadioItem>
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.dedicated_promos} name="q_dedicated_promos" value={0} required>
<span>Yes, we would like to take advantage of dedicated social media and email promotion.</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_dedicated_promos"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.dedicated_promos}
/>
<span class="fas fa-times"></span>
No, we would do NOT want to take advantage of dedicated social media and email promotion.
</RadioItem>
</RadioGroup>
<span>No, we would do NOT want to take advantage of dedicated social media and email promotion.</span>
</label>
</div>
</label>
<button
type="submit"
class="btn variant-filled-primary m-2"
disabled={($ae_sess.mod.sponsorships.disable_submit__sponsorship_obj)}
on:click={() => {
console.log('*** Save marketing button clicked ***');
}}
>
<span class="fas fa-check mx-1"></span>
Save and continue
</button>
</form>
@@ -1377,8 +1480,8 @@ async function handle_update__sponsorship({
</div>
</div>
<div class="flex gap-4">
<span class="flex flex-col justify-between">
<div class="flex flex-wrap gap-4">
<span class="flex flex-col justify-between basis-2/5">
<h3 class="h4">Default color logo</h3>
<label for="file_logo_primary">
Upload a the standard default or primary version of your logo.
@@ -1406,7 +1509,7 @@ async function handle_update__sponsorship({
</label>
</span>
<span class="flex flex-col justify-between">
<span class="flex flex-col justify-between basis-2/5">
<h3 class="h4">Light logo for dark backgrounds (KO or Knockout)</h3>
<label for="file_logo_light">
Upload a light version of your logo for use with dark backgrounds. These are sometimes called knockout logos.
@@ -1434,7 +1537,7 @@ async function handle_update__sponsorship({
</label>
</span>
<span class="flex flex-col justify-between">
<span class="flex flex-col justify-between basis-2/5">
<h3 class="h4">Dark logo for light backgrounds</h3>
<label for="file_logo_dark">
Upload a dark version of your logo for use with light backgrounds. This may be the same as your default logo.
@@ -1551,28 +1654,89 @@ async function handle_update__sponsorship({
{/if}
</div>
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length && $slct.sponsorship_obj.guest_li_json[0].full_name}
{#if $slct.sponsorship_obj.guest_li_json.length >= $ae_loc.mod.sponsorships.level_guest_max_li[$slct.sponsorship_obj.level_num]}
<div class="variant-filled-warning">You have reached the maximum number of guests for your selected sponsorship level.</div>
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length >= $ae_loc.mod.sponsorships.level_guest_max_li[$slct.sponsorship_obj.level_num]}
<div class="variant-filled-warning"><span class="fas fa-lock mx-1"></span> Max! You have reached the maximum number of guests for your selected sponsorship level.</div>
<!-- <span class="fas fa-lock mx-1"></span> -->
{:else}
<!-- <div class="variant-filled-warning">Keep adding guests.</div> -->
<button
class="btn btn-sm variant-filled-secondary m-2"
on:click={() => {
console.log('*** Add guest button clicked ***');
// if (!confirm('Are you sure you want to add a guest?')) {return false;}
console.log($slct.sponsorship_obj.guest_li_json);
if (!$slct.sponsorship_obj.guest_li_json) {
$slct.sponsorship_obj.guest_li_json = [];
}
$slct.sponsorship_obj.guest_li_json.push({
given_name: null,
family_name: null,
// full_name: 'New Guest',
// email: null,
// phone_mobile: null,
// phone_office: null,
// city: null,
title: null,
affiliations: null,
ada: null,
dietary: null,
});
$slct = $slct;
// Scroll to the end of the page
// window.scrollTo({bottom: document.body.scrollHeight, behavior: 'smooth'});
// Set focus to new guest below
// document.getElementById(`guest_${$slct.sponsorship_obj.guest_li_json.length - 1}`).focus();
}}
>
<span class="fas fa-plus mx-1"></span>
Add New Guest
</button>
{/if}
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length}
<form
class="modal-form border border-surface-200 p-2 space-y-2 rounded-container-token"
on:submit|preventDefault={handle_submit_form}
>
<!-- {#each $slct.sponsorship_obj.guest_li_json.slice().reverse() as guest, index} -->
{#each $slct.sponsorship_obj.guest_li_json as guest, index}
<fieldset class="border border-gray-500/20 p-1">
<!-- class:variant-soft-error={!$slct.sponsorship_obj.guest_li_json[index].given_name} -->
<fieldset
id="guest_{index}"
class="border border-gray-500/20 p-1"
class:variant-soft-error={!guest.given_name}
>
<legend class="legend">
Guest #{index+1} -
{guest.full_name ?? `${guest.given_name} ${guest.family_name}`}
Guest #{index+1}
<!-- {$slct.sponsorship_obj.guest_li_json.length - index} -->
-
<!-- {guest.full_name ?? `${guest.given_name} ${guest.family_name}`} -->
{guest.given_name ?? '-- New Guest --'}
{guest.family_name ?? ''}
</legend>
<div class="flex flex-wrap gap-2 p-1">
<label for="guest_{index}_given_name" class="label max-w-64">
<!-- Given name -->
<input type="text" class="input text-xs" id="guest_{index}_given_name" name="guest_{index}_given_name" placeholder="First name" value={guest.given_name ?? ''} autocomplete="name">
<input
type="text"
class="input text-xs"
id="guest_{index}_given_name"
name="guest_{index}_given_name"
placeholder="First name"
value={guest.given_name ?? ''}
autocomplete="name"
required
class:variant-soft-error={!guest.given_name}
>
</label>
<label for="guest_{index}_family_name" class="label max-w-64">
<!-- Family name -->
@@ -1671,11 +1835,13 @@ async function handle_update__sponsorship({
console.log('*** Delete button clicked ***');
if (!confirm('Are you sure you want to delete this guest?')) {return false;}
// Remove the guest from the list based on the index.
$slct.sponsorship_obj.guest_li_json.splice(index, 1);
$slct = $slct;
// Now we are ready to submit the form
event.target.form.dispatchEvent(new Event('submit', {cancelable: true}));
// event.target.form.dispatchEvent(new Event('submit', {cancelable: true}));
}}
>
<span class="fas fa-minus mx-1"></span>
@@ -1692,44 +1858,11 @@ async function handle_update__sponsorship({
<!-- <div class="ae_warning">No guest list found!</div> -->
{/if}
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length >= $ae_loc.mod.sponsorships.level_guest_max_li[$slct.sponsorship_obj.level_num]}
<span class="fas fa-lock mx-1"></span>
Max guests reached
{:else}
<button
class="btn btn-sm variant-filled-secondary m-2"
on:click={() => {
console.log('*** Add guest button clicked ***');
// if (!confirm('Are you sure you want to add a guest?')) {return false;}
console.log($slct.sponsorship_obj.guest_li_json);
if (!$slct.sponsorship_obj.guest_li_json) {
$slct.sponsorship_obj.guest_li_json = [];
}
$slct.sponsorship_obj.guest_li_json.push({
given_name: null,
family_name: null,
full_name: 'New Guest',
email: null,
phone_mobile: null,
// phone_office: null,
city: null,
});
$slct = $slct;
}}
>
<span class="fas fa-plus mx-1"></span>
Add New Guest
</button>
{/if}
</section>
<!-- BEGING: Not currently used section -->
{:else if $store_current_tab === 'options'}
@@ -1738,7 +1871,6 @@ async function handle_update__sponsorship({
on:submit|preventDefault={handle_submit_form}
>
<fieldset class="sponsorship__more_questions">
<legend class="legend">More Questions</legend>
@@ -1779,6 +1911,7 @@ async function handle_update__sponsorship({
</button>
</form>
<!-- END: Not currently used section -->
{/if}