diff --git a/src/app.html b/src/app.html
index f9e7e389..94364ba4 100644
--- a/src/app.html
+++ b/src/app.html
@@ -5,6 +5,12 @@
+
+
+
+
+
+
-
+
@@ -122,10 +132,10 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
{:else if $drawerStore.id === 'sponsorships__edit'}
(show 'sponsorships__edit__sponsorship_obj' contents)
{:else}
(fallback contents)
@@ -151,10 +161,12 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
Sponsorships
Speakers
@@ -191,6 +203,9 @@ async function handle_get_data_store_obj_w_code({code, data_type='text'}) {
-->
+
+
+
diff --git a/src/routes/sponsorships/+layout.svelte b/src/routes/sponsorships/+layout.svelte
new file mode 100644
index 00000000..33aa81e9
--- /dev/null
+++ b/src/routes/sponsorships/+layout.svelte
@@ -0,0 +1,14 @@
+
+
+Sponsorships Layout?
+
+
+
+
\ No newline at end of file
diff --git a/src/routes/sponsorships/+layout.ts b/src/routes/sponsorships/+layout.ts
index e69de29b..d0ea0362 100644
--- a/src/routes/sponsorships/+layout.ts
+++ b/src/routes/sponsorships/+layout.ts
@@ -0,0 +1,18 @@
+/** @type {import('./$types').LayoutLoad} */
+export function load({ params, url }) { // route
+ console.log(`page data - params:`, params);
+ // console.log(`page data - route:`, route);
+ console.log(`page data - url:`, url);
+
+ let data_struct = {
+ params: params,
+ sections: [
+ { slug: 'new', title: 'New Sponsorship' },
+ { slug: 'manage', title: 'Manage' },
+ { slug: 'test', title: 'Test' },
+ ],
+ url: url,
+
+ };
+ return data_struct;
+}
diff --git a/src/routes/sponsorships/+page.svelte b/src/routes/sponsorships/+page.svelte
index 98d1efc8..9553959a 100644
--- a/src/routes/sponsorships/+page.svelte
+++ b/src/routes/sponsorships/+page.svelte
@@ -5,21 +5,37 @@ import { onMount } from 'svelte';
import { getDrawerStore, getModalStore } from '@skeletonlabs/skeleton';
import type {
DrawerSettings,
- // ModalSettings, ModalComponent, ModalStore
+ ModalSettings
+ , ModalComponent, ModalStore
} from '@skeletonlabs/skeleton';
const modalStore = getModalStore();
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
-import Edit_sponsorship_obj from './10_edit__sponsorship_obj.svelte';
+// import Edit_sponsorship_obj from './10_edit__sponsorship_obj.svelte';
+import Edit_modal_sponsorship_obj from './10_edit_modal__sponsorship_obj.svelte';
import List_sponsorship_obj from './10_list__sponsorship_obj.svelte';
import View_sponsorship_obj from './10_view__sponsorship_obj.svelte';
+
+import View_modal_sponsorship_obj from './10_view_modal__sponsorship_obj.svelte';
+
+const modalComponentViewSponsorshipObj: ModalComponent = { ref: View_modal_sponsorship_obj };
+
+const modal_view__sponsorship_obj: ModalSettings = {
+ type: 'component',
+ component: modalComponentViewSponsorshipObj,
+};
+
+
type key_val = {
[key: string]: any;
};
+export let data;
+console.log(`page data:`, data);
+
let ae_account_obj_get_promise;
let ae_sponsorship_obj_li_get_promise;
@@ -155,7 +171,83 @@ async function handle_load_ae_sponsorship_obj_li({account_id, try_cache=true}) {
return ae_sponsorship_obj_li_get_promise;
}
+$: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) {
+ console.log('Selected Sponsorship ID:', $slct.sponsorship_id);
+ console.log('Selected Sponsorship Object:', $slct.sponsorship_obj);
+ $slct_trigger = null;
+
+ handle_load_ae_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
+}
+
+let ae_sponsorship_obj_get_promise;
+async function handle_load_ae_sponsorship_id_obj({sponsorship_id, try_cache=false}) {
+ console.log('*** handle_load_sponsorship_id_obj() ***');
+
+ let params = {};
+
+ // $ae_loc.hub.sponsorship_id_qry_status = 'loading';
+ ae_sponsorship_obj_get_promise = api.get_ae_obj_id_crud({
+ api_cfg: $ae_api,
+ obj_type: 'sponsorship',
+ obj_id: sponsorship_id,
+ use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
+ use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
+ params: params,
+ log_lvl: 2
+ })
+ .then(function (sponsorship_obj_get_result) {
+ if (sponsorship_obj_get_result) {
+ $slct.sponsorship_obj = sponsorship_obj_get_result;
+ console.log(`sponsorship object:`, $slct.sponsorship_obj);
+ }
+
+ // Auto show the selected sponsorship ID
+ // Is this pushState needed here?
+ // Set the URL param "sponsorship_id" to the current sponsorship ID.
+ // const url = new URL(location);
+ // url.searchParams.set('sponsorship_id', $slct.sponsorship_id);
+ // history.pushState({}, '', url);
+
+ // Is this postMessage needed here?
+ // let message = {'sponsorship_id': $slct.sponsorship_id};
+ // window.parent.postMessage(message, "*");
+
+ // modalStore.trigger(modal_view__sponsorship_obj);
+ })
+ .catch(function (error) {
+ console.log('No results returned or failed.', error);
+ });
+
+ return ae_sponsorship_obj_get_promise;
+}
+
+const modal_edit__sponsorship_obj: ModalSettings = {
+ type: 'component',
+ component: 'modalComponentEditSponsorshipObj',
+ title: 'Edit Sponsorship',
+};
+
+// const modal_view__sponsorship_obj: ModalSettings = {
+// type: 'component',
+// component: 'modal_component_view__sponsorship_obj',
+// };
+
+// $: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) {
+// console.log('Selected Sponsorship ID:', $slct.sponsorship_id);
+// console.log('Selected Sponsorship Object:', $slct.sponsorship_obj);
+
+// $slct_trigger = null;
+// }
+
+$: if ($ae_loc.mod.sponsorships.show_edit__sponsorship_obj) {
+ console.log('Show Modal Edit');
+ modalStore.trigger(modal_edit__sponsorship_obj);
+} else if ($ae_loc.mod.sponsorships.show_view__sponsorship_obj) {
+ console.log('Show Modal View');
+ // modalStore.trigger(modalComponentViewSponsorshipObj);
+ modalStore.trigger(modal_view__sponsorship_obj);
+}
// const modal: ModalSettings = {
// type: 'alert',
@@ -232,19 +324,19 @@ const drawer_settings_y: DrawerSettings = {
{/if}
-