Work on the new Data Store element

This commit is contained in:
Scott Idem
2024-03-05 17:01:37 -05:00
parent 19a6ff6dbe
commit bed4f4a0f2
6 changed files with 777 additions and 48 deletions

View File

@@ -4,10 +4,10 @@ export let data;
import { onMount } from 'svelte';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils';
import type { key_val } from '$lib/ae_stores';
import Element_data_store from '$lib/element_data_store.svelte';
onMount(() => {
@@ -22,16 +22,39 @@ onMount(() => {
// $slct_trigger = 'msg_parent';
ae_util.handle_url_and_message('event_id', $slct.event_id);
ae_util.handle_url_and_message('event_badge_id', $slct.event_badge_id);
if ($slct.event_badge_id) {
console.log(`Got an ID. Let's show the modal!`);
modalStore.trigger(modal_edit__event_badge_obj);
}
// if ($slct.event_badge_id) {
// console.log(`Got an ID. Let's show the modal!`);
// modalStore.trigger(modal_edit__event_badge_obj);
// }
});
</script>
<section class="ae_events_badges md:container h-full mx-auto">
<h1 class="h2">New Events - Badges</h1>
<Element_data_store
ds_code="events__badges__overview"
ds_type="html"
for_type="event"
for_id={$slct.event_id}
display="block"
class_li="variant-ghost-surface p-2"
/>
<Element_data_store
ds_code="events__badges__example"
ds_type="html"
for_type="event"
for_id={$slct.event_id}
store="local"
display="block"
class_li="variant-ghost-surface p-2"
try_cache={true}
show_edit={true}
/>
</section>

View File

@@ -369,26 +369,26 @@ async function handle_create__event_presenter({
console.log('*** handle_create__event_presenter() ***');
ae_promises.api_create__event_presenter_obj = api.create_ae_obj_crud({
api_cfg: $ae_api,
obj_type: obj_type,
fields: data,
key: $ae_api.api_crud_super_key,
log_lvl: 2
})
.then(async function (create__obj_result) {
if (!create__obj_result) {
console.log('The result was null or false.');
return false;
}
return create__obj_result;
api_cfg: $ae_api,
obj_type: obj_type,
fields: data,
key: $ae_api.api_crud_super_key,
log_lvl: 2
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
.then(async function (create__obj_result) {
if (!create__obj_result) {
console.log('The result was null or false.');
return false;
});
}
return create__obj_result;
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
});
return ae_promises.api_create__event_presenter_obj;
return ae_promises.api_create__event_presenter_obj;
}
@@ -400,27 +400,27 @@ async function handle_update__event_presenter({
console.log('*** handle_update__event_presenter() ***');
ae_promises.update__event_presenter_obj = api.update_ae_obj_id_crud({
api_cfg: $ae_api,
obj_type: obj_type,
obj_id: obj_id,
fields: data,
key: $ae_api.api_crud_super_key,
log_lvl: 2
})
.then(async function (update__obj_result) {
if (!update__obj_result) {
console.log('The result was null or false.');
return false;
}
return update__obj_result;
api_cfg: $ae_api,
obj_type: obj_type,
obj_id: obj_id,
fields: data,
key: $ae_api.api_crud_super_key,
log_lvl: 2
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
.then(async function (update__obj_result) {
if (!update__obj_result) {
console.log('The result was null or false.');
return false;
});
}
return update__obj_result;
})
.catch(function (error) {
console.log('Something went wrong.');
console.log(error);
return false;
});
return ae_promises.update__event_presenter_obj;
return ae_promises.update__event_presenter_obj;
}
</script>

View File

@@ -8,6 +8,9 @@ import { fade } from 'svelte/transition';
// store_current_tab must be prefixed with $ to be reactive.
import { clipboard, FileDropzone, getModalStore, localStorageStore, ProgressRadial, RadioGroup, RadioItem, TabGroup, Tab, TabAnchor } from '@skeletonlabs/skeleton';
import type { Writable } from 'svelte/store';
import Element_data_store from '$lib/element_data_store.svelte';
const store_current_tab: Writable<string> = localStorageStore('ae_sponsorships_current_tab', 'start');
console.log(`store_current_tab:`, $store_current_tab);
@@ -1215,8 +1218,16 @@ async function handle_update__sponsorship({
{$ae_loc.ds['sponsorships__agree_li'][1].code}
{/if} -->
<h3 class="h4 input_required">Sponsor General Waiver</h3>
<p class="text-sm">Proceeds from your sponsorship benefit the National Marine Sanctuary Foundation, a 501c3 nonprofit organization. Your contribution may be tax-deductible. For more information, please consult with a tax professional. All sales are final, and contributions, purchases, tickets, and sponsorships are non-refundable. As the host of CHOW, the Foundation is committed to the safety and well-being of all participants. If CHOW moves entirely to a virtual platform due to external circumstances, the Foundation will work with you to ensure that we meet your sponsor benefit needs. In the event of cancellation, your purchase becomes a tax-deductible gift.</p>
<Element_data_store
ds_code="sponsorships__form__waiver_html"
ds_type="html"
for_type="sponsorship_cfg"
for_id={$slct.sponsorship_cfg_id}
display="block"
class_li=""
/>
<!-- <h3 class="h4 input_required">Sponsor General Waiver</h3>
<p class="text-sm">Proceeds from your sponsorship benefit the National Marine Sanctuary Foundation, a 501c3 nonprofit organization. Your contribution may be tax-deductible. For more information, please consult with a tax professional. All sales are final, and contributions, purchases, tickets, and sponsorships are non-refundable. As the host of CHOW, the Foundation is committed to the safety and well-being of all participants. If CHOW moves entirely to a virtual platform due to external circumstances, the Foundation will work with you to ensure that we meet your sponsor benefit needs. In the event of cancellation, your purchase becomes a tax-deductible gift.</p> -->
<label for="agree" class="label">
<input
type="checkbox"
@@ -1230,8 +1241,16 @@ async function handle_update__sponsorship({
Yes, I understand the "Sponsor General Waiver".
</label>
<h3 class="h4">Special Accomodations</h3>
<p class="text-sm">If you require any special accommodations in order to enhance/enable your involvement with CHOW please provide details in the text box below. A member of the CHOW team will reach out to assist.</p>
<Element_data_store
ds_code="sponsorships__form__accomodations_html"
ds_type="html"
for_type="sponsorship_cfg"
for_id={$slct.sponsorship_cfg_id}
display="block"
class_li=""
/>
<!-- <h3 class="h4">Special Accomodations</h3>
<p class="text-sm">If you require any special accommodations in order to enhance/enable your involvement with CHOW please provide details in the text box below. A member of the CHOW team will reach out to assist.</p> -->
<label for="q_accommodations" class="label">
<input
type="checkbox"