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"> <script lang="ts">
export let data; export let data;
console.log(`ae_ Svelte Sponsorships +page data:`, data); // console.log(`ae_ Svelte Sponsorships +page data:`, data);
import { onMount } from 'svelte'; import { onMount } from 'svelte';
@@ -57,31 +57,21 @@ const modal_view__sponsorship_obj: ModalSettings = {
response: (r: boolean | undefined) => handle_modal_close(r) response: (r: boolean | undefined) => handle_modal_close(r)
}; };
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
// This should be merged with the ae_util.handle_url_and_message() function.
function handle_modal_close(response: boolean | undefined) { function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response); console.log('Modal closed. Response:', response);
let location = window.location.href; ae_util.handle_url_and_message('sponsorship_id', null);
const url = new URL(location);
url.searchParams.delete('sponsorship_id'); // We do NOT want to keep these values if it is closed and not just switching from view to edit. A "smart" transition?
history.pushState({}, '', url); 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.hostname = data.url.hostname;
$ae_loc.site_domain = data.url.origin; $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> <span class="fas fa-copy mx-1"></span>
Copy link for {$slct.sponsorship_id} Copy link for {$slct.sponsorship_id}
</button> </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> </div>
{/if} {/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> <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>
<div>
<label for="q_table_exhibit" class="label"> <div class="space-y-2">
Would you like a table top exhibit at CHOW?<br /> Would you like a table top exhibit at CHOW?
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col"> <label class="flex items-center space-x-2">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit} name="q_table_exhibit" value={1}> <input
<span class="fas fa-check"></span> class="radio"
Yes, we would like to exhibit. type="radio"
</RadioItem> name="q_table_exhibit"
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit} name="q_table_exhibit" value={0} required> value={1}
<span class="fas fa-times"></span> bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit}
No, we will NOT exhibit. />
</RadioItem> <span class="fas fa-check"></span>
</RadioGroup> <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> </label>
</div> </div>
<div>
<label for="q_table_power" class="label"> <div class="space-y-2">
Do you require power for your table top booth?<br /> Do you require power for your table top booth?
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col"> <label class="flex items-center space-x-2">
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_power} name="q_table_power" value={1}> <input
<span class="fas fa-check"></span> class="radio"
Yes, we require power. type="radio"
</RadioItem> name="q_table_power"
<RadioItem bind:group={$slct.sponsorship_obj.questions_li_json.table_power} name="q_table_power" value={0}> value={1}
<span class="fas fa-times"></span> bind:group={$slct.sponsorship_obj.questions_li_json.table_power}
No, we do not require power. />
</RadioItem> <span class="fas fa-check"></span>
</RadioGroup> <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> </label>
</div> </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> <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>
<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"> <label for="q_virtual_session" class="label">
Are you interested in hosting a CHOW virtual session?<br /> Are you interested in hosting a CHOW virtual session?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col"> <RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
@@ -1463,7 +1535,7 @@ async function handle_update__sponsorship({
</RadioGroup> </RadioGroup>
</label> </label>
</div> </div>
</fieldset> </fieldset> -->
<fieldset <fieldset
class="mb-8" 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> <p>If you select "Yes", our CHOW Manager, TBD will review your selection and be in touch with more details.</p>
</div> </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"> <label for="q_plenary_session" class="label">
Are you interested in hosting a CHOW plenary session?<br /> Are you interested in hosting a CHOW plenary session?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col"> <RadioGroup rounded="rounded-container-token" flexDirection="flex-col">
@@ -1491,14 +1590,48 @@ async function handle_update__sponsorship({
</RadioItem> </RadioItem>
</RadioGroup> </RadioGroup>
</label> </label>
</div> </div> -->
<div> <div>
<div class="text-sm space-y-4"> <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>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> <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> </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 /> Are you interested in hosting the CHOW 2024 Opening Plenary Session?<br />
<RadioGroup rounded="rounded-container-token" flexDirection="flex-col"> <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}> <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> </RadioItem>
</RadioGroup> </RadioGroup>
</label> </label>
</div> </div> -->
</fieldset> </fieldset>
<button <button

View File

@@ -142,7 +142,7 @@ onMount(() => {
</div> </div>
<footer class="{parent.regionFooter}"> <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"> <div class="ae_options mx-1">
<button <button
class="btn variant-filled-warning mx-1" class="btn variant-filled-warning mx-1"
@@ -167,8 +167,8 @@ onMount(() => {
<button <button
on:click={() => { 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_edit__sponsorship_obj = true;
$ae_loc.mod.sponsorships.show_view__sponsorship_obj = false;
parent.onClose(); parent.onClose();
$slct_trigger = 'show_edit__sponsorship_obj'; $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) response: (r: boolean | undefined) => handle_modal_close(r)
}; };
// This function waits for the response from one of the modals. Do stuff when the modal is closed.
// This should be merged with the ae_util.handle_url_and_message() function.
function handle_modal_close(response: boolean | undefined) { function handle_modal_close(response: boolean | undefined) {
console.log('Modal closed. Response:', response); console.log('Modal closed. Response:', response);
let location = window.location.href; ae_util.handle_url_and_message('sponsorship_id', null);
const url = new URL(location);
url.searchParams.delete('sponsorship_id');
history.pushState({}, '', url);
let message = {'sponsorship_id': null}; // We want to keep these values in case they want to re-open the modal. Do NOT clear.
window.parent.postMessage(message, "*"); // $slct.sponsorship_id = null;
// console.log('Message sent to parent (iframe):', message); // $slct.sponsorship_obj = null;
} }
if ($slct_trigger == 'msg_parent' && $slct.sponsorship_cfg_id) { if ($slct_trigger == 'msg_parent' && $slct.sponsorship_cfg_id) {
@@ -80,16 +76,12 @@ onMount(() => {
$ae_loc.href_url = url; $ae_loc.href_url = url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_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); ae_util.handle_url_and_message('sponsorship_id', $slct.sponsorship_id);
if ($slct.sponsorship_id) { if ($slct.sponsorship_id) {
console.log(`Got an ID. Let's show the modal!`); 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); modalStore.trigger(modal_edit__sponsorship_obj);
} else { } else {
// handle_url_and_message('sponsorship_id', null); console.log(`No ID. Nothing to show.`);
} }
}); });
// console.log(`$ae_loc = `, $ae_loc); // console.log(`$ae_loc = `, $ae_loc);