This is the first commit of the day. It is probably the last. Lots of general prep for a demo.
This commit is contained in:
@@ -20,9 +20,6 @@ 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_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 };
|
||||
@@ -43,7 +40,7 @@ type key_val = {
|
||||
};
|
||||
|
||||
export let data;
|
||||
console.log(`page data:`, data);
|
||||
// console.log(`Svelte Sponsorships page data:`, data);
|
||||
|
||||
let ae_account_obj_get_promise;
|
||||
let ae_sponsorship_obj_li_get_promise;
|
||||
@@ -59,51 +56,51 @@ onMount(() => {
|
||||
|
||||
if ($ae_loc.account_id) {
|
||||
$slct.account_id = $ae_loc.account_id;
|
||||
// handle_load_ae_account_id_obj({account_id: $slct.account_id, try_cache: false});
|
||||
handle_load_ae_sponsorship_obj_li({account_id: $slct.account_id, try_cache: false});
|
||||
// handle_load_ae_obj_id__account({account_id: $slct.account_id, try_cache: false});
|
||||
handle_load_ae_obj_li__sponsorship({account_id: $slct.account_id, try_cache: false});
|
||||
}
|
||||
|
||||
async function handle_load_ae_account_id_obj({account_id, try_cache=false}) {
|
||||
console.log('*** handle_load_account_id_obj() ***');
|
||||
// async function handle_load_ae_obj_id__account({account_id, try_cache=false}) {
|
||||
// console.log('*** handle_load_ae_obj_id__account() ***');
|
||||
|
||||
let params = {};
|
||||
// let params = {};
|
||||
|
||||
$ae_loc.hub.account_id_qry_status = 'loading';
|
||||
ae_account_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'account',
|
||||
obj_id: account_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: 0
|
||||
})
|
||||
.then(function (account_obj_get_result) {
|
||||
if (account_obj_get_result) {
|
||||
$slct.account_obj = account_obj_get_result;
|
||||
console.log(`account object:`, $slct.account_obj);
|
||||
}
|
||||
// $ae_loc.hub.account_id_qry_status = 'loading';
|
||||
// ae_account_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
// api_cfg: $ae_api,
|
||||
// obj_type: 'account',
|
||||
// obj_id: account_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: 0
|
||||
// })
|
||||
// .then(function (account_obj_get_result) {
|
||||
// if (account_obj_get_result) {
|
||||
// $slct.account_obj = account_obj_get_result;
|
||||
// console.log(`account object:`, $slct.account_obj);
|
||||
// }
|
||||
|
||||
// Auto show the selected account ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "account_id" to the current account ID.
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('account_id', $slct.account_id);
|
||||
history.pushState({}, '', url);
|
||||
// // Auto show the selected account ID
|
||||
// // Is this pushState needed here?
|
||||
// // Set the URL param "account_id" to the current account ID.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('account_id', $slct.account_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
let message = {'account_id': $slct.account_id};
|
||||
window.parent.postMessage(message, "*");
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
// // Is this postMessage needed here?
|
||||
// let message = {'account_id': $slct.account_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log('No results returned or failed.', error);
|
||||
// });
|
||||
|
||||
return ae_account_obj_get_promise;
|
||||
}
|
||||
// return ae_account_obj_get_promise;
|
||||
// }
|
||||
|
||||
async function handle_load_ae_sponsorship_obj_li({account_id, try_cache=true}) {
|
||||
console.log('*** handle_load_ae_sponsorship_obj_li() ***');
|
||||
async function handle_load_ae_obj_li__sponsorship({account_id, try_cache=true}) {
|
||||
console.log('*** handle_load_ae_obj_li__sponsorship() ***');
|
||||
// console.log($ae_loc.mod.sponsorships);
|
||||
|
||||
// let fulltext_search_qry_str = ($ae_loc.mod.sponsorships && $ae_loc.mod.sponsorships.fulltext_search_qry_str ? $ae_loc.mod.sponsorships.fulltext_search_qry_str : '');
|
||||
@@ -182,18 +179,76 @@ 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);
|
||||
|
||||
// Load the Sponsorship Cfg Obj with ID based on the URL param.
|
||||
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
|
||||
$slct_trigger = 'load__sponsorship_cfg_obj';
|
||||
|
||||
$: if ($slct_trigger == 'load__sponsorship_cfg_obj' && $slct.sponsorship_cfg_id) {
|
||||
console.log('Selected Sponsorship Cfg ID:', $slct.sponsorship_cfg_id);
|
||||
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_ae_sponsorship_id_obj({sponsorship_id: $slct.sponsorship_id, try_cache: false});
|
||||
handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id: $slct.sponsorship_cfg_id, try_cache: false});
|
||||
}
|
||||
|
||||
let ae_sponsorship_cfg_obj_get_promise;
|
||||
|
||||
async function handle_load_ae_obj_id__sponsorship_cfg({sponsorship_cfg_id, try_cache=false}) {
|
||||
console.log(`*** handle_load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`);
|
||||
|
||||
let params = {};
|
||||
|
||||
// $ae_loc.hub.sponsorship_cfg_id_qry_status = 'loading';
|
||||
ae_sponsorship_cfg_obj_get_promise = api.get_ae_obj_id_crud({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'sponsorship_cfg',
|
||||
obj_id: sponsorship_cfg_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: 1
|
||||
})
|
||||
.then(function (sponsorship_cfg_obj_get_result) {
|
||||
if (sponsorship_cfg_obj_get_result) {
|
||||
$slct.sponsorship_cfg_obj = sponsorship_cfg_obj_get_result;
|
||||
console.log(`sponsorship object:`, $slct.sponsorship_cfg_obj);
|
||||
}
|
||||
|
||||
// Auto show the selected sponsorship ID
|
||||
// Is this pushState needed here?
|
||||
// Set the URL param "sponsorship_cfg_id" to the current sponsorship ID.
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('sponsorship_cfg_id', $slct.sponsorship_cfg_id);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// Is this postMessage needed here?
|
||||
// let message = {'sponsorship_cfg_id': $slct.sponsorship_cfg_id};
|
||||
// window.parent.postMessage(message, "*");
|
||||
|
||||
// modalStore.trigger(modal_view__sponsorship_cfg_obj);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return ae_sponsorship_cfg_obj_get_promise;
|
||||
}
|
||||
|
||||
|
||||
// Load the Sponsorship Obj with ID based on the URL param.
|
||||
$: if ($slct_trigger == 'load__sponsorship_obj' && $slct.sponsorship_id) {
|
||||
console.log('Selected Sponsorship ID:', $slct.sponsorship_id);
|
||||
|
||||
$slct_trigger = null;
|
||||
|
||||
handle_load_ae_obj_id__sponsorship({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() ***');
|
||||
|
||||
async function handle_load_ae_obj_id__sponsorship({sponsorship_id, try_cache=false}) {
|
||||
console.log(`*** handle_load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
|
||||
|
||||
let params = {};
|
||||
|
||||
@@ -205,7 +260,7 @@ async function handle_load_ae_sponsorship_id_obj({sponsorship_id, try_cache=fals
|
||||
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
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (sponsorship_obj_get_result) {
|
||||
if (sponsorship_obj_get_result) {
|
||||
|
||||
Reference in New Issue
Block a user