diff --git a/src/routes/journals/ae_comp__journal_obj_id_edit.svelte b/src/routes/journals/ae_comp__journal_obj_id_edit.svelte index d6b0ed7c..862eb0e0 100644 --- a/src/routes/journals/ae_comp__journal_obj_id_edit.svelte +++ b/src/routes/journals/ae_comp__journal_obj_id_edit.svelte @@ -92,7 +92,7 @@ } }); - async function handle_update_journal() { + async function handle_update_journal(close_modal: boolean = true) { if (!tmp__journal_obj.name || !tmp__journal_obj.type_code) { alert('Please provide both name and type for the journal.'); return; @@ -127,8 +127,7 @@ default_private: tmp__journal_obj.default_private, default_public: tmp__journal_obj.default_public, default_personal: tmp__journal_obj.default_personal, - default_professional: tmp__journal_obj.default_professional, - code: tmp__journal_obj.code + default_professional: tmp__journal_obj.default_professional }; await journals_func.update_ae_obj__journal({ @@ -137,10 +136,11 @@ data_kv: data_kv, log_lvl: log_lvl }); - show = false; + + if (close_modal) show = false; } catch (error) { console.error('Error updating journal:', error); - alert('Failed to update journal.'); + if (close_modal) alert('Failed to update journal.'); } } @@ -277,21 +277,21 @@
@@ -509,7 +509,7 @@ - diff --git a/src/routes/journals/modal_journal_entry_config.svelte b/src/routes/journals/modal_journal_entry_config.svelte index 36340138..1c2bf0fe 100644 --- a/src/routes/journals/modal_journal_entry_config.svelte +++ b/src/routes/journals/modal_journal_entry_config.svelte @@ -27,6 +27,7 @@ import { Modal } from 'flowbite-svelte'; import { ae_loc, ae_api } from '$lib/stores/ae_stores'; import { journals_loc, journals_sess } from '$lib/ae_journals/ae_journals_stores'; + import { journals_func } from '$lib/ae_journals/ae_journals_functions'; import E_app_codemirror_v5 from '$lib/app_components/e_app_codemirror_v5.svelte'; import AE_ObjectFlags from '$lib/ae_elements/AE_ObjectFlags.svelte'; @@ -59,6 +60,46 @@ let tab: 'actions' | 'meta' | 'security' | 'json' = $state('actions'); const normalize_date = (val: string | null) => val ? val.slice(0, 16) : null; + + async function handle_update_entry() { + try { + // WHITELISTED BASE TABLE COLUMNS ONLY + const data_kv = { + name: tmp_entry_obj.name, + short_name: tmp_entry_obj.short_name, + summary: tmp_entry_obj.summary, + content: tmp_entry_obj.content, + category_code: tmp_entry_obj.category_code, + type_code: tmp_entry_obj.type_code, + topic_code: tmp_entry_obj.topic_code, + tags: tmp_entry_obj.tags, + private: tmp_entry_obj.private, + public: tmp_entry_obj.public, + personal: tmp_entry_obj.personal, + professional: tmp_entry_obj.professional, + alert: tmp_entry_obj.alert, + alert_msg: tmp_entry_obj.alert_msg, + enable: tmp_entry_obj.enable, + hide: tmp_entry_obj.hide, + priority: tmp_entry_obj.priority, + sort: tmp_entry_obj.sort, + group: tmp_entry_obj.group, + notes: tmp_entry_obj.notes, + archive_on: tmp_entry_obj.archive_on, + template: tmp_entry_obj.template, + data_json: tmp_entry_obj.data_json + }; + + await journals_func.update_ae_obj__journal_entry({ + api_cfg: $ae_api, + journal_entry_id: tmp_entry_obj.journal_entry_id, + data_kv: data_kv, + log_lvl: log_lvl + }); + } catch (error) { + console.error('Error updating journal entry:', error); + } + } { tmp_entry_obj.category_code = cat.code; onSave(); }} + onclick={() => { tmp_entry_obj.category_code = cat.code; handle_update_entry(); onSave(); }} > {cat.name} @@ -130,7 +171,7 @@
@@ -167,25 +208,25 @@

- Status & Lifecycle + Status & Security

@@ -209,7 +250,7 @@

Privacy Flags

{ handle_update_entry(); onSave(); }} hideAlert={journal?.cfg_json?.hide_btn_alert} hidePrivate={journal?.cfg_json?.hide_btn_private} hidePublic={journal?.cfg_json?.hide_btn_public}