Lots of bug fixes. Lots of clean up. Things work more consitently.

This commit is contained in:
Scott Idem
2024-03-02 20:54:45 -05:00
parent 4db9e68543
commit 1b12cd4aec
4 changed files with 183 additions and 68 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts">
export let data;
console.log(`ae_ Svelte Sponsorships +page data:`, data);
// console.log(`ae_ Svelte Sponsorships +page data:`, data);
import { onMount } from 'svelte';
@@ -57,31 +57,21 @@ const modal_view__sponsorship_obj: ModalSettings = {
response: (r: boolean | undefined) => handle_modal_close(r)
};
// This should be merged with the ae_util.handle_url_and_message() function.
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response);
let location = window.location.href;
const url = new URL(location);
url.searchParams.delete('sponsorship_id');
history.pushState({}, '', url);
ae_util.handle_url_and_message('sponsorship_id', null);
// We do NOT want to keep these values if it is closed and not just switching from view to edit. A "smart" transition?
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;
}
let message = {'sponsorship_id': null};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
}
// // This should be moved under onMount(). Window may not exist yet.
// if ($slct_trigger == 'msg_parent' && $slct.sponsorship_cfg_id) {
// console.log(`Message parent with sponsorship_cfg_id ${$slct.sponsorship_cfg_id}`);
// $slct_trigger = null
// let message = {'sponsorship_cfg_id': $slct.sponsorship_cfg_id};
// window.parent.postMessage(message, "*");
// // console.log('Message sent to parent (iframe):', message);
// }
$ae_loc.hostname = data.url.hostname;
$ae_loc.site_domain = data.url.origin;

View File

