I have the new BB Posts working well for IDAA now. NOTE: I intentionally split the API calls that are triggered on layout and page loads.
This commit is contained in:
@@ -98,6 +98,10 @@ export async function load_ae_obj_id__journal(
|
|||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log('ae_promises.load__journal_obj:', ae_promises.load__journal_obj);
|
console.log('ae_promises.load__journal_obj:', ae_promises.load__journal_obj);
|
||||||
}
|
}
|
||||||
|
if (!ae_promises.load__journal_obj) {
|
||||||
|
console.log(`ERROR: Journals - Journal - The journal with ID ${journal_id} was not found.`);
|
||||||
|
return ae_promises.load__journal_obj; // Return null if the journal was not found
|
||||||
|
}
|
||||||
|
|
||||||
if (inc_entry_li) {
|
if (inc_entry_li) {
|
||||||
// Load the entries for the journal
|
// Load the entries for the journal
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ export async function load_ae_obj_id__post(
|
|||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log('ae_promises.load__post_obj:', ae_promises.load__post_obj);
|
console.log('ae_promises.load__post_obj:', ae_promises.load__post_obj);
|
||||||
}
|
}
|
||||||
|
if (!ae_promises.load__post_obj) {
|
||||||
|
console.log(`ERROR: Posts - Post - The post with ID ${post_id} was not found.`);
|
||||||
|
return ae_promises.load__post_obj; // Return null if the post was not found
|
||||||
|
}
|
||||||
|
|
||||||
if (inc_comment_li) {
|
if (inc_comment_li) {
|
||||||
// Load the comments for the post
|
// Load the comments for the post
|
||||||
@@ -109,7 +113,7 @@ export async function load_ae_obj_id__post(
|
|||||||
hidden: hidden, // all, hidden, not_hidden
|
hidden: hidden, // all, hidden, not_hidden
|
||||||
limit: limit, // Limit for the comments
|
limit: limit, // Limit for the comments
|
||||||
offset: offset,
|
offset: offset,
|
||||||
params: {qry__enabled: 'all', qry__limit: 25},
|
params: params,
|
||||||
try_cache: try_cache,
|
try_cache: try_cache,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
let log_lvl: number = 0;
|
let log_lvl: number = 0;
|
||||||
|
|
||||||
|
// *** Import Svelte specific
|
||||||
|
import { page } from '$app/state';
|
||||||
|
|
||||||
// *** Import Aether specific variables and functions
|
// *** Import Aether specific variables and functions
|
||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||||
|
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
/** @type {import('./$types').LayoutData} */
|
/** @type {import('./$types').LayoutData} */
|
||||||
@@ -29,6 +33,56 @@ $idaa_slct.post_obj_li = ae_acct.slct.post_obj_li;
|
|||||||
// $idaa_slct.post_id = ae_acct.slct.post_id; // Not set here yet.
|
// $idaa_slct.post_id = ae_acct.slct.post_id; // Not set here yet.
|
||||||
|
|
||||||
// *** Set initial variables
|
// *** Set initial variables
|
||||||
|
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if ($idaa_trig.post_id) {
|
||||||
|
// log_lvl = 1;
|
||||||
|
$idaa_trig.post_id = false;
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Triggered: $idaa_trig.post_id`);
|
||||||
|
}
|
||||||
|
|
||||||
|
$idaa_prom.load__post_obj = posts_func.load_ae_obj_id__post({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
post_id: $idaa_slct.post_id,
|
||||||
|
enabled: $idaa_loc.bb.qry__enabled,
|
||||||
|
hidden: $idaa_loc.bb.qry__hidden,
|
||||||
|
limit: $idaa_loc.bb.qry__limit,
|
||||||
|
inc_comment_li: true,
|
||||||
|
// try_cache: true,
|
||||||
|
log_lvl: log_lvl,
|
||||||
|
})
|
||||||
|
.then((post_obj) => {
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Post object loaded: `, post_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
$idaa_slct.post_obj = post_obj;
|
||||||
|
$idaa_slct.post_comment_id = null;
|
||||||
|
$idaa_slct.post_comment_obj = null;
|
||||||
|
|
||||||
|
// $idaa_sess.bb.show__modal_view__post_id = $idaa_slct.post_id;
|
||||||
|
// $idaa_sess.bb.show__modal_edit__post_id = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// $idaa_slct.post_obj = $idaa_prom.load__post_obj;
|
||||||
|
|
||||||
|
if (!page.url.searchParams.get('post_id')) {
|
||||||
|
const url = new URL(location);
|
||||||
|
// url.searchParams.set('post_id', $idaa_slct.post_id);
|
||||||
|
url.searchParams.delete('post_id');
|
||||||
|
history.pushState({}, '', url);
|
||||||
|
|
||||||
|
let message = {'post_id': $idaa_slct.post_id};
|
||||||
|
window.parent.postMessage(message, "*");
|
||||||
|
}
|
||||||
|
|
||||||
|
$idaa_sess.bb.show__modal_view__post_id = $idaa_slct.post_id;
|
||||||
|
$idaa_sess.bb.show__modal_edit__post_id = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,60 +7,60 @@ import { browser } from '$app/environment';
|
|||||||
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||||
|
|
||||||
export async function load({ params, parent }) { // route
|
export async function load({ params, parent }) { // route
|
||||||
let log_lvl: number = 0;
|
// let log_lvl: number = 0;
|
||||||
|
|
||||||
let data = await parent();
|
// let data = await parent();
|
||||||
data.log_lvl = log_lvl;
|
// data.log_lvl = log_lvl;
|
||||||
|
|
||||||
let account_id = data.account_id;
|
// let account_id = data.account_id;
|
||||||
let ae_acct = data[account_id];
|
// let ae_acct = data[account_id];
|
||||||
// console.log(`ae_acct = `, ae_acct);
|
// // console.log(`ae_acct = `, ae_acct);
|
||||||
|
|
||||||
// if (!account_id) {
|
// // if (!account_id) {
|
||||||
// console.log(`ae IDAA BB - [account_id] +page.ts: The account_id was not found!!!`);
|
// // console.log(`ae IDAA BB - [account_id] +page.ts: The account_id was not found!!!`);
|
||||||
// error(404, {
|
// // error(404, {
|
||||||
// message: 'Account ID not found'
|
// // message: 'Account ID not found'
|
||||||
// });
|
// // });
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// // ae_acct.slct.account_id = account_id;
|
||||||
|
|
||||||
|
// // let post_id = params.post_id;
|
||||||
|
// // let post_id = page.url.searchParams.has('post_id') ?? null;
|
||||||
|
// // let post_id = page.url.searchParams.get('post_id') ?? null;
|
||||||
|
// // if (!post_id) {
|
||||||
|
// // console.log(`ae Posts - [post_id] +page.ts: The post_id was not found in the params.post_id!!!`);
|
||||||
|
// // // error(404, {
|
||||||
|
// // // message: 'Post ID not found'
|
||||||
|
// // // });
|
||||||
|
// // } else {
|
||||||
|
// // console.log(`ae Posts - [post_id] +page.ts: post_id = `, post_id);
|
||||||
|
// // ae_acct.slct.post_id = post_id;
|
||||||
|
// // }
|
||||||
|
|
||||||
|
// // ae_acct.slct.post_id = post_id;
|
||||||
|
|
||||||
|
// if (browser) {
|
||||||
|
// let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
||||||
|
// api_cfg: ae_acct.api,
|
||||||
|
// for_obj_type: 'account',
|
||||||
|
// for_obj_id: account_id,
|
||||||
|
// inc_comment_li: true,
|
||||||
|
// enabled: 'enabled',
|
||||||
|
// hidden: 'not_hidden',
|
||||||
|
// limit: 29,
|
||||||
|
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
||||||
|
// try_cache: true,
|
||||||
|
// log_lvl: log_lvl
|
||||||
|
// });
|
||||||
|
// if (log_lvl) {
|
||||||
|
// console.log(`load_post_obj_li = `, load_post_obj_li);
|
||||||
|
// }
|
||||||
|
// ae_acct.slct.post_obj_li = load_post_obj_li;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// ae_acct.slct.account_id = account_id;
|
// // WARNING: Precaution against shared data between sites and sessions.
|
||||||
|
// data[account_id] = ae_acct;
|
||||||
|
|
||||||
// let post_id = params.post_id;
|
// return data;
|
||||||
// let post_id = page.url.searchParams.has('post_id') ?? null;
|
|
||||||
// let post_id = page.url.searchParams.get('post_id') ?? null;
|
|
||||||
// if (!post_id) {
|
|
||||||
// console.log(`ae Posts - [post_id] +page.ts: The post_id was not found in the params.post_id!!!`);
|
|
||||||
// // error(404, {
|
|
||||||
// // message: 'Post ID not found'
|
|
||||||
// // });
|
|
||||||
// } else {
|
|
||||||
// console.log(`ae Posts - [post_id] +page.ts: post_id = `, post_id);
|
|
||||||
// ae_acct.slct.post_id = post_id;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ae_acct.slct.post_id = post_id;
|
|
||||||
|
|
||||||
if (browser) {
|
|
||||||
let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
|
||||||
api_cfg: ae_acct.api,
|
|
||||||
for_obj_type: 'account',
|
|
||||||
for_obj_id: account_id,
|
|
||||||
inc_comment_li: true,
|
|
||||||
enabled: 'enabled',
|
|
||||||
hidden: 'not_hidden',
|
|
||||||
limit: 29,
|
|
||||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
|
||||||
try_cache: true,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
});
|
|
||||||
if (log_lvl) {
|
|
||||||
console.log(`load_post_obj_li = `, load_post_obj_li);
|
|
||||||
}
|
|
||||||
ae_acct.slct.post_obj_li = load_post_obj_li;
|
|
||||||
}
|
|
||||||
|
|
||||||
// WARNING: Precaution against shared data between sites and sessions.
|
|
||||||
data[account_id] = ae_acct;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,54 +121,54 @@ $effect(() => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$effect(() => {
|
// $effect(() => {
|
||||||
if ($idaa_trig.post_id) {
|
// if ($idaa_trig.post_id) {
|
||||||
// log_lvl = 1;
|
// // log_lvl = 1;
|
||||||
$idaa_trig.post_id = false;
|
// $idaa_trig.post_id = false;
|
||||||
|
|
||||||
if (log_lvl) {
|
// if (log_lvl) {
|
||||||
console.log(`Triggered: $idaa_trig.post_id`);
|
// console.log(`Triggered: $idaa_trig.post_id`);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$idaa_prom.load__post_obj = posts_func.load_ae_obj_id__post({
|
// $idaa_prom.load__post_obj = posts_func.load_ae_obj_id__post({
|
||||||
api_cfg: $ae_api,
|
// api_cfg: $ae_api,
|
||||||
post_id: $idaa_slct.post_id,
|
// post_id: $idaa_slct.post_id,
|
||||||
enabled: $idaa_loc.bb.qry__enabled,
|
// enabled: $idaa_loc.bb.qry__enabled,
|
||||||
hidden: $idaa_loc.bb.qry__hidden,
|
// hidden: $idaa_loc.bb.qry__hidden,
|
||||||
limit: $idaa_loc.bb.qry__limit,
|
// limit: $idaa_loc.bb.qry__limit,
|
||||||
inc_comment_li: true,
|
// inc_comment_li: true,
|
||||||
// try_cache: true,
|
// // try_cache: true,
|
||||||
log_lvl: log_lvl,
|
// log_lvl: log_lvl,
|
||||||
})
|
// })
|
||||||
.then((post_obj) => {
|
// .then((post_obj) => {
|
||||||
if (log_lvl) {
|
// if (log_lvl) {
|
||||||
console.log(`Post object loaded: `, post_obj);
|
// console.log(`Post object loaded: `, post_obj);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$idaa_slct.post_obj = post_obj;
|
// $idaa_slct.post_obj = post_obj;
|
||||||
$idaa_slct.post_comment_id = null;
|
// $idaa_slct.post_comment_id = null;
|
||||||
$idaa_slct.post_comment_obj = null;
|
// $idaa_slct.post_comment_obj = null;
|
||||||
|
|
||||||
// $idaa_sess.bb.show__modal_view__post_id = $idaa_slct.post_id;
|
// // $idaa_sess.bb.show__modal_view__post_id = $idaa_slct.post_id;
|
||||||
// $idaa_sess.bb.show__modal_edit__post_id = false;
|
// // $idaa_sess.bb.show__modal_edit__post_id = false;
|
||||||
});
|
// });
|
||||||
|
|
||||||
// $idaa_slct.post_obj = $idaa_prom.load__post_obj;
|
// // $idaa_slct.post_obj = $idaa_prom.load__post_obj;
|
||||||
|
|
||||||
if (!page.url.searchParams.get('post_id')) {
|
// if (!page.url.searchParams.get('post_id')) {
|
||||||
const url = new URL(location);
|
// const url = new URL(location);
|
||||||
// url.searchParams.set('post_id', $idaa_slct.post_id);
|
// // url.searchParams.set('post_id', $idaa_slct.post_id);
|
||||||
url.searchParams.delete('post_id');
|
// url.searchParams.delete('post_id');
|
||||||
history.pushState({}, '', url);
|
// history.pushState({}, '', url);
|
||||||
|
|
||||||
let message = {'post_id': $idaa_slct.post_id};
|
// let message = {'post_id': $idaa_slct.post_id};
|
||||||
window.parent.postMessage(message, "*");
|
// window.parent.postMessage(message, "*");
|
||||||
}
|
// }
|
||||||
|
|
||||||
$idaa_sess.bb.show__modal_view__post_id = $idaa_slct.post_id;
|
// $idaa_sess.bb.show__modal_view__post_id = $idaa_slct.post_id;
|
||||||
$idaa_sess.bb.show__modal_edit__post_id = false;
|
// $idaa_sess.bb.show__modal_edit__post_id = false;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
if (browser) {
|
if (browser) {
|
||||||
|
|||||||
42
src/routes/idaa/(idaa)/bb/+page.ts
Normal file
42
src/routes/idaa/(idaa)/bb/+page.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import type { PageLoad } from './$types';
|
||||||
|
|
||||||
|
console.log(`ae_idaa_bulletin_board [root] +page.ts start`);
|
||||||
|
|
||||||
|
import { error } from '@sveltejs/kit';
|
||||||
|
import { browser } from '$app/environment';
|
||||||
|
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||||
|
|
||||||
|
export const load = (async ({ params, parent }) => { // route
|
||||||
|
let log_lvl: number = 0;
|
||||||
|
|
||||||
|
let data = await parent();
|
||||||
|
data.log_lvl = log_lvl;
|
||||||
|
|
||||||
|
let account_id = data.account_id;
|
||||||
|
let ae_acct = data[account_id];
|
||||||
|
|
||||||
|
if (browser) {
|
||||||
|
let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
||||||
|
api_cfg: ae_acct.api,
|
||||||
|
for_obj_type: 'account',
|
||||||
|
for_obj_id: account_id,
|
||||||
|
inc_comment_li: true,
|
||||||
|
enabled: 'enabled',
|
||||||
|
hidden: 'not_hidden',
|
||||||
|
limit: 29,
|
||||||
|
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
||||||
|
try_cache: true,
|
||||||
|
log_lvl: log_lvl
|
||||||
|
});
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`load_post_obj_li = `, load_post_obj_li);
|
||||||
|
}
|
||||||
|
ae_acct.slct.post_obj_li = load_post_obj_li;
|
||||||
|
}
|
||||||
|
|
||||||
|
// WARNING: Precaution against shared data between sites and sessions.
|
||||||
|
data[account_id] = ae_acct;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
|
||||||
|
}) satisfies PageLoad;
|
||||||
@@ -32,6 +32,7 @@ if (log_lvl) {
|
|||||||
|
|
||||||
$idaa_sess.bb.edit__post_obj = null;
|
$idaa_sess.bb.edit__post_obj = null;
|
||||||
$idaa_slct.post_id = ae_acct.slct.post_id;
|
$idaa_slct.post_id = ae_acct.slct.post_id;
|
||||||
|
$idaa_trig.post_id = ae_acct.slct.post_id;
|
||||||
// $idaa_slct.post_obj = ae_acct.slct.post_obj;
|
// $idaa_slct.post_obj = ae_acct.slct.post_obj;
|
||||||
|
|
||||||
// Functions and Logic
|
// Functions and Logic
|
||||||
@@ -94,8 +95,8 @@ onDestroy(() => {
|
|||||||
let message = {'post_id': null};
|
let message = {'post_id': null};
|
||||||
window.parent.postMessage(message, "*");
|
window.parent.postMessage(message, "*");
|
||||||
|
|
||||||
$idaa_slct.post_id = null;
|
// $idaa_slct.post_id = null;
|
||||||
$idaa_slct.post_obj = null;
|
// $idaa_slct.post_obj = null;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import type { PageLoad } from './$types';
|
|||||||
|
|
||||||
console.log(`ae_idaa_bulletin_board [post_id] +page.ts start`);
|
console.log(`ae_idaa_bulletin_board [post_id] +page.ts start`);
|
||||||
|
|
||||||
|
import { error } from '@sveltejs/kit';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||||
|
|
||||||
@@ -28,13 +29,24 @@ export const load = (async ({ params, parent }) => { // route
|
|||||||
post_id: post_id,
|
post_id: post_id,
|
||||||
inc_comment_li: true,
|
inc_comment_li: true,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
|
})
|
||||||
|
.then((results) => {
|
||||||
|
if (!results) {
|
||||||
|
error(404, {
|
||||||
|
message: 'IDAA BB - Post not found'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// ae_acct.slct.journal_obj = results;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`load_post_obj = `, load_post_obj);
|
console.log(`load_post_obj = `, load_post_obj);
|
||||||
}
|
}
|
||||||
ae_acct.slct.post_obj = load_post_obj;
|
ae_acct.slct.post_obj = load_post_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WARNING: Precaution against shared data between sites.
|
||||||
data[account_id] = ae_acct;
|
data[account_id] = ae_acct;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ import Comp_hosted_files_upload from '$lib/ae_core/ae_comp__hosted_files_upload.
|
|||||||
// let obj_changed = $state(false);
|
// let obj_changed = $state(false);
|
||||||
// let orig_post_obj: any = $state(null);
|
// let orig_post_obj: any = $state(null);
|
||||||
// let orig_post_obj: any = $state({ ...$idaa_slct.post_obj }); // Create a copy of the post object
|
// let orig_post_obj: any = $state({ ...$idaa_slct.post_obj }); // Create a copy of the post object
|
||||||
|
if (!$idaa_slct.post_obj) {
|
||||||
|
$idaa_slct.post_obj = {};
|
||||||
|
}
|
||||||
let orig_post_obj: any = { ...$idaa_slct.post_obj };
|
let orig_post_obj: any = { ...$idaa_slct.post_obj };
|
||||||
if (browser) {
|
if (browser) {
|
||||||
// console.log(`$lq__post_obj = `, $lq__post_obj);
|
// console.log(`$lq__post_obj = `, $lq__post_obj);
|
||||||
@@ -433,7 +436,7 @@ $effect(() => {
|
|||||||
{#if $ae_loc.administrator_access}
|
{#if $ae_loc.administrator_access}
|
||||||
<Tiptap_editor
|
<Tiptap_editor
|
||||||
default_minimal={true}
|
default_minimal={true}
|
||||||
html_text={$idaa_slct.post_obj.content}
|
html_text={$idaa_slct.post_obj?.content}
|
||||||
show_button_kv={{
|
show_button_kv={{
|
||||||
text: true,
|
text: true,
|
||||||
bullet_list: true,
|
bullet_list: true,
|
||||||
@@ -448,7 +451,7 @@ $effect(() => {
|
|||||||
{:else}
|
{:else}
|
||||||
<Tiptap_editor
|
<Tiptap_editor
|
||||||
default_minimal={true}
|
default_minimal={true}
|
||||||
html_text={$idaa_slct.post_obj.content}
|
html_text={$idaa_slct.post_obj?.content}
|
||||||
show_button_kv={{
|
show_button_kv={{
|
||||||
// text: true,
|
// text: true,
|
||||||
// bullet_list: true,
|
// bullet_list: true,
|
||||||
@@ -519,7 +522,7 @@ $effect(() => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if $idaa_slct.post_obj.linked_li_json && $idaa_slct.post_obj.linked_li_json.length}
|
{#if $idaa_slct.post_obj?.linked_li_json && $idaa_slct.post_obj.linked_li_json.length}
|
||||||
<div class="ae_section flex flex-row flex-wrap gap-1 items-center justify-center">
|
<div class="ae_section flex flex-row flex-wrap gap-1 items-center justify-center">
|
||||||
<span class="fas fa-paperclip"></span>
|
<span class="fas fa-paperclip"></span>
|
||||||
<span class="text-sm text-gray-600 dark:text-gray-400 italic">Linked files:</span>
|
<span class="text-sm text-gray-600 dark:text-gray-400 italic">Linked files:</span>
|
||||||
@@ -718,7 +721,8 @@ $effect(() => {
|
|||||||
type="text"
|
type="text"
|
||||||
id="external_person_id"
|
id="external_person_id"
|
||||||
name="external_person_id"
|
name="external_person_id"
|
||||||
value={($idaa_slct.post_obj.external_person_id ? $idaa_slct.post_obj.external_person_id : '')}
|
value={($idaa_slct.post_obj?.external_person_id ? $idaa_slct.post_obj
|
||||||
|
?.external_person_id : '')}
|
||||||
readonly={!$ae_loc.administrator_access}
|
readonly={!$ae_loc.administrator_access}
|
||||||
class="input w-96"
|
class="input w-96"
|
||||||
>
|
>
|
||||||
@@ -738,7 +742,7 @@ $effect(() => {
|
|||||||
type="text"
|
type="text"
|
||||||
id="full_name"
|
id="full_name"
|
||||||
name="full_name"
|
name="full_name"
|
||||||
value={($idaa_slct.post_obj.full_name ? $idaa_slct.post_obj.full_name : $idaa_loc.novi_full_name)}
|
value={($idaa_slct.post_obj?.full_name ? $idaa_slct?.post_obj.full_name : $idaa_loc.novi_full_name)}
|
||||||
readonly={!$ae_loc.trusted_access}
|
readonly={!$ae_loc.trusted_access}
|
||||||
class="input w-96"
|
class="input w-96"
|
||||||
>
|
>
|
||||||
@@ -757,7 +761,7 @@ $effect(() => {
|
|||||||
<input
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
name="email"
|
name="email"
|
||||||
value={($idaa_slct.post_obj.email ? $idaa_slct.post_obj.email : $idaa_loc.novi_email ?? '')}
|
value={($idaa_slct.post_obj?.email ? $idaa_slct.post_obj?.email : $idaa_loc.novi_email ?? '')}
|
||||||
readonly={!$ae_loc.trusted_access}
|
readonly={!$ae_loc.trusted_access}
|
||||||
class="input w-96"
|
class="input w-96"
|
||||||
>
|
>
|
||||||
@@ -766,7 +770,7 @@ $effect(() => {
|
|||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
{:else}
|
{:else}
|
||||||
<input type="hidden" name="email" value={($idaa_slct.post_obj.email ? $idaa_slct.post_obj.email : $idaa_loc.novi_email ?? '')} />
|
<input type="hidden" name="email" value={($idaa_slct.post_obj?.email ? $idaa_slct.post_obj?.email : $idaa_loc.novi_email ?? '')} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<!-- A yes/no radio button group to determine if they want to be notified of comments on this post. -->
|
<!-- A yes/no radio button group to determine if they want to be notified of comments on this post. -->
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/** @type {import('./$types').LayoutLoad} */
|
/** @type {import('./$types').LayoutLoad} */
|
||||||
console.log(`ae_l_journals [journal_id] +layout.ts start`);
|
console.log(`ae_l_journals [journal_id] +layout.ts start`);
|
||||||
|
|
||||||
|
import { error } from '@sveltejs/kit';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ export async function load({ params, parent }) {
|
|||||||
console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, journal_id);
|
console.log(`ae_journals journals [journal_id] +page.ts: journal_id = `, journal_id);
|
||||||
}
|
}
|
||||||
// Load event journal object
|
// Load event journal object
|
||||||
let load_journal_obj = journals_func.load_ae_obj_id__journal({
|
let load_journal_obj = await journals_func.load_ae_obj_id__journal({
|
||||||
api_cfg: ae_acct.api,
|
api_cfg: ae_acct.api,
|
||||||
journal_id: journal_id,
|
journal_id: journal_id,
|
||||||
inc_entry_li: true,
|
inc_entry_li: true,
|
||||||
@@ -39,6 +40,21 @@ export async function load({ params, parent }) {
|
|||||||
limit: 99,
|
limit: 99,
|
||||||
try_cache: true,
|
try_cache: true,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
|
})
|
||||||
|
.then((results) => {
|
||||||
|
if (!results) {
|
||||||
|
error(404, {
|
||||||
|
message: 'Journals - Journal not found'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// ae_acct.slct.journal_obj = results;
|
||||||
|
}
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// console.error(`Error loading journal object:`, err);
|
||||||
|
// error(500, {
|
||||||
|
// message: 'Journals - Error loading journal object'
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
ae_acct.slct.journal_obj = load_journal_obj;
|
ae_acct.slct.journal_obj = load_journal_obj;
|
||||||
|
|||||||
@@ -34,14 +34,20 @@ export async function load({ params, parent }) { // route
|
|||||||
console.log(`ae_journals journals [journal_entry_id] +page.ts: journal_entry_id = `, journal_entry_id);
|
console.log(`ae_journals journals [journal_entry_id] +page.ts: journal_entry_id = `, journal_entry_id);
|
||||||
}
|
}
|
||||||
// Load event journal entry object
|
// Load event journal entry object
|
||||||
let load_journal_obj = journals_func.load_ae_obj_id__journal_entry({
|
let load_journal_entry_obj = journals_func.load_ae_obj_id__journal_entry({
|
||||||
api_cfg: ae_acct.api,
|
api_cfg: ae_acct.api,
|
||||||
journal_entry_id: journal_entry_id,
|
journal_entry_id: journal_entry_id,
|
||||||
try_cache: true,
|
try_cache: true,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
|
|
||||||
ae_acct.slct.journal_obj = load_journal_obj;
|
if (!load_journal_entry_obj) {
|
||||||
|
error(404, {
|
||||||
|
message: 'Journals - Journal Entry not found'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ae_acct.slct.journal_obj = load_journal_entry_obj;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARNING: Precaution against shared data between sites.
|
// WARNING: Precaution against shared data between sites.
|
||||||
|
|||||||
Reference in New Issue
Block a user