Now with the ability to clone template entries

This commit is contained in:
Scott Idem
2025-04-02 12:56:08 -04:00
parent 0e72d27dbd
commit b4f2be0f13
9 changed files with 184 additions and 189 deletions

View File

@@ -32,6 +32,9 @@ export async function load({ params, parent }) {
api_cfg: ae_acct.api,
journal_id: journal_id,
inc_entry_li: true,
enabled: 'enabled',
hidden: 'all', // 'not_hidden' to load only visible entries
limit: 99,
try_cache: true,
log_lvl: log_lvl
});

View File

@@ -65,104 +65,6 @@ let lq__journal_entry_obj = $derived(liveQuery(async () => {
return results;
}));
// let lq__journal_entry_obj_li = $derived(liveQuery(async () => {
// if (log_lvl) {
// console.log(`$lq__journal_entry_obj.cfg_json = `, $lq__journal_entry_obj?.cfg_json);
// }
// if ($lq__journal_entry_obj?.cfg_json?.entry_group_sort === 'DESC') {
// let results = await db_journals.journal_entry
// // .orderBy('updated_on')
// .where('journal_entry_id')
// .equals($journals_slct?.journal_entry_id ?? '') // null or undefined does not reset things like '' does
// .reverse()
// // .sortBy('tmp_sort_2');
// .sortBy('updated_on');
// // .sortBy('title');
// return results;
// } else {
// console.log(`lq__journal_entry_obj_li - default query using journal_entry_id: ${$journals_slct?.journal_entry_id}`);
// let results = await db_journals.journal_entry
// .where('journal_entry_id')
// .equals($journals_slct?.journal_entry_id ?? '') // null or undefined does not reset things like '' does
// // .reverse()
// .sortBy('updated_on');
// return results;
// }
// }));
// let lq__journal_entry_obj = $derived(liveQuery(async () => {
// if (log_lvl) {
// console.log(`lq__journal_entry_obj: journal_entry_id = ${$journals_slct?.journal_entry_id}`);
// }
// if ($journals_slct.journal_entry_id) {
// let results = await db_journals.journal_entry
// .get($journals_slct.journal_entry_id); // null or undefined does not reset things like '' does
// return results;
// }
// // const results = await db_journals.journal_entry
// // .get($journals_slct.journal_entry_id); // null or undefined does not reset things like '' does
// // return results;
// }));
$effect(() => {
// if ($journals_trig.journal_entry_li) {
// $journals_trig.journal_entry_li = false;
// if (log_lvl) {
// console.log(`Triggered: $journals_trig.journal_entry_li`);
// }
// if ($journals_loc.qry__enabled !== 'all' || $journals_loc.qry__hidden !== 'all') {
// console.log(`Deleting disabled or hidden journal entry.`);
// // let results = db_journals.journal_entry
// // .where('enable')
// // .notEqual(true)
// // .delete();
// let results = db_journals.journal_entry
// .clear();
// console.log(`Deleted ${results} disabled journal entry.`);
// }
// if ($journals_loc.qry__hidden !== 'all') {
// console.log(`Deleting hidden journal entry.`);
// let results = db_journals.journal_entry
// .clear();
// console.log(`Deleted ${results} hidden journal entry.`);
// }
// let results = db_journals.journal_entry
// .where('enable')
// .equals('false')
// .delete();
// console.log(`Deleted ${results} disabled journal entry.`);
// $journals_prom.load__journal_entry_obj_li = journals_func.load_ae_obj_li__journal_entry({
// api_cfg: $ae_api,
// for_obj_type: 'journal',
// for_obj_id: $journals_slct.journal_entry_id,
// enabled: $journals_loc.qry__enabled,
// hidden: $journals_loc.qry__hidden,
// limit: $journals_loc.qry__limit,
// order_by_li: $journals_loc.qry__order_by_li,
// try_cache: true,
// log_lvl: log_lvl,
// });
// }
});
if (browser) {
// console.log('Browser environment detected.');
// let message = {'journal_entry_id': $journals_slct?.journal_entry_id ?? null};
// window.parent.postMessage(message, "*");
}
</script>