Work on making the Entry search query work correctly. Moved things around. Hopefully easier to read and understand.

This commit is contained in:
Scott Idem
2025-08-21 18:00:32 -04:00
parent 33c6cb862e
commit 6d2c3cb056
5 changed files with 1566 additions and 1389 deletions

View File

@@ -1,5 +1,15 @@
<script lang="ts">
let log_lvl: number = 0;
interface Props {
log_lvl?: number;
lq__journal_obj: any;
lq__journal_entry_obj_li: any;
}
let {
log_lvl = $bindable(0),
lq__journal_obj,
lq__journal_entry_obj_li
}: Props = $props();
// *** Import Svelte specific
import { goto, invalidate, pushState, replaceState } from '$app/navigation';
@@ -26,12 +36,6 @@ import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$
import { journals_loc, journals_sess, journals_slct, journals_trig } from '$lib/ae_journals/ae_journals_stores';
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
interface Props {
lq__journal_obj: any;
lq__journal_entry_obj_li: any;
}
let { lq__journal_obj, lq__journal_entry_obj_li }: Props = $props();
let ae_promises: key_val = $state({});
// let ae_tmp: key_val = {};
@@ -53,52 +57,6 @@ $effect(() => {
}
});
// async function update_journal_entry(journal_entry_id) {
// if (!$ae_loc.trusted_access) {
// alert('You do not have permission to update this journal entry.');
// return;
// }
// let data_kv = {
// alert: tmp_entry_obj?.alert,
// personal: tmp_entry_obj?.personal,
// private: tmp_entry_obj?.private,
// professional: tmp_entry_obj?.professional,
// public: tmp_entry_obj?.public,
// template: tmp_entry_obj?.template,
// hide: tmp_entry_obj?.hide,
// priority: tmp_entry_obj?.priority,
// enable: tmp_entry_obj?.enable,
// // alert_msg: $lq__journal_entry_obj?.alert_msg ? false : true
// alert_msg: tmp_entry_obj?.alert_msg,
// category_code: tmp_entry_obj?.category_code,
// content: tmp_entry_obj?.content,
// group: tmp_entry_obj?.group,
// name: tmp_entry_obj?.name,
// tags: tmp_entry_obj?.tags,
// };
// // Call API to save the content
// try {
// await journals_func.update_ae_obj__journal_entry({
// api_cfg: $ae_api,
// journal_entry_id: journal_entry_id,
// data_kv: data_kv,
// log_lvl: 0,
// });
// // updated_obj = true;
// // updated_idb = false;
// console.log('Journal entry updated successfully!');
// } catch (error) {
// console.error('Error updating journal entry:', error);
// alert('Failed to update journal entry.');
// }
// }
</script>
@@ -117,7 +75,7 @@ $effect(() => {
<div
class="
container journal journal_entry_obj
border border
border
px-2 py-1 space-y-1
w-full max-w-(--breakpoint-lg)
flex flex-col items-center justify-center
@@ -407,9 +365,9 @@ $effect(() => {
{/if}
<a
href="/journals/{journals_journal_entry_obj?.journal_id}/entry/{journals_journal_entry_obj?.journal_entry_id}"
href="/journals/{journals_journal_entry_obj?.journal_id ?? $lq__journal_obj?.journal_id}/entry/{journals_journal_entry_obj?.journal_entry_id}"
class="btn preset-tonal-primary border border-primary-500 hover:preset-filled-primary-500 transition"
title={`View ID: ${journals_journal_entry_obj?.id}\n${journals_journal_entry_obj?.name ?? ae_util.iso_datetime_formatter(journals_journal_entry_obj.created_on, 'datetime_iso_12_no_seconds')}`}
title={`View ID: ${journals_journal_entry_obj?.id}\n${journals_journal_entry_obj?.name ?? ae_util.iso_datetime_formatter(journals_journal_entry_obj.created_on, 'datetime_iso_12_no_seconds')}\nJournal ID: ${journals_journal_entry_obj?.journal_id}\n`}
>
<NotebookPen class="mx-1 inline-block"/>
<span class="hidden md:inline">
@@ -478,34 +436,6 @@ $effect(() => {
</article>
{/if}
<!-- <div class="ae_options flex flex-row flex-wrap gap-2 items-center justify-center"> -->
<!-- <a
href="/journals/{journals_journal_entry_obj?.journal_id}/entry/{journals_journal_entry_obj?.journal_entry_id}"
class="btn btn-secondary btn-md variant-ghost-primary hover:variant-filled-primary transition"
title={`View: ${journals_journal_entry_obj?.name}`}
>
<NotebookText class="m-1"/> View
</a> -->
<!-- {#if $ae_loc.trusted_access && $ae_loc.edit_mode}
<button
type="button"
disabled={!$ae_loc.trusted_access}
onclick={() => {
$journals_slct.journal_entry_id = journals_journal_entry_obj.journal_entry_id;
$journals_slct.journal_entry_obj = journals_journal_entry_obj;
$journals_sess.show__modal_view__journal_entry_id = false;
$journals_sess.show__modal_edit__journal_entry_id = $journals_slct.journal_entry_id;
}}
class="novi_btn btn btn-sm variant-glass-warning hover:variant-filled-warning transition"
title={`Edit journal entry: ${journals_journal_entry_obj?.name}`}
>
<span class="fas fa-edit m-1"></span> Edit
</button>
{/if} -->
<!-- </div> -->
<section
class:hidden={!journals_journal_entry_obj?.original_datetime && !journals_journal_entry_obj?.original_timezone}