Now with the ability to clone template entries
This commit is contained in:
@@ -14,12 +14,24 @@ export async function load_ae_obj_id__journal(
|
||||
api_cfg,
|
||||
journal_id,
|
||||
inc_entry_li = false,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
journal_id: string,
|
||||
inc_entry_li?: boolean,
|
||||
enabled?: string, // all, disabled, enabled
|
||||
hidden?: string, // all, hidden, not_hidden
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
order_by_li?: key_val, // Order by fields for the journal entries
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
@@ -28,8 +40,6 @@ export async function load_ae_obj_id__journal(
|
||||
console.log(`*** load_ae_obj_id__journal() *** journal_id=${journal_id}`);
|
||||
}
|
||||
|
||||
let params = {};
|
||||
|
||||
ae_promises.load__journal_obj = await api.get_ae_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'journal',
|
||||
@@ -72,7 +82,12 @@ export async function load_ae_obj_id__journal(
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'journal',
|
||||
for_obj_id: journal_id,
|
||||
params: {qry__enabled: 'all', qry__limit: 99},
|
||||
enabled: enabled, // all, disabled, enabled
|
||||
hidden: hidden, // all, hidden, not_hidden
|
||||
limit: limit, // Limit for the entries
|
||||
offset: offset,
|
||||
order_by_li: order_by_li,
|
||||
params: params,
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
@@ -180,6 +195,11 @@ export async function load_ae_obj_li__journal(
|
||||
api_cfg: api_cfg,
|
||||
for_obj_type: 'journal',
|
||||
for_obj_id: journal_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
order_by_li: order_by_li,
|
||||
params: params,
|
||||
try_cache: try_cache,
|
||||
log_lvl: log_lvl
|
||||
@@ -532,6 +552,7 @@ export function db_save_ae_obj_li__journal(
|
||||
person_id: obj.person_id_random,
|
||||
|
||||
name: obj.name,
|
||||
short_name: obj.short_name,
|
||||
summary: obj.summary,
|
||||
outline: obj.outline,
|
||||
|
||||
@@ -549,9 +570,9 @@ export function db_save_ae_obj_li__journal(
|
||||
sort_by: obj.sort_by,
|
||||
sort_by_desc: obj.sort_by_desc,
|
||||
|
||||
cfg_json: obj.cfg_json,
|
||||
cfg_json: obj.cfg_json ?? {},
|
||||
|
||||
data_json: obj.data_json,
|
||||
data_json: obj.data_json ?? {},
|
||||
|
||||
// ux_mode: obj.ux_mode,
|
||||
|
||||
|
||||
@@ -357,6 +357,8 @@ export async function db_save_ae_obj_li__journal_entry(
|
||||
|
||||
person_id: obj.person_id_random,
|
||||
|
||||
template: obj.template ?? null, // Allow for a template to be used, otherwise null
|
||||
|
||||
activity_code: obj.activity_code,
|
||||
category_code: obj.category_code,
|
||||
type_code: obj.type_code,
|
||||
@@ -369,6 +371,7 @@ export async function db_save_ae_obj_li__journal_entry(
|
||||
professional: obj.professional,
|
||||
|
||||
name: obj.name,
|
||||
short_name: obj.short_name ?? null,
|
||||
summary: obj.summary,
|
||||
outline: obj.outline,
|
||||
// description: obj.description,
|
||||
@@ -403,8 +406,8 @@ export async function db_save_ae_obj_li__journal_entry(
|
||||
alert: obj.alert,
|
||||
alert_msg: obj.alert_msg,
|
||||
|
||||
// cfg_json: obj.cfg_json,
|
||||
data_json: obj.data_json,
|
||||
// cfg_json: obj.cfg_json ?? {},
|
||||
data_json: obj.data_json ?? {},
|
||||
|
||||
// This only allows for basic access to the data.
|
||||
// passcode_read: obj.passcode_read, // For LLM (AI) generated summary...???
|
||||
|
||||
@@ -26,6 +26,8 @@ export interface Journal {
|
||||
for_type?: null|string;
|
||||
for_id?: null|string;
|
||||
|
||||
// template?: null|boolean; // Is this a template journal? If true, it can be used to create new journals.
|
||||
|
||||
type_code?: null|string;
|
||||
|
||||
account_id?: null|string; // Owner account of the journal
|
||||
@@ -34,6 +36,7 @@ export interface Journal {
|
||||
// location_id?: null|string; // Assign to a location???
|
||||
|
||||
name: string; // or the title
|
||||
short_name?: null|string; // Short name for the journal, if any. Used for display purposes.
|
||||
summary?: null|string; // LLM (AI) generated summary...???
|
||||
outline?: null|string; // LLM (AI) generated outline...???
|
||||
|
||||
@@ -136,7 +139,7 @@ export interface Journal_Entry {
|
||||
id: string; // actually "id_random"
|
||||
journal_entry_id: string;
|
||||
|
||||
journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries.
|
||||
// journal_id: string; // This is the parent journal ID. If deleted, then delete all children journal entries.
|
||||
|
||||
// Essentially this is a change log of journal entries
|
||||
snapshot_id?: string; // This is the original journal ID. If deleted, then delete all children journal entries.
|
||||
@@ -150,6 +153,8 @@ export interface Journal_Entry {
|
||||
for_type?: null|string;
|
||||
for_id?: null|string;
|
||||
|
||||
template?: null|boolean; // Is this a template journal entry? If true, it can be used to create new journal entries.
|
||||
|
||||
activity_code?: null|string;
|
||||
category_code?: null|string;
|
||||
topic_code?: null|string;
|
||||
@@ -169,6 +174,7 @@ export interface Journal_Entry {
|
||||
professional?: null|boolean;
|
||||
|
||||
name: string; // or the title
|
||||
short_name?: null|string; // Short name for the journal entry, if any. Used for display purposes. Most likely for the templates list.
|
||||
summary?: null|string; // LLM (AI) generated summary...???
|
||||
outline?: null|string; // LLM (AI) generated outline...???
|
||||
// description?: null|string; // This is the description of the journal entry
|
||||
@@ -294,6 +300,7 @@ export class MySubClassedDexie extends Dexie {
|
||||
journal_id,
|
||||
code,
|
||||
account_id,
|
||||
template,
|
||||
name,
|
||||
start_datetime, end_datetime,
|
||||
timezone,
|
||||
|
||||
@@ -23,48 +23,6 @@ export async function load({ params, parent }) {
|
||||
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},
|
||||
|
||||
@@ -28,6 +28,7 @@ export async function load({ parent }) {
|
||||
let load_journal_obj_li = journals_func.load_ae_obj_id__journal({
|
||||
api_cfg: ae_acct.api,
|
||||
journal_id: journal_id,
|
||||
hidden: 'all', // 'not_hidden' to load only visible entries
|
||||
// params: ae_params,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl
|
||||
@@ -40,7 +41,7 @@ export async function load({ parent }) {
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: account_id,
|
||||
inc_entry_li: true,
|
||||
hidden: 'not_hidden',
|
||||
hidden: 'all', // 'not_hidden'
|
||||
enabled: 'enabled',
|
||||
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
limit: 25,
|
||||
|
||||
@@ -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
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
Flag, FlagOff, FileX, Fingerprint,
|
||||
Globe, Group,
|
||||
MessageSquareWarning, Minus,
|
||||
NotebookPen, NotebookText,
|
||||
NotebookPen, NotebookText, NotepadTextDashed,
|
||||
Pencil, Plus,
|
||||
RemoveFormatting,
|
||||
Search,
|
||||
@@ -563,6 +563,45 @@ $effect(() => {
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<!-- Toggle if entry should be used as a template entry (cloneable). Only visible in edit_mode. -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
if ($ae_loc.trusted_access) {
|
||||
let data_kv = {
|
||||
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,
|
||||
|
||||
template: $lq__journal_entry_obj?.template ? false : true
|
||||
};
|
||||
journals_func.update_ae_obj__journal_entry({
|
||||
api_cfg: $ae_api,
|
||||
journal_entry_id: $lq__journal_entry_obj?.journal_entry_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl
|
||||
}).then(() => {
|
||||
// Optionally, you can provide feedback to the user
|
||||
// alert('Journal entry updated successfully!');
|
||||
}).catch((error) => {
|
||||
console.error('Error updating journal entry:', error);
|
||||
alert('Failed to update journal entry.');
|
||||
});
|
||||
}
|
||||
}}
|
||||
class="btn-icon-sm"
|
||||
title="Toggle template visibility of this journal entry"
|
||||
>
|
||||
{#if $lq__journal_entry_obj?.template}
|
||||
<NotepadTextDashed strokeWidth="2.5" color="green" />
|
||||
{:else}
|
||||
<NotepadTextDashed strokeWidth="1" color="gray" />
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<!-- <button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
CalendarClock, CodeXml, Copy,
|
||||
Eye, EyeOff,
|
||||
Flag, FlagOff,
|
||||
NotebookPen, NotebookText,
|
||||
NotebookPen, NotebookText, NotepadTextDashed,
|
||||
RemoveFormatting,
|
||||
Shapes, Siren,
|
||||
Tags
|
||||
@@ -68,11 +68,14 @@ let tmp_entry_obj: key_val = $state({});
|
||||
{#if (journals_journal_entry_obj.priority)}
|
||||
<Flag class="mx-1 inline-block text-yellow-500"/>
|
||||
{/if}
|
||||
{#if (journals_journal_entry_obj.name)}
|
||||
<NotebookText class="mx-1 inline-block"/>
|
||||
{#if journals_journal_entry_obj.template}
|
||||
<NotepadTextDashed class="mx-1 inline-block" />
|
||||
{@html journals_journal_entry_obj.name ?? '-- no name --'}
|
||||
{:else if (journals_journal_entry_obj.name)}
|
||||
<NotebookText class="mx-1 inline-block" />
|
||||
{@html journals_journal_entry_obj.name}
|
||||
{:else}
|
||||
<CalendarClock class="mx-1 inline-block"/>
|
||||
<CalendarClock class="mx-1 inline-block" />
|
||||
{ae_util.iso_datetime_formatter(journals_journal_entry_obj.created_on, 'datetime_iso_12_no_seconds')}
|
||||
{/if}
|
||||
</span>
|
||||
@@ -91,6 +94,7 @@ let tmp_entry_obj: key_val = $state({});
|
||||
alert('Failed to copy content.');
|
||||
});
|
||||
}}
|
||||
class:hidden={journals_journal_entry_obj.template}
|
||||
class="btn btn-sm p-1 variant-soft-secondary hover:variant-filled-secondary *:hover:inline lg:text-xs"
|
||||
title="Copy the markdown content"
|
||||
>
|
||||
@@ -117,6 +121,7 @@ let tmp_entry_obj: key_val = $state({});
|
||||
alert('Failed to copy HTML content.');
|
||||
});
|
||||
}}
|
||||
class:hidden={journals_journal_entry_obj.template}
|
||||
class="btn btn-sm p-1 variant-soft-secondary hover:variant-filled-secondary *:hover:inline lg:text-xs"
|
||||
title="Copy the rendered HTML content"
|
||||
>
|
||||
@@ -127,6 +132,58 @@ let tmp_entry_obj: key_val = $state({});
|
||||
Copy Rendered HTML
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<!-- Clone entry -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
// Clone the journal entry
|
||||
// let data_kv = {
|
||||
// ...journals_journal_entry_obj,
|
||||
// };
|
||||
// // Remove specific fields that should not be cloned
|
||||
// delete data_kv.journal_entry_id;
|
||||
// delete data_kv.id; // Ensure we do not copy the ID
|
||||
// delete data_kv.template;
|
||||
// delete data_kv.notes;
|
||||
// delete data_kv.created_on;
|
||||
// delete data_kv.updated_on;
|
||||
|
||||
// We only want to clone certain fields from the original journal entry object to avoid conflicts.
|
||||
let data_kv = {
|
||||
// journal_id_random: journals_journal_entry_obj.journal_id,
|
||||
code: journals_journal_entry_obj.code,
|
||||
category_code: journals_journal_entry_obj.category_code,
|
||||
name: journals_journal_entry_obj.name,
|
||||
short_name: journals_journal_entry_obj.short_name,
|
||||
content: journals_journal_entry_obj.content,
|
||||
description: journals_journal_entry_obj.description,
|
||||
tags: journals_journal_entry_obj.tags,
|
||||
|
||||
};
|
||||
|
||||
journals_func.create_ae_obj__journal_entry({
|
||||
api_cfg: $ae_api,
|
||||
journal_id: journals_journal_entry_obj.journal_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl,
|
||||
}).then((result) => {
|
||||
alert('Journal entry cloned successfully!');
|
||||
goto(`/journals/${result.journal_id_random}/entry/${result.journal_entry_id_random}`);
|
||||
}).catch((error) => {
|
||||
console.error('Error cloning journal entry:', error);
|
||||
alert('Failed to clone journal entry.');
|
||||
});
|
||||
}}
|
||||
class:hidden={!journals_journal_entry_obj.template}
|
||||
class="btn btn-sm p-1 variant-soft-secondary hover:variant-filled-secondary *:hover:inline lg:text-xs"
|
||||
title="Clone this journal entry"
|
||||
>
|
||||
<!-- class="btn btn-sm variant-soft-surface hover:variant-filled-warning transition py-1 px-2" -->
|
||||
<!-- <Copy strokeWidth="1" /> -->
|
||||
<Copy size="2em" />
|
||||
<span class="hidden md:inline">Clone</span>
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<div class="flex flex-row flex-wrap gap-2 items-center justify-end">
|
||||
@@ -273,7 +330,6 @@ let tmp_entry_obj: key_val = $state({});
|
||||
|
||||
<section
|
||||
class="ae_meta mt-2 flex flex-col sm:flex-row gap-2 items-center justify-center text-xs text-gray-500"
|
||||
class:hidden={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||
>
|
||||
<!-- <span
|
||||
class="journal_entry__journal_entry_type"
|
||||
@@ -281,7 +337,10 @@ let tmp_entry_obj: key_val = $state({});
|
||||
>
|
||||
Type: {journals_journal_entry_obj.journal_entry_type}
|
||||
</span> -->
|
||||
<span class="flex flex-row gap-1 items-center justify-center">
|
||||
<span
|
||||
class:hidden={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||
class="flex flex-row gap-1 items-center justify-center"
|
||||
>
|
||||
<span
|
||||
class="journal_entry__created_on"
|
||||
>
|
||||
@@ -298,39 +357,41 @@ let tmp_entry_obj: key_val = $state({});
|
||||
</span>
|
||||
|
||||
<!-- Set/unset hide (boolean) -->
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
let data_kv = {
|
||||
hide: journals_journal_entry_obj?.hide ? false : true
|
||||
};
|
||||
journals_func.update_ae_obj__journal_entry({
|
||||
api_cfg: $ae_api,
|
||||
journal_entry_id: journals_journal_entry_obj.journal_entry_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl,
|
||||
}).then(() => {
|
||||
// Optionally, you can provide feedback to the user
|
||||
// alert('Journal entry updated successfully!');
|
||||
}).catch((error) => {
|
||||
console.error('Error updating journal entry:', error);
|
||||
alert('Failed to update journal entry.');
|
||||
});
|
||||
}}
|
||||
class:hidden={!$ae_loc.edit_mode}
|
||||
class="btn btn-sm variant-soft-surface hover:variant-filled-warning transition py-1 px-2"
|
||||
title={`Set entry as ${journals_journal_entry_obj.hide ? 'visible' : 'hidden'}`}
|
||||
>
|
||||
{#if journals_journal_entry_obj.hide}
|
||||
<EyeOff strokeWidth="1" color="hsla( 0, 100%, 50%, .5)"
|
||||
class="inline-block" />
|
||||
<span class="hidden md:inline">Hidden</span>
|
||||
{:else}
|
||||
<Eye strokeWidth="2.5" color="hsla( 120, 100%, 25%, .5)"
|
||||
class="inline-block" />
|
||||
<span class="hidden lg:inline">Visible</span>
|
||||
{/if}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
let data_kv = {
|
||||
hide: journals_journal_entry_obj?.hide ? false : true
|
||||
};
|
||||
journals_func.update_ae_obj__journal_entry({
|
||||
api_cfg: $ae_api,
|
||||
journal_entry_id: journals_journal_entry_obj.journal_entry_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl,
|
||||
}).then(() => {
|
||||
// Optionally, you can provide feedback to the user
|
||||
// alert('Journal entry updated successfully!');
|
||||
}).catch((error) => {
|
||||
console.error('Error updating journal entry:', error);
|
||||
alert('Failed to update journal entry.');
|
||||
});
|
||||
}}
|
||||
class:hidden={!$ae_loc.edit_mode}
|
||||
class="btn btn-sm variant-soft-surface hover:variant-filled-warning transition py-1 px-2"
|
||||
title={`Set entry as ${journals_journal_entry_obj.hide ? 'visible' : 'hidden'}`}
|
||||
>
|
||||
{#if journals_journal_entry_obj.hide}
|
||||
<EyeOff strokeWidth="1" color="hsla( 0, 100%, 50%, .5)"
|
||||
class="inline-block" />
|
||||
<span class="hidden md:inline">Hidden</span>
|
||||
{:else}
|
||||
<Eye strokeWidth="2.5" color="hsla( 120, 100%, 25%, .5)"
|
||||
class="inline-block" />
|
||||
<span class="hidden lg:inline">Visible</span>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user