@@ -731,6 +731,27 @@ async function handle_update__sponsorship({
<span class="fas fa-copy mx-1"></span>
Copy link for {$slct.sponsorship_id}
</button>
<button
class="btn variant-filled-warning mx-1"
on:click={() => {
if (!confirm(`Are you sure you want to send this email to ${$slct.sponsorship_obj.poc_json.email}?`)) {return false;}
api.send_email({
api_cfg: $ae_api,
from_email: 'scott.idem+from@oneskyit.com',
from_name: 'Scott Idem',
to_email: $slct.sponsorship_obj.poc_json.email,
subject: `Sponsorship Link for ${$slct.sponsorship_obj.name} (ID: ${$slct.sponsorship_id})`,
body_html: `<p>Sponsorship ID: ${$slct.sponsorship_id}</p><p>Copy and paste link: <a href="${$ae_loc.mod.sponsorships.link}">${$ae_loc.mod.sponsorships.link}</a></p>`,
});
}}
>
<span class="fas fa-paper-plane mx-1
"></span>
Send Email
</button>
</div>
{/if}
@@ -1382,34 +1403,58 @@ async function handle_update__sponsorship({
<p>Booth specifications: Exhibit space is six feet wide by 3 feet deep. 10-feet-wide booth backdrops are not allowed. Banner signage or pop-up stands must fit behind the table in the 6-feet-wide space or on top of the table. Your space will include a six-foot skirted table and 2 chairs.</p>
</div>
<div>
<label for="q_table_exhibit" class="label">
Would you like a table top exhibit at CHOW?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit} name="q_table_exhibit" value={1}>
<span class="fas fa-check"></span>
Yes, we would like to exhibit.
</RadioItem>
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit} name="q_table_exhibit" value={0} required>
<span class="fas fa-times"></span>
No, we will NOT exhibit.
</RadioItem>
</RadioGroup>
<div class="space-y-2">
Would you like a table top exhibit at CHOW?
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_table_exhibit"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit}
/>
<span class="fas fa-check"></span>
<span>Yes, we would like to exhibit.</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_table_exhibit"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit}
/>
<span class="fas fa-times"></span>
<span>No, we will NOT exhibit.</span>
</label>
</div>
<div>
<label for="q_table_power" class="label">
Do you require power for your table top booth?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_power} name="q_table_power" value={1}>
<span class="fas fa-check"></span>
Yes, we require power.
</RadioItem>
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_power} name="q_table_power" value={0}>
<span class="fas fa-times"></span>
No, we do not require power.
</RadioItem>
</RadioGroup>
<div class="space-y-2">
Do you require power for your table top booth?
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_table_power"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.table_power}
/>
<span class="fas fa-check"></span>
<span>Yes, we require power.</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_table_power"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.table_power}
/>
<span class="fas fa-times"></span>
<span>No, we do not require power.</span>
</label>
</div>
@@ -1447,8 +1492,35 @@ async function handle_update__sponsorship({
<p>If you select "Yes", our CHOW Manager, TBD will review your selection and be in touch with more details. Once confirmed, a draft session form must be submitted by TBD DATE and a final session form must be submitted no later than TBD DATE.</p>
</div>
<div>Are you interested in hosting a CHOW virtual session?</div>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_virtual_session"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.virtual_session}
/>
<span class="fas fa-check"></span>
<span>Yes, we are interested in hosting a virtual session.</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_virtual_session"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.virtual_session}
/>
<span class="fas fa-times"></span>
<span>No, we are NOT interested in hosting a virtual session.</span>
</label>
</div>
</fieldset>
<div>
<!-- <div>
<label for="q_virtual_session" class="label">
Are you interested in hosting a CHOW virtual session?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
@@ -1463,7 +1535,7 @@ async function handle_update__sponsorship({
</RadioGroup>
</label>
</div>
</fieldset>
</fieldset> -->
<fieldset
class="mb-8"
@@ -1476,8 +1548,35 @@ async function handle_update__sponsorship({
<p>If you select "Yes", our CHOW Manager, TBD will review your selection and be in touch with more details.</p>
</div>
<div>Are you interested in hosting a CHOW plenary session?</div>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_plenary_session"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.plenary_session}
/>
<span class="fas fa-check"></span>
<span>Yes, we are interested in hosting a plenary session.</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_plenary_session"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.plenary_session}
/>
<span class="fas fa-times"></span>
<span>No, we are NOT interested in hosting a plenary session.</span>
</label>
</div>
<div>
<!-- <div>
<label for="q_plenary_session" class="label">
Are you interested in hosting a CHOW plenary session?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
@@ -1491,14 +1590,48 @@ async function handle_update__sponsorship({
</RadioItem>
</RadioGroup>
</label>
</div>
</div> -->
<div>
<div class="text-sm space-y-4">
<p>As a Plenary Session Sponsor, you will have the opportunity to provide opening remarks during a CHOW plenary session. Opening remarks are typically between 3-5 minutes. Please contact TBD to confirm your plenary session and discuss logistics.</p>
<p class="text-sm">If you select "Yes", our CHOW Manager, TBD will review your selection and be in touch with more details.</p>
</div>
<label for="q_plenary_opening" class="label">
<div>Are you interested in hosting the CHOW 2024 Opening Plenary Session?</div>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
checked
name="q_plenary_opening"
value={1}
bind:group={$slct.sponsorship_obj.questions_li_json.plenary_opening}
/>
<span class="fas fa-check"></span>
<span>Yes, we are interested in opening remarks.</span>
</label>
<label class="flex items-center space-x-2">
<input
class="radio"
type="radio"
name="q_plenary_opening"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.plenary_opening}
/>
<span class="fas fa-times"></span>
<span>No, we are NOT interested in opening remarks.</span>
</label>
</div>
</div>
<!-- <label for="q_plenary_opening" class="label">
Are you interested in hosting the CHOW 2024 Opening Plenary Session?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.plenary_opening} name="q_plenary_opening" value={1}>
@@ -1511,7 +1644,7 @@ async function handle_update__sponsorship({
</RadioItem>
</RadioGroup>
</label>
</div>
</div> -->
</fieldset>
<button

View File

@@ -142,7 +142,7 @@ onMount(() => {
</div>
<footer class="{parent.regionFooter}">
{#if $ae_loc.trusted_access || $slct.sponsorship_obj.external_person_id === $ae_loc.novi_uuid || $slct.sponsorship_obj.contact_1_email === $ae_loc.novi_email}
{#if $ae_loc.trusted_access}
<div class="ae_options mx-1">
<button
class="btn variant-filled-warning mx-1"
@@ -167,8 +167,8 @@ onMount(() => {
<button
on:click={() => {
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
$ae_loc.mod.sponsorships.show_edit__sponsorship_obj = true;
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
parent.onClose();
$slct_trigger = 'show_edit__sponsorship_obj';
}}

View File

@@ -36,19 +36,15 @@ const modal_edit__sponsorship_obj: ModalSettings = {
response: (r: boolean | undefined) => handle_modal_close(r)
};
// This should be merged with the ae_util.handle_url_and_message() function.
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response);
let location = window.location.href;
const url = new URL(location);
url.searchParams.delete('sponsorship_id');
history.pushState({}, '', url);
ae_util.handle_url_and_message('sponsorship_id', null);
let message = {'sponsorship_id': null};
window.parent.postMessage(message, "*");
// console.log('Message sent to parent (iframe):', message);
// We want to keep these values in case they want to re-open the modal. Do NOT clear.
// $slct.sponsorship_id = null;
// $slct.sponsorship_obj = null;
}
if ($slct_trigger == 'msg_parent' && $slct.sponsorship_cfg_id) {
@@ -80,16 +76,12 @@ onMount(() => {
$ae_loc.href_url = url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
$slct_trigger = null;
ae_util.handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
if ($slct.sponsorship_id) {
console.log(`Got an ID. Let's show the modal!`);
// handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
modalStore.trigger(modal_edit__sponsorship_obj);
} else {
// handle_url_and_message('sponsorship_id', null);
console.log(`No ID. Nothing to show.`);
}
});
// console.log(`$ae_loc = `, $ae_loc);