Will now pull in agreements and accommations questions

This commit is contained in:
Scott Idem
2024-02-28 21:17:09 -05:00
parent 713fcb3c62
commit 2c7e7ca027
7 changed files with 209 additions and 34 deletions

View File

@@ -1,3 +1,44 @@
# One Sky IT's SvelteKit Template
# Current Modules
## AE Events - Speakers (/events_speakers)
### Components
* +page.svelte - The main page for the Events - Speakers module
* 10_edit_modal__event_presenter_obj.svelte - The modal for editing a presenter
* 10_list__event_presenter_obj.svelte - The list of presenters/speakers
* 10_view_modal__event_presenter_obj.svelte - The modal for viewing a presenter
#### [slug]
* +page.svelte - The main page for the presenter ID [slug]
## AE Sponsorships (/sponsorships)
* +page.svelte - The main page for the Sponsorships module
* 10_edit_modal__sponsorship_obj.svelte - The modal for editing a sponsorship
* 10_list__sponsorship_obj.svelte - The list of sponsorships
* 10_view_modal__sponsorship_obj.svelte - The modal for viewing a sponsorship
#### [slug]
* +page.svelte - The main page for the sponsorship ID [slug]
# Future Modules
## AE Events - Badges (/events_badges)
* +page.svelte - The main page for the Events - Badges module
* 10_list__event_badge_obj.svelte - The list of badges
* 10_view_modal__event_badge_obj.svelte - The modal for viewing a badge
## AE Events - Exhibit Leads (/events_exhibit_leads)
## AE Events - Presentation Management (/events_pres_mgmt)
# Set up and run
## Build
## Environment file
# create-svelte
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).

View File

