Wrapping up for the night at 4 AM. Made lots of progress with the Journals module. Should have saved more often.

This commit is contained in:
Scott Idem
2025-03-16 04:04:58 -04:00
parent d8020b3d77
commit b62a267ee8
23 changed files with 2340 additions and 1182 deletions

View File

@@ -0,0 +1,82 @@
/** @type {import('./$types').LayoutLoad} */
console.log(`ae_journals +layout.ts start`);
// Imports
import { browser } from '$app/environment';
// import { journals_func } from '$lib/ae_journals/ae_journals_functions';
export async function load({ params, parent }) {
let log_lvl: number = 0;
let parent_data = await parent();
// console.log(`ae_journals +layout.ts parent_data:`, parent_data);
let account_id = parent_data.account_id;
if (!account_id) {
console.log(`journals +layout.ts: The account_id was not found in the parent_data!!!`);
return false;
}
let ae_acct = parent_data[account_id];
if (log_lvl) {
console.log(`ae_acct = `, ae_acct);
}
// let note_id = ae_acct.slct.note_id; // From root +layout.ts
// if (!note_id) {
// console.log(`ERROR: journals +layout.ts: The note_id was not found in the parent_data!!!`);
// // return false;
// }
// let ae_params = {};
// if (browser) {
// if (note_id) {
// let load_note_obj_li = journals_func.load_ae_obj_li__note({
// api_cfg: ae_acct.api,
// for_obj_type: 'account',
// for_obj_id: account_id,
// enabled: 'enabled',
// hidden: 'not_hidden',
// limit: 20,
// // order_by_li: {},
// params: ae_params,
// try_cache: true,
// log_lvl: log_lvl
// });
// ae_acct.slct.note_obj_li = load_note_obj_li;
// }
// }
// let load_note_obj = journals_func.load_ae_obj_id__note({
// api_cfg: ae_acct.api,
// note_id: note_id,
// try_cache: false
// });
// ae_acct.slct.note_obj = load_note_obj;
// if (browser) {
// console.log(`Browser: ${browser}`);
// journals_func.db_save_ae_obj_li__note({
// obj_type: 'note',
// obj_li: [load_note_obj_li],
// });
// }
// let submenu = {
// main: {name: 'Main', href: '/journals', access: false},
// // manage: {name: 'Manage', href: '/journals/manage', access: 'administrator', disable: true, hide: true},
// locations: {name: 'Locations', href: `/journals/${note_id}/locations`, access: false, disable: false, hide: false},
// };
// parent_data.submenu = submenu
// WARNING: Precaution against shared parent_data between sites and sessions.
parent_data[account_id] = ae_acct;
return parent_data;
}
// export const prerender = false;
// export const prerender = true;