diff --git a/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte b/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte index b00f8b63..aa9c65cf 100644 --- a/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte +++ b/src/routes/sponsorships/10_edit_modal__sponsorship_obj.svelte @@ -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 + {#if $slct.sponsorship_obj.level_num > 1} Exhibitor Info + {/if} Session Info @@ -819,7 +865,7 @@ async function handle_update__sponsorship({ - + @@ -1148,48 +1194,105 @@ async function handle_update__sponsorship({ Public Recognition Would you like public reognition at CHOW? - - + + + - Yes, please recognize me publicly as a CHOW sponsor (logo/name on website). - - + Yes, please recognize me publicly as a CHOW sponsor (logo/name on website). + + + - No, I wish to remain an anonymous sponsor. Please DO NOT recognize me publicly. - - + No, I wish to remain an anonymous sponsor. Please DO NOT recognize me publicly. + + Social Media & Email Inclusion Would you like social and email inclusion at CHOW? - - + + + - Yes, we would like to be included in general CHOW social media and email communications. - - + Yes, we would like to be included in general CHOW social media and email communications. + + + - No, we would NOT like to be included in general CHOW social media and email communications. - - + No, we would NOT like to be included in general CHOW social media and email communications. + + Dedicated Social Promos Would you like dedicated social media promotions at CHOW? - - + + + - Yes, we would like to take advantage of dedicated social media and email promotion. - - + Yes, we would like to take advantage of dedicated social media and email promotion. + + + - No, we would do NOT want to take advantage of dedicated social media and email promotion. - - + No, we would do NOT want to take advantage of dedicated social media and email promotion. + + + { + console.log('*** Save marketing button clicked ***'); + }} + > + + Save and continue + + @@ -1377,8 +1480,8 @@ async function handle_update__sponsorship({ - - + + Default color logo Upload a the standard default or primary version of your logo. @@ -1406,7 +1509,7 @@ async function handle_update__sponsorship({ - + Light logo for dark backgrounds (KO or Knockout) 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({ - + Dark logo for light backgrounds 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} - {#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]} - You have reached the maximum number of guests for your selected sponsorship level. + {#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]} + Max! You have reached the maximum number of guests for your selected sponsorship level. + {:else} - + + { + 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(); + }} + > + + Add New Guest + {/if} + {#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length} + + {#each $slct.sponsorship_obj.guest_li_json as guest, index} - + + + - Guest #{index+1} - - {guest.full_name ?? `${guest.given_name} ${guest.family_name}`} + Guest #{index+1} + + - + + {guest.given_name ?? '-- New Guest --'} + {guest.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})); }} > @@ -1692,44 +1858,11 @@ async function handle_update__sponsorship({ {/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]} - - Max guests reached - {:else} - - { - 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; - }} - > - - Add New Guest - - {/if} - + + {:else if $store_current_tab === 'options'} @@ -1738,7 +1871,6 @@ async function handle_update__sponsorship({ on:submit|preventDefault={handle_submit_form} > - More Questions @@ -1779,6 +1911,7 @@ async function handle_update__sponsorship({ + {/if}