Clean up for CHOW...

This commit is contained in:
Scott Idem
2024-03-07 11:28:30 -05:00
parent b020ded01c
commit c6abc0abca
2 changed files with 86 additions and 35 deletions

View File

@@ -230,15 +230,16 @@ $: if ($events_trigger == 'load__event_badge_obj_li' && $events_slct.event_id) {
$events_trigger = null;
load_obj_li_results = handle_load_ae_obj_li__badge({event_id: $events_slct.event_id, try_cache: false})
.then(function (load_obj_li_results) {
if (load_obj_li_results) {
console.log(`load_obj_li_results=`, load_obj_li_results);
.then(function (load_results) {
if (load_results) {
console.log(`load_results=`, load_results);
} else {
console.log('No results returned.');
}
// return load_obj_li_results;
console.log(`load_obj_li_results=`, load_obj_li_results);
$events_slct.badge_obj_li = load_obj_li_results;
// return load_results;
console.log(`load_results=`, load_results);
$events_slct.badge_obj_li = load_results;
return load_results;
});
}
@@ -341,12 +342,12 @@ async function handle_load_ae_obj_li__badge({event_id, try_cache=true}) {
</button>
{#await load_obj_li_results}
<div class="modal-loading">
<span class="modal-loading">
<span class="fas fa-spinner fa-spin"></span>
<span class="loading-text">
Loading...
</span>
</div>
</span>
{:then load_obj_li_results}
{#if load_obj_li_results}
<span class="fas fa-check text-green-500"></span>

View File

@@ -40,6 +40,13 @@ import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import type { key_val } from '$lib/ae_stores';
if ($slct.sponsorship_id) {
console.log(`Sponsorship ID selected: ${$slct.sponsorship_id}`);
console.log(`Sponsorship object selected:`, $slct.sponsorship_obj);
$slct_trigger = 'load__sponsorship_obj';
}
onMount(() => {
console.log('** Component Mounted: ** View Modal - Sponsorship Obj');
@@ -254,7 +261,9 @@ async function handle_submit_form(event) {
temp_address.mailing['country'] = sponsorship_di.address_country;
}
sponsorship_do['address_li_json'] = temp_address;
if (temp_address.mailing && Object.keys(temp_address.mailing).length) {
sponsorship_do['address_li_json'] = temp_address;
}
if (sponsorship_di.poc_full_name || sponsorship_di.poc_email) {
sponsorship_do['poc_json'] = {
@@ -464,6 +473,7 @@ async function handle_submit_form(event) {
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
$ae_sess.mod.sponsorships.submit_status = 'created';
$slct_trigger = 'load__sponsorship_obj';
} else {
ae_promises.update__sponsorship_obj = await handle_update__sponsorship({
obj_type: 'sponsorship',
@@ -472,18 +482,38 @@ async function handle_submit_form(event) {
});
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
$ae_sess.mod.sponsorships.submit_status = 'updated';
$slct_trigger = 'load__sponsorship_obj';
}
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';
if ($slct.sponsorship_id) {
console.log(`Moving on to next section for ID: ${$slct.sponsorship_id}`);
if ($store_current_tab == 'start' && $slct.sponsorship_id) {
$store_current_tab = 'marketing';
// If level is above 1 then they can go to the exhibits tab.
} else if ($store_current_tab == 'marketing' && $slct.sponsorship_id && $slct.sponsorship_obj.level_num > 1) {
$store_current_tab = 'exhibit';
} else if ($store_current_tab == 'marketing' && $slct.sponsorship_id && $slct.sponsorship_obj.level_num == 1) {
$store_current_tab = 'files';
// If level is above 2 then they can go to the sessions tab.
} else if ($store_current_tab == 'exhibit' && $slct.sponsorship_id && $slct.sponsorship_obj.level_num > 2) {
$store_current_tab = 'sessions';
} else if ($store_current_tab == 'exhibit' && $slct.sponsorship_id && $slct.sponsorship_obj.level_num <= 2) {
$store_current_tab = 'files';
} else if ($store_current_tab == 'sessions') {
$store_current_tab = 'files';
} else if ($store_current_tab == 'files') {
$store_current_tab = 'guests';
}
} else {
console.log('No obj ID found!');
}
}
@@ -568,7 +598,7 @@ async function handle_submit_form_files(event) {
}
// Promo video file (30 seconds or less)
if (event.target.file_media_promo_video.files.length > 0) {
if (typeof event.target.file_media_promo_video !== 'undefined' && event.target.file_media_promo_video.files.length > 0) {
console.log('The promo video file was found.');
hosted_file_results = await handle_input_upload_files(event.target.file_media_promo_video.files);
@@ -594,6 +624,10 @@ async function handle_submit_form_files(event) {
});
$ae_sess.mod.sponsorships.disable_submit__sponsorship_obj = false;
$ae_sess.mod.sponsorships.submit_status = 'updated';
if ($store_current_tab == 'files') {
$store_current_tab = 'guests';
}
}
@@ -672,12 +706,15 @@ async function handle_update__sponsorship({
obj_id: obj_id,
fields: data,
key: $ae_api.api_crud_super_key,
return_obj: true,
log_lvl: 2
})
.then(async function (update__obj_result) {
if (!update__obj_result) {
console.log('The result was null or false.');
return false;
} else {
console.log(`update__obj_result = `, update__obj_result);
}
return update__obj_result;
})
@@ -789,7 +826,12 @@ async function handle_update__sponsorship({
General Info
</Tab>
<!-- Marketing for social media and email Level 1 and above with other restrictions -->
<Tab bind:group={$store_current_tab} name="tab_marketing" value={'marketing'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 1}>
<Tab
bind:group={$store_current_tab}
name="tab_marketing" value={'marketing'}
disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 1}
regionTab={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 1 ? 'text-slate-400' : ''}
>
<svelte:fragment slot="lead">
{#if $slct.sponsorship_obj.website_url && $slct.sponsorship_obj.website_url.length > 10}
<span class="fas fa-check text-green-500"></span>
@@ -800,7 +842,9 @@ async function handle_update__sponsorship({
</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}>
<Tab bind:group={$store_current_tab} name="tab_exhibit" value={'exhibit'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 2}
regionTab={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 2 ? 'text-slate-400' : ''}
>
<svelte:fragment slot="lead">
{#if $slct.sponsorship_obj.questions_li_json && $slct.sponsorship_obj.questions_li_json.table_exhibit}
<span class="fas fa-check text-green-500"></span>
@@ -811,7 +855,7 @@ async function handle_update__sponsorship({
</Tab>
{/if}
{#if $slct.sponsorship_obj.level_num > 2}
<Tab bind:group={$store_current_tab} name="tab_session" value={'session'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 3}>
<Tab bind:group={$store_current_tab} name="tab_session" value={'sessions'} disabled={!$slct.sponsorship_id || $slct.sponsorship_obj.level_num < 3}>
<svelte:fragment slot="lead">
{#if $slct.sponsorship_obj.questions_li_json && ($slct.sponsorship_obj.questions_li_json.virtual_session || $slct.sponsorship_obj.questions_li_json.virtual_session === 0)}
<span class="fas fa-check text-green-500"></span>
@@ -821,7 +865,9 @@ async function handle_update__sponsorship({
Session Info
</Tab>
{/if}
<Tab bind:group={$store_current_tab} name="tab_files" value={'files'} disabled={!$slct.sponsorship_id}>
<Tab bind:group={$store_current_tab} name="tab_files" value={'files'} disabled={!$slct.sponsorship_id}
regionTab={!$slct.sponsorship_id ? 'text-slate-400' : ''}
>
<svelte:fragment slot="lead">
{#if $slct.sponsorship_obj.logo_li_json && $slct.sponsorship_obj.logo_li_json.primary && $slct.sponsorship_obj.logo_li_json.primary.hosted_file_id_random}
<span class="fas fa-check text-green-500"></span>
@@ -830,7 +876,9 @@ async function handle_update__sponsorship({
</svelte:fragment>
File Uploads
</Tab>
<Tab bind:group={$store_current_tab} name="tab_gala_guests" value={'gala_guests'} disabled={!$slct.sponsorship_id}>
<Tab bind:group={$store_current_tab} name="tab_guests" value={'guests'} disabled={!$slct.sponsorship_id}
regionTab={!$slct.sponsorship_id ? 'text-slate-400' : ''}
>
<svelte:fragment slot="lead">
{#if $slct.sponsorship_obj.guest_li_json && $slct.sponsorship_obj.guest_li_json.length > 0}
<span class="fas fa-check text-green-500"></span>
@@ -995,7 +1043,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 : 'x'} placeholder="Line 1 (street)" autocomplete="street-address" class="input text-xs variant-glass-warning" 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 : ''} placeholder="Line 1 (street)" autocomplete="street-address" class="input text-xs variant-glass-warning" required />
</label>
<label for="address_line_2" class="label max-w-64">
<!-- Line 2 (Suite) -->
@@ -1236,7 +1284,7 @@ async function handle_update__sponsorship({
class="checkbox variant-glass-warning"
id="agree"
name="agree"
value="1"
value={1}
checked={$slct.sponsorship_obj.agree}
required
>
@@ -1377,9 +1425,9 @@ async function handle_update__sponsorship({
<input
class="radio variant-glass-warning"
type="radio"
checked
name="q_public_recognition"
value={1}
required
bind:group={$slct.sponsorship_obj.questions_li_json.public_recognition}
/>
<span class="fas fa-check"></span>
@@ -1407,9 +1455,9 @@ async function handle_update__sponsorship({
<input
class="radio variant-glass-warning"
type="radio"
checked
name="q_social_email"
value={1}
required
bind:group={$slct.sponsorship_obj.questions_li_json.social_email}
/>
<span class="fas fa-check"></span>
@@ -1437,9 +1485,9 @@ async function handle_update__sponsorship({
<input
class="radio variant-glass-warning"
type="radio"
checked
name="q_dedicated_promos"
value={1}
required
bind:group={$slct.sponsorship_obj.questions_li_json.dedicated_promos}
/>
<span class="fas fa-check"></span>
@@ -1500,6 +1548,7 @@ async function handle_update__sponsorship({
</div> -->
<div class="space-y-2">
<label for="q_table_exhibit" class="label">
<div class="font-bold input_required">Would you like a table top exhibit at CHOW?</div>
<label class="flex items-center space-x-2">
<input
@@ -1507,6 +1556,7 @@ async function handle_update__sponsorship({
type="radio"
name="q_table_exhibit"
value={1}
required
bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit}
/>
<span class="fas fa-check"></span>
@@ -1516,7 +1566,6 @@ async function handle_update__sponsorship({
<input
class="radio variant-glass-warning"
type="radio"
checked
name="q_table_exhibit"
value={0}
bind:group={$slct.sponsorship_obj.questions_li_json.table_exhibit}
@@ -1524,6 +1573,7 @@ async function handle_update__sponsorship({
<span class="fas fa-times"></span>
<span>No, we will NOT exhibit.</span>
</label>
</label>
</div>
<div class="space-y-2">
@@ -1568,7 +1618,7 @@ async function handle_update__sponsorship({
</form>
{:else if $store_current_tab === 'session'}
{:else if $store_current_tab === 'sessions'}
<form
class="modal-form {$ae_loc.hub.classes__form}"
@@ -1766,7 +1816,7 @@ async function handle_update__sponsorship({
padding="p-1"
accept="image/*"
class="w-96 variant-glass-warning"
required
required={!placeholder_li.file_logo_primary}
on:change={(e) => {
console.log('*** FileDropzone change event ***', e);
@@ -1917,10 +1967,10 @@ async function handle_update__sponsorship({
</form>
{:else if $store_current_tab === 'gala_guests'}
{:else if $store_current_tab === 'guests'}
<section class="gala_guests">
<section class="guests">
<h2 class="h3">Ocean Awards Gala Guests</h2>
<div class="text-sm space-y-4">