@@ -117,7 +117,7 @@ export async function load({ params, url }) { // route
.then(function (ds_hub_site_header_results) {
if (ds_hub_site_header_results) {
console.log(`ae_ ds_hub_site_header_results = `, ds_hub_site_header_results);
// console.log(`ae_ ds_hub_site_header_results = `, ds_hub_site_header_results);
// let ae_loc_tmp = get(ae_loc);
ds_code_li[ds_code] = ds_hub_site_header_results;
@@ -152,7 +152,7 @@ export async function load({ params, url }) { // route
await handle_get_data_store_obj_w_code({code: ds_code})
.then(function (ds_code_results) {
if (ds_code_results) {
console.log(`ae_ hub__site__root_page_content = `, ds_code_results);
// console.log(`ae_ hub__site__root_page_content = `, ds_code_results);
// let ae_loc_tmp = get(ae_loc);
ds_code_li[ds_code] = ds_code_results;

View File

@@ -44,7 +44,8 @@ onMount(() => {
console.log('** Component Mounted: ** View Modal - Presenter Obj');
if ($slct.event_presenter_id && $ae_loc.href_url) {
$ae_loc.mod.events.presenter_link = `${$ae_loc.href_url}/load?ae_id=${$slct.event_presenter_id}`;
// $ae_loc.mod.events.presenter_link = `${$ae_loc.href_url}/load?ae_id=${$slct.event_presenter_id}`;
$ae_loc.mod.events.presenter_link = `${$ae_loc.site_domain}/events_speakers/load?ae_id=${$slct.event_presenter_id}`;
console.log('Speaker link:', $ae_loc.mod.events.presenter_link);
}
});
@@ -473,7 +474,7 @@ async function handle_update__event_presenter({
</header>
{#if $ae_loc.mod.events.presenter_link}
{#if $slct.event_presenter_id && $ae_loc.mod.events.presenter_link}
<div class="flex justify-end">
<button
class="btn variant-soft-secondary"

View File

@@ -0,0 +1 @@

View File

@@ -1,9 +1,25 @@
/** @type {import('./$types').LayoutLoad} */
import { get } from 'svelte/store';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import type { key_val } from '$lib/ae_stores';
export function load({ params, url }) { // route
// console.log(`Svelte Sponsorships layout.ts data = params:`, params);
// console.log(`Svelte Sponsorships layout.ts data = route:`, route);
// console.log(`Svelte Sponsorships layout.ts data = url:`, url);
let ae_loc_tmp = get(ae_loc);
console.log(`ae_loc = `, ae_loc_tmp);
let ds_code_li: null|key_val = ae_loc_tmp.ds;
console.log(`ae_ ds_code_li = `, ds_code_li);
let ds_code: null|string = null;
let ds_type: null|string = null;
let data_struct = {
params: params,
sections: [
@@ -14,5 +30,46 @@ export function load({ params, url }) { // route
url: url,
};
let loading_results = null;
ds_code = 'sponsorships__agree_li';
ds_type = 'json';
// loading_results = api.get_data_store_obj_w_code({
// api_cfg: get(ae_api),
// data_store_code: ds_code,
// data_type: ds_type,
// log_lvl: 2
// })
// .then( function (ds_results) {
// console.log(`ae_ Data Store ${ds_code} = `, ds_results);
// if (ds_results) {
// console.log(`ae_ Data Store ${ds_code} = `, ds_results);
// // let ae_loc_tmp = get(ae_loc);
// if (ds_type == 'json') {
// ds_code_li[ds_code] = ds_results.json;
// } else {
// ds_code_li[ds_code] = ds_results.text;
// }
// // ae_loc.set(ae_loc_tmp);
// // console.log(`ae_loc = `, get(ae_loc));
// }
// })
// .finally(function () {
// console.log(`ae_ ds_code_li = `, ds_code_li);
// ae_loc_tmp = {
// ...ae_loc_tmp,
// 'ds': ds_code_li,
// }
// console.log(`ae_loc_tmp = `, ae_loc_tmp);
// ae_loc.set(ae_loc_tmp);
// console.log(`ae_loc = `, get(ae_loc));
// return true;
// });
return data_struct;
}

View File

@@ -49,6 +49,33 @@ onMount(() => {
$ae_loc.mod.sponsorships.link = `${$ae_loc.site_domain}/sponsorships/load?sponsorship_id=${$slct.sponsorship_id}`;
console.log('Sponsorship link:', $ae_loc.mod.sponsorships.link);
}
let ds_code: null|string = 'sponsorships__agree_li';
let ds_type: null|string = 'json';
let loading_results = api.get_data_store_obj_w_code({
api_cfg: $ae_api,
data_store_code: ds_code,
data_type: ds_type,
log_lvl: 2
})
.then( function (ds_results) {
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
if (ds_results) {
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
// let ae_loc_tmp = get(ae_loc);
if (ds_type == 'json') {
$ae_loc.ds[ds_code] = ds_results.json;
} else {
$ae_loc.ds[ds_code] = ds_results.text;
}
// $ae_loc = $ae_loc;
}
})
.finally(function () {
// console.log(`ae_loc = `, get(ae_loc));
return true;
});
});
// We've created a custom submit function to pass the response and close the modal.
@@ -85,6 +112,7 @@ if ($slct.sponsorship_id) {
// $ae_loc.mod.sponsorships.link = `${$ae_loc.href_url}/load?ae_id=${$slct.sponsorship_id}`;
// console.log('Sponsorship link:', $ae_loc.mod.sponsorships.link);
} else {
$store_current_tab = 'start';
$slct.sponsorship_id = null;
$slct.sponsorship_obj = {
sponsorship_cfg_id_random: $ae_loc.mod.sponsorships.cfg_id,
@@ -158,6 +186,30 @@ async function handle_submit_form(event) {
};
}
// Loop through possible additional contact list (up to 5) and add to the contact_li_json array.
let temp_contact_li = [];
for (let i = 0; i < 20; i++) {
if (sponsorship_di[`contact_${i}_full_name`] || sponsorship_di[`contact_${i}_given_name`]) {
// let contact_x_full_name = sponsorship_di[`contact_${i}_given_name`] + ' ' + sponsorship_di[`contact_${i}_family_name`];
temp_contact_li.push({
given_name: sponsorship_di[`contact_${i}_given_name`],
family_name: sponsorship_di[`contact_${i}_family_name`],
full_name: sponsorship_di[`contact_${i}_full_name`],
email: sponsorship_di[`contact_${i}_email`],
phone: sponsorship_di[`contact_${i}_phone`],
phone_mobile: sponsorship_di[`contact_${i}_phone_mobile`],
phone_home: sponsorship_di[`contact_${i}_phone_home`],
phone_office: sponsorship_di[`contact_${i}_phone_office`],
city: sponsorship_di[`contact_${i}_city`],
other_text: sponsorship_di[`contact_${i}_other_text`],
});
}
}
if (temp_contact_li.length) {
sponsorship_do['contact_li_json'] = temp_contact_li;
}
if (sponsorship_di.organization_name) {
// Using the organization_name field to store the name of the sponsorship.
sponsorship_do['name'] = sponsorship_di.organization_name;
@@ -491,7 +543,7 @@ async function handle_update__sponsorship({
</header>
{#if $ae_loc.mod.sponsorships.link}
{#if $slct.sponsorship_id && $ae_loc.mod.sponsorships.link}
<div class="flex justify-end">
<button
class="btn variant-soft-secondary"
@@ -517,15 +569,15 @@ async function handle_update__sponsorship({
<svelte:fragment slot="lead"><span class="fas fa-home"></span></svelte:fragment>
<span>Start</span>
</Tab>
<Tab bind:group={$store_current_tab} name="tab_files" value={'files'} disabled={!$slct.sponsorship_obj.sponsorship_id_random}>
<Tab bind:group={$store_current_tab} name="tab_files" value={'files'} disabled={!$slct.sponsorship_id}>
<svelte:fragment slot="lead"><span class="fas fa-file-upload"></span></svelte:fragment>
Files
</Tab>
<Tab bind:group={$store_current_tab} name="tab_gala_guests" value={'gala_guests'} disabled={!$slct.sponsorship_obj.sponsorship_id_random}>
<Tab bind:group={$store_current_tab} name="tab_gala_guests" value={'gala_guests'} disabled={!$slct.sponsorship_id}>
<svelte:fragment slot="lead"><span class="fas fa-users"></span></svelte:fragment>
Gala Guests
</Tab>
<Tab bind:group={$store_current_tab} name="tab_options" value={'options'} disabled={!$slct.sponsorship_obj.sponsorship_id_random}>
<Tab bind:group={$store_current_tab} name="tab_options" value={'options'} disabled={!$slct.sponsorship_id}>
<svelte:fragment slot="lead"><span class="fas fa-info"></span></svelte:fragment>
More
</Tab>
@@ -824,21 +876,13 @@ async function handle_update__sponsorship({
<span class="fas fa-times-circle"></span>
<span class="ae_value">Not yet marked as paid</span>
{/if}
<!-- <input name="level_num" value={$slct.sponsorship_obj.level_num} /> -->
<!-- <select name="level_num" class="select">
<option value=1 selected={($slct.sponsorship_obj.level_num == 1 ? 'selected' : '')}>The Lowest Level Sponsorship ($5,000)</option>
<option value=2 selected={($slct.sponsorship_obj.level_num == 2 ? 'selected' : '')}>Mid-level Sponsor ($7,500)</option>
<option value=3 selected={($slct.sponsorship_obj.level_num == 3 ? 'selected' : '')}>High Level Sponsor ($15,000)</option>
</select> -->
<!-- <ul>
<li><strong>Lowest Level</strong> - Thank you?</li>
<li><strong>Mid-level</strong> - Please join the gala along with 5 guests.</li>
<li><strong>High Level</strong> - Please join the gala along with 10 guests. You will also be able to upload a promo video that will play at the end of the gala.</li>
</ul> -->
</div>
<label for="amount">Amount?
<label
class:hidden={$ae_loc.trusted_access}
for="amount"
>
Amount?
<div class="input-group grid-cols-[auto_1fr_auto]">
<div class="input-group-shim">
<span>$</span>
@@ -852,7 +896,6 @@ async function handle_update__sponsorship({
value={$slct.sponsorship_obj.amount ? $slct.sponsorship_obj.amount/100 : ''}
autocomplete="off"
readonly={$slct.sponsorship_obj.paid}
required
>
</div>
</label>
@@ -861,6 +904,11 @@ async function handle_update__sponsorship({
<fieldset class="mb-8">
<legend class="legend">Agreements & Accommodations</legend>
<!-- {#if $ae_loc.ds['sponsorships__agree_li']}
{$ae_loc.ds['sponsorships__agree_li'][0].code}
{$ae_loc.ds['sponsorships__agree_li'][1].code}
{/if} -->
<label for="waiver" class="label">
<input
type="checkbox"

View File

@@ -1,13 +1,10 @@
/** @type {import('./$types').LayoutLoad} */
import { get } from 'svelte/store';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { get } from 'svelte/store';
type key_val = {
[key: string]: any; // variable key
// name: string;
};
import type { key_val } from '$lib/ae_stores';
async function handle_get_data_store_obj_w_code({ code=null, data_type='text' }) {
@@ -61,6 +58,7 @@ export async function load({ params, url }) { // route
let ds_code_li: null|key_val = ae_loc_tmp.ds;
console.log(`ae_ ds_code_li = `, ds_code_li);
let ds_code: null|string = null;
let ds_type: null|string = null;
let data_struct = {
@@ -78,13 +76,43 @@ export async function load({ params, url }) { // route
let loading_results = null;
ds_code = 'hub__page__sponsorships__create_info';
loading_results = await handle_get_data_store_obj_w_code({ code: ds_code })
.then( function (ds_hub_page_sponsorships_create_info_results) {
if (ds_hub_page_sponsorships_create_info_results) {
console.log(`ae_ hub__page__sponsorships__create_info = `, ds_hub_page_sponsorships_create_info_results);
ds_type = 'text';
// loading_results = await handle_get_data_store_obj_w_code({ code: ds_code })
// .then( function (ds_hub_page_sponsorships_create_info_results) {
// if (ds_hub_page_sponsorships_create_info_results) {
// console.log(`ae_ hub__page__sponsorships__create_info = `, ds_hub_page_sponsorships_create_info_results);
// // let ae_loc_tmp = get(ae_loc);
// ds_code_li[ds_code] = ds_hub_page_sponsorships_create_info_results;
// // ae_loc.set(ae_loc_tmp);
// // console.log(`ae_loc = `, get(ae_loc));
// }
// })
// .finally(function () {
// console.log(`ae_ ds_code_li = `, ds_code_li);
// ae_loc_tmp = {
// ...ae_loc_tmp,
// 'ds': ds_code_li,
// }
// console.log(`ae_loc_tmp = `, ae_loc_tmp);
// ae_loc.set(ae_loc_tmp);
// console.log(`ae_loc = `, get(ae_loc));
// });
loading_results = await api.get_data_store_obj_w_code({
api_cfg: get(ae_api),
data_store_code: ds_code,
data_type: ds_type,
log_lvl: 0
})
.then( function (ds_results) {
if (ds_results) {
console.log(`ae_ Data Store ${ds_code} = `, ds_results);
// let ae_loc_tmp = get(ae_loc);
ds_code_li[ds_code] = ds_hub_page_sponsorships_create_info_results;
ds_code_li[ds_code] = ds_results.text;
// ae_loc.set(ae_loc_tmp);
// console.log(`ae_loc = `, get(ae_loc));
@@ -102,6 +130,5 @@ export async function load({ params, url }) { // route
console.log(`ae_loc = `, get(ae_loc));
});
return data_struct;
}