Normalize journal entry config actions

This commit is contained in:
Scott Idem
2026-05-05 12:59:30 -04:00
parent 0d0cec9819
commit 80957316f2
3 changed files with 387 additions and 221 deletions

View File

@@ -177,6 +177,25 @@ async function load_ae_obj_id__my_obj({ api_cfg, obj_id }) {
}
```
### Shared/Common Aether object fields
The core fields for almost all Aether objects are:
* id/id_random
* code - string
* name - string
* summary - string
* content - string
* alert - boolean
* alert_msg - text
* priority - boolean
* sort - int
* group - string
* hide - boolean
* enable - boolean
* default_qry_str - special concat string index
* notes - text
* created_on - timestamp
* updated_on - timestamp
### ID convention — never use `_id_random` fields
The V3 API uses random string IDs (e.g. `event_file_id = "aBc123"`). The `*_id_random`
fields are legacy aliases. The integer version of the ID is never returned by the API. Always use the short form:
@@ -229,7 +248,7 @@ When looking up a single object by its string ID, always use `.where().equals().
---
## 6. Naming Conventions
## 6. Naming Conventions (snake_case; no camelCase)
| Pattern | Example | Used for |
|---|---|---|

View File

@@ -6,7 +6,6 @@
*/
import {
Siren,
MessageSquareWarning,
Fingerprint,
Globe,
BookHeart,
@@ -15,10 +14,11 @@ import {
Settings
} from '@lucide/svelte';
import { ae_loc } from '$lib/stores/ae_stores';
import type { ae_JournalEntry } from '$lib/types/ae_types';
interface Props {
// The object containing the flags (bindable)
obj: any;
obj: ae_JournalEntry;
// Visibility configuration (optional overrides)
show_labels?: boolean;
@@ -49,9 +49,38 @@ let {
container_class = 'flex flex-row flex-wrap gap-1 items-center justify-evenly py-2 border-y border-surface-500/10'
}: Props = $props();
function handle_toggle(prop: string) {
obj[prop] = !obj[prop];
if (onToggle) onToggle(prop, obj[prop]);
function emit_toggle(prop: string, value: boolean) {
if (onToggle) onToggle(prop, value);
}
function toggle_alert() {
obj.alert = !obj.alert;
emit_toggle('alert', !!obj.alert);
}
function toggle_private() {
obj.private = !obj.private;
emit_toggle('private', !!obj.private);
}
function toggle_public() {
obj.public = !obj.public;
emit_toggle('public', !!obj.public);
}
function toggle_personal() {
obj.personal = !obj.personal;
emit_toggle('personal', !!obj.personal);
}
function toggle_professional() {
obj.professional = !obj.professional;
emit_toggle('professional', !!obj.professional);
}
function toggle_template() {
obj.template = !obj.template;
emit_toggle('template', !!obj.template);
}
</script>
@@ -63,81 +92,69 @@ function handle_toggle(prop: string) {
</span>
{/if}
<!-- Alert Status -->
{#if !hide_alert}
<button
type="button"
onclick={() => handle_toggle('alert')}
class="btn-icon btn-icon-sm preset-tonal-secondary hover:preset-filled-secondary-500 transition"
title="Toggle Alert Status">
<Siren
size="1.2em"
class={obj?.alert ? 'text-error-500' : 'opacity-40'} />
onclick={toggle_alert}
class="btn btn-sm flex items-center gap-2 px-3 transition preset-tonal-secondary hover:preset-filled-secondary-500"
title="Toggle alert status">
<Siren size="1.2em" class={obj?.alert ? 'text-error-500' : 'opacity-40'} />
<span class="whitespace-nowrap text-[10px] font-bold uppercase tracking-wider">Alert</span>
</button>
{/if}
<!-- Private / E2EE -->
{#if !hide_private}
<button
type="button"
onclick={() => handle_toggle('private')}
class="btn-icon btn-icon-sm preset-tonal-secondary hover:preset-filled-secondary-500 transition"
title="Toggle Private/Encrypted">
<Fingerprint
size="1.2em"
class={obj?.private ? 'text-success-500' : 'opacity-40'} />
onclick={toggle_private}
class="btn btn-sm flex items-center gap-2 px-3 transition preset-tonal-secondary hover:preset-filled-secondary-500"
title="Toggle private or encrypted visibility">
<Fingerprint size="1.2em" class={obj?.private ? 'text-success-500' : 'opacity-40'} />
<span class="whitespace-nowrap text-[10px] font-bold uppercase tracking-wider">Private</span>
</button>
{/if}
<!-- Public Visibility -->
{#if !hide_public}
<button
type="button"
onclick={() => handle_toggle('public')}
class="btn-icon btn-icon-sm preset-tonal-secondary hover:preset-filled-secondary-500 transition"
title="Toggle Public Visibility">
<Globe
size="1.2em"
class={obj?.public ? 'text-success-500' : 'opacity-40'} />
onclick={toggle_public}
class="btn btn-sm flex items-center gap-2 px-3 transition preset-tonal-secondary hover:preset-filled-secondary-500"
title="Toggle public visibility">
<Globe size="1.2em" class={obj?.public ? 'text-success-500' : 'opacity-40'} />
<span class="whitespace-nowrap text-[10px] font-bold uppercase tracking-wider">Public</span>
</button>
{/if}
<!-- Personal Scope -->
{#if !hide_personal}
<button
type="button"
onclick={() => handle_toggle('personal')}
class="btn-icon btn-icon-sm preset-tonal-secondary hover:preset-filled-secondary-500 transition"
title="Toggle Personal Scope">
<BookHeart
size="1.2em"
class={obj?.personal ? 'text-success-500' : 'opacity-40'} />
onclick={toggle_personal}
class="btn btn-sm flex items-center gap-2 px-3 transition preset-tonal-secondary hover:preset-filled-secondary-500"
title="Toggle personal scope">
<BookHeart size="1.2em" class={obj?.personal ? 'text-success-500' : 'opacity-40'} />
<span class="whitespace-nowrap text-[10px] font-bold uppercase tracking-wider">Personal</span>
</button>
{/if}
<!-- Professional Scope -->
{#if !hide_professional}
<button
type="button"
onclick={() => handle_toggle('professional')}
class="btn-icon btn-icon-sm preset-tonal-secondary hover:preset-filled-secondary-500 transition"
title="Toggle Professional Scope">
<BriefcaseBusiness
size="1.2em"
class={obj?.professional ? 'text-success-500' : 'opacity-40'} />
onclick={toggle_professional}
class="btn btn-sm flex items-center gap-2 px-3 transition preset-tonal-secondary hover:preset-filled-secondary-500"
title="Toggle professional scope">
<BriefcaseBusiness size="1.2em" class={obj?.professional ? 'text-success-500' : 'opacity-40'} />
<span class="whitespace-nowrap text-[10px] font-bold uppercase tracking-wider">Professional</span>
</button>
{/if}
<!-- Template Status -->
{#if !hide_template && $ae_loc.edit_mode}
<button
type="button"
onclick={() => handle_toggle('template')}
class="btn-icon btn-icon-sm preset-tonal-secondary hover:preset-filled-secondary-500 transition"
title="Toggle Template Mode">
<NotepadTextDashed
size="1.2em"
class={obj?.template ? 'text-success-500' : 'opacity-40'} />
onclick={toggle_template}
class="btn btn-sm flex items-center gap-2 px-3 transition preset-tonal-secondary hover:preset-filled-secondary-500"
title="Toggle template mode">
<NotepadTextDashed size="1.2em" class={obj?.template ? 'text-success-500' : 'opacity-40'} />
<span class="whitespace-nowrap text-[10px] font-bold uppercase tracking-wider">Template</span>
</button>
{/if}
</div>

View File

@@ -7,10 +7,9 @@ import {
ArrowDownToLine,
ArrowUpToLine,
Check,
Clock,
CircleAlert,
CodeXml,
Copy,
Database,
FileDown,
Fingerprint,
Minus,
@@ -24,22 +23,19 @@ import {
X,
Zap
} from '@lucide/svelte';
import { goto } from '$app/navigation';
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 AE_Comp_Editor_CodeMirror from '$lib/elements/element_editor_codemirror.svelte';
import AE_Object_Flags from '$lib/ae_elements/AE_Object_Flags.svelte';
import type { ae_Journal, ae_JournalEntry } from '$lib/types/ae_types';
interface Props {
log_lvl?: number;
show?: boolean;
entry: any;
journal: any;
tmp_entry_obj: any; // Bindable
journal: ae_Journal;
tmp_entry_obj: ae_JournalEntry; // Bindable
on_save: () => void;
on_force_reset?: () => void;
on_show_export?: () => void;
@@ -50,7 +46,6 @@ interface Props {
let {
log_lvl = $bindable(0),
show = $bindable(false),
entry,
journal,
tmp_entry_obj = $bindable(),
on_save,
@@ -62,7 +57,15 @@ let {
let tab: 'actions' | 'meta' | 'security' | 'json' = $state('actions');
const normalize_date = (val: string | null) => (val ? val.slice(0, 16) : null);
const normalize_date = (val?: string | Date | null) => {
if (!val) return null;
if (val instanceof Date) return val.toISOString().slice(0, 16);
return val.slice(0, 16);
};
const panel_class = 'space-y-4 rounded-xl border border-surface-500/20 bg-surface-500/5 p-4 shadow-sm';
const panel_title_class = 'flex items-center gap-2 border-b border-surface-500/20 pb-2 text-lg font-bold';
const field_card_class = 'bg-surface-500/5 border-surface-500/10 flex cursor-pointer items-center space-x-3 rounded-lg border p-3 transition-colors hover:bg-surface-500/10';
async function handle_update_entry() {
try {
@@ -103,6 +106,32 @@ async function handle_update_entry() {
console.error('Error updating journal entry:', error);
}
}
async function handle_admin_delete_action() {
const can_delete = $ae_loc.manager_access || $ae_loc.administrator_access;
const delete_method = can_delete ? 'delete' : 'disable';
const action_label = can_delete ? 'delete' : 'remove';
const confirm_label = can_delete ? 'delete' : 'remove';
if (!confirm(`Are you sure you want to ${confirm_label} this journal entry?`)) {
return;
}
try {
await journals_func.delete_ae_obj_id__journal_entry({
api_cfg: $ae_api,
journal_entry_id: tmp_entry_obj.journal_entry_id,
method: delete_method,
log_lvl
});
show = false;
await goto(`/journals/${tmp_entry_obj.journal_id}`);
} catch (error) {
console.error(`Error attempting to ${action_label} journal entry:`, error);
alert(`Failed to ${action_label} journal entry.`);
}
}
</script>
<Modal
@@ -111,9 +140,9 @@ async function handle_update_entry() {
dismissable={false}
placement="top-center"
size="lg"
class="relative mx-auto flex w-full flex-col rounded-lg border border-orange-300 bg-white text-gray-800 shadow-xl dark:border-orange-700 dark:bg-gray-800 dark:text-gray-200"
headerClass="flex flex-row gap-2 items-center justify-between w-full bg-orange-100 dark:bg-orange-900 p-4 rounded-t-lg border-b border-orange-200 dark:border-orange-800"
footerClass="flex flex-row gap-2 items-center justify-center w-full bg-orange-100 dark:bg-orange-900 p-4 rounded-b-lg border-t border-orange-200 dark:border-orange-800">
class="relative mx-auto flex h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] w-full flex-col rounded-xl border border-surface-200-800 bg-surface-50-900 text-surface-950-50 shadow-xl"
headerClass="flex w-full flex-row items-center justify-between gap-2 rounded-t-xl border-b border-surface-200-800 bg-surface-100-900 p-4"
footerClass="flex w-full flex-row items-center justify-center gap-2 rounded-b-xl border-t border-surface-200-800 bg-surface-100-900 p-4">
{#snippet header()}
<h3 class="flex flex-1 items-center gap-2 text-lg font-bold">
<Settings class="text-primary-500" />
@@ -127,7 +156,7 @@ async function handle_update_entry() {
</button>
{/snippet}
<div class="h-[60vh] space-y-6 overflow-y-auto px-4 py-2">
<div class="min-h-0 flex-1 space-y-6 overflow-y-auto px-4 py-3">
<!-- Navigation Tabs -->
<div
class="bg-surface-500/10 sticky top-0 z-10 mx-auto mb-4 flex max-w-fit justify-center gap-1 rounded-lg p-1 backdrop-blur-sm">
@@ -166,51 +195,62 @@ async function handle_update_entry() {
</div>
{#if tab === 'actions'}
<div class="animate-in fade-in space-y-6 duration-300">
<section class="grid grid-cols-1 gap-4 md:grid-cols-2">
<button
type="button"
class="btn preset-tonal-secondary w-full"
onclick={() => {
show = false;
on_prepend?.();
}}>
<ArrowUpToLine size="1.2em" class="mr-2" /> Prepend Content
</button>
<button
type="button"
class="btn preset-tonal-secondary w-full"
onclick={() => {
show = false;
on_append?.();
}}>
<ArrowDownToLine size="1.2em" class="mr-2" /> Append Content
</button>
<button
type="button"
class="btn preset-tonal-surface w-full"
onclick={() => {
show = false;
on_show_export?.();
}}>
<FileDown size="1.2em" class="mr-2" /> Export Entry
</button>
<button
type="button"
class="btn preset-tonal-surface w-full"
onclick={() => {
/* Clone logic here */ alert(
'Clone not yet implemented in modal'
);
}}>
<Copy size="1.2em" class="mr-2" /> Clone Entry
</button>
<div class="animate-in fade-in space-y-4 duration-300">
<section class={panel_class}>
<h2 class={panel_title_class}>
<Zap size="1.2em" class="text-primary-500" />
Quick Actions
</h2>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<button
type="button"
class="btn preset-tonal-secondary w-full justify-start gap-2"
onclick={() => {
show = false;
on_prepend?.();
}}>
<ArrowUpToLine size="1.2em" />
Prepend Content
</button>
<button
type="button"
class="btn preset-tonal-secondary w-full justify-start gap-2"
onclick={() => {
show = false;
on_append?.();
}}>
<ArrowDownToLine size="1.2em" />
Append Content
</button>
<button
type="button"
class="btn preset-tonal-surface w-full justify-start gap-2"
onclick={() => {
show = false;
on_show_export?.();
}}>
<FileDown size="1.2em" />
Export Entry
</button>
<button
type="button"
class="btn preset-tonal-surface w-full justify-start gap-2"
onclick={() => {
/* Clone logic here */ alert(
'Clone not yet implemented in modal'
);
}}>
<Copy size="1.2em" />
Clone Entry
</button>
</div>
</section>
<section class="border-surface-500/20 space-y-4 border-t pt-4">
<h4 class="text-xs font-bold uppercase opacity-50">
<section class={panel_class}>
<h2 class={panel_title_class}>
<Shapes size="1.2em" class="text-primary-500" />
Quick Category
</h4>
</h2>
<div class="flex flex-wrap gap-2">
{#each journal?.cfg_json?.category_li ?? [] as cat (cat.code)}
<button
@@ -231,94 +271,86 @@ async function handle_update_entry() {
</section>
</div>
{:else if tab === 'meta'}
<div class="animate-in fade-in space-y-6 duration-300">
<label class="label">
<span class="text-sm font-bold opacity-70">Category</span>
<select
class="select"
bind:value={tmp_entry_obj.category_code}
onchange={() => {
handle_update_entry();
on_save();
}}>
<option value="">None</option>
{#each journal?.cfg_json?.category_li ?? [] as cat (cat.code)}
<option value={cat.code}>{cat.name}</option>
{/each}
</select>
</label>
<div class="animate-in fade-in space-y-4 duration-300">
<section class={panel_class}>
<h2 class={panel_title_class}>
<Shapes size="1.2em" class="text-primary-500" />
Entry Details
</h2>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<label class="label">
<span class="text-sm font-bold opacity-70"
>Category</span>
<select
class="select"
bind:value={tmp_entry_obj.category_code}
onchange={() => {
handle_update_entry();
on_save();
}}>
<option value="">None</option>
{#each journal?.cfg_json?.category_li ?? [] as cat (cat.code)}
<option value={cat.code}>{cat.name}</option>
{/each}
</select>
</label>
<label class="label">
<span class="text-sm font-bold opacity-70"
>Tags (Comma separated)</span>
<div class="flex items-center gap-2">
<Tag size="1.2em" class="opacity-30" />
<input
type="text"
bind:value={tmp_entry_obj.tags}
class="input grow"
placeholder="meeting, urgent, ideas"
onchange={() => {
handle_update_entry();
on_save();
}} />
<label class="label">
<span class="text-sm font-bold opacity-70"
>Tags (Comma separated)</span>
<div class="flex items-center gap-2">
<Tag size="1.2em" class="opacity-30" />
<input
type="text"
bind:value={tmp_entry_obj.tags}
class="input grow"
placeholder="meeting, urgent, ideas"
onchange={() => {
handle_update_entry();
on_save();
}} />
</div>
</label>
<label class="label md:col-span-2">
<span class="text-sm font-bold opacity-70"
>Summary</span>
<textarea
bind:value={tmp_entry_obj.summary}
class="textarea min-h-24"
placeholder="Short summary for search results and quick review"
onchange={() => {
handle_update_entry();
on_save();
}}></textarea>
</label>
<label class="label md:col-span-2">
<span class="text-sm font-bold opacity-70"
>Archive On</span>
<input
type="datetime-local"
value={normalize_date(tmp_entry_obj.archive_on)}
onchange={(e) => {
tmp_entry_obj.archive_on =
e.currentTarget.value;
handle_update_entry();
on_save();
}}
class="input" />
</label>
</div>
</label>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<label class="label">
<span class="text-sm font-bold opacity-70"
>Archive On</span>
<input
type="datetime-local"
value={normalize_date(tmp_entry_obj.archive_on)}
onchange={(e) => {
tmp_entry_obj.archive_on =
e.currentTarget.value;
handle_update_entry();
on_save();
}}
class="input" />
</label>
<label class="label">
<span class="text-sm font-bold opacity-70"
>Sort Priority</span>
<div class="flex items-center gap-2">
<button
type="button"
class="btn-icon btn-icon-sm preset-tonal-surface"
onclick={() => {
tmp_entry_obj.sort =
(tmp_entry_obj.sort ?? 0) - 1;
handle_update_entry();
on_save();
}}><Minus size="1em" /></button>
<span class="w-8 text-center font-mono font-bold"
>{tmp_entry_obj.sort ?? 0}</span>
<button
type="button"
class="btn-icon btn-icon-sm preset-tonal-surface"
onclick={() => {
tmp_entry_obj.sort =
(tmp_entry_obj.sort ?? 0) + 1;
handle_update_entry();
on_save();
}}><Plus size="1em" /></button>
</div>
</label>
</div>
</section>
</div>
{:else if tab === 'security'}
<div class="animate-in fade-in space-y-6 duration-300">
<section class="space-y-4">
<h2
class="border-surface-500/30 flex items-center gap-2 border-b pb-2 text-lg font-bold">
<Fingerprint size="1.2em" class="text-primary-500" />
<div class="animate-in fade-in space-y-4 duration-300">
<section class={panel_class}>
<h2 class={panel_title_class}>
<ShieldCheck size="1.2em" class="text-primary-500" />
Status & Security
</h2>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<label
class="bg-surface-500/5 border-surface-500/10 hover:bg-surface-500/10 flex cursor-pointer items-center space-x-3 rounded-lg border p-3 transition-colors">
<label class={field_card_class}>
<input
type="checkbox"
bind:checked={tmp_entry_obj.enable}
@@ -333,8 +365,7 @@ async function handle_update_entry() {
>Allow access to this entry</span>
</div>
</label>
<label
class="bg-surface-500/5 border-surface-500/10 hover:bg-surface-500/10 flex cursor-pointer items-center space-x-3 rounded-lg border p-3 transition-colors">
<label class={field_card_class}>
<input
type="checkbox"
bind:checked={tmp_entry_obj.hide}
@@ -349,8 +380,7 @@ async function handle_update_entry() {
>Hide from standard lists</span>
</div>
</label>
<label
class="bg-surface-500/5 border-surface-500/10 hover:bg-surface-500/10 flex cursor-pointer items-center space-x-3 rounded-lg border p-3 transition-colors">
<label class={field_card_class}>
<input
type="checkbox"
bind:checked={tmp_entry_obj.priority}
@@ -365,8 +395,7 @@ async function handle_update_entry() {
>Star or pin to top</span>
</div>
</label>
<div
class="bg-surface-500/5 border-surface-500/10 flex items-center justify-between rounded-lg border p-3">
<div class="bg-surface-500/5 border-surface-500/10 flex items-center justify-between rounded-lg border p-3">
<div class="flex flex-col">
<span class="text-sm font-bold"
>Sort Order</span>
@@ -400,12 +429,17 @@ async function handle_update_entry() {
</div>
</section>
<section class="space-y-4">
<h4 class="text-xs font-bold uppercase opacity-50">
<section class={panel_class}>
<h2 class={panel_title_class}>
<Fingerprint size="1.2em" class="text-primary-500" />
Privacy Flags
</h4>
</h2>
<p class="text-xs opacity-60">
Visibility and audience controls for the entry itself.
</p>
<AE_Object_Flags
bind:obj={tmp_entry_obj}
show_labels={false}
on_toggle={() => {
handle_update_entry();
on_save();
@@ -419,15 +453,50 @@ async function handle_update_entry() {
hide_template={journal?.cfg_json?.hide_btn_template} />
</section>
<section class={panel_class}>
<h2 class={panel_title_class}>
<CircleAlert size="1.2em" class="text-primary-500" />
Alerts & Messaging
</h2>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<label class={field_card_class}>
<input
type="checkbox"
bind:checked={tmp_entry_obj.alert}
onchange={() => {
handle_update_entry();
on_save();
}}
class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Alert</span>
<span class="text-xs opacity-60"
>Flag this entry for emphasis</span>
</div>
</label>
<label class="label md:col-span-2">
<span class="text-sm font-bold opacity-70"
>Alert Message</span>
<textarea
bind:value={tmp_entry_obj.alert_msg}
class="textarea min-h-24"
placeholder="Optional note shown with the alert"
onchange={() => {
handle_update_entry();
on_save();
}}></textarea>
</label>
</div>
</section>
{#if tmp_entry_obj.private && !tmp_entry_obj.content && tmp_entry_obj.content_encrypted}
<section class="border-error-500/20 border-t pt-8">
<div
class="bg-error-500/10 border-error-500/30 rounded-lg border p-4">
<h4
class="text-error-500 mb-2 flex items-center gap-2 font-bold">
<RefreshCcw size="1.2em" /> Disaster Recovery
</h4>
<p class="mb-4 text-xs italic opacity-70">
<section class={panel_class}>
<h2 class={panel_title_class}>
<RefreshCcw size="1.2em" class="text-primary-500" />
Disaster Recovery
</h2>
<div class="space-y-4">
<p class="text-xs italic opacity-70">
If the encryption passcode is lost, the data is
unrecoverable. You can force a reset to plain
text to reuse this entry ID.
@@ -445,24 +514,85 @@ async function handle_update_entry() {
</section>
{/if}
<section class="pt-12">
<button
type="button"
class="btn btn-sm preset-tonal-error w-full"
onclick={() => {
alert('Delete logic handled in parent component');
}}>
<Trash2 size="1.1em" class="mr-2" /> Delete Entry
</button>
</section>
{#if $ae_loc.trusted_access || $ae_loc.manager_access || $ae_loc.administrator_access}
<section class={panel_class}>
<h2 class={panel_title_class}>
<Settings size="1.2em" class="text-primary-500" />
Admin
</h2>
<p class="text-xs opacity-60">
Trusted access and above only. Notes are for staff
use; managers and admins see Delete while trusted
access sees Remove.
</p>
<div class="grid grid-cols-1 gap-4">
<label class="label">
<span class="text-sm font-bold opacity-70"
>Notes</span>
<textarea
bind:value={tmp_entry_obj.notes}
class="textarea min-h-24"
placeholder="Rarely used staff/admin note"
onchange={() => {
handle_update_entry();
on_save();
}}></textarea>
</label>
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
<label class={field_card_class}>
<input
type="checkbox"
bind:checked={tmp_entry_obj.enable}
onchange={() => {
handle_update_entry();
on_save();
}}
class="checkbox checkbox-primary" />
<div class="flex flex-col">
<span class="font-bold">Enabled</span>
<span class="text-xs opacity-60"
>Default access state for this entry</span>
</div>
</label>
<button
type="button"
class="btn btn-sm mx-auto inline-flex w-fit min-w-36 justify-center gap-2 px-4 font-bold {($ae_loc.manager_access || $ae_loc.administrator_access) ? 'preset-tonal-error hover:preset-filled-error-500' : 'preset-tonal-warning hover:preset-filled-warning-500'}"
title={($ae_loc.manager_access || $ae_loc.administrator_access)
? 'Permanently delete this journal entry'
: 'Disable this journal entry instead of deleting it'}
onclick={handle_admin_delete_action}>
{#if $ae_loc.manager_access || $ae_loc.administrator_access}
<Trash2 size="1.1em" />
Delete
{:else}
<Minus size="1.1em" />
Remove
{/if}
</button>
</div>
</div>
</section>
{/if}
</div>
{:else if tab === 'json'}
<div class="h-full min-h-[400px]">
<AE_Comp_Editor_CodeMirror
readonly={true}
content={JSON.stringify(tmp_entry_obj, null, 2)}
theme_mode={$ae_loc.theme_mode}
class_li="rounded-lg border border-surface-500/30" />
<div class="h-full min-h-100">
<section class={panel_class}>
<h2 class={panel_title_class}>
<CodeXml size="1.2em" class="text-primary-500" />
Raw Entry JSON
</h2>
<p class="text-xs opacity-60">
Read-only view of the current bound entry object.
</p>
<AE_Comp_Editor_CodeMirror
readonly={true}
content={JSON.stringify(tmp_entry_obj, null, 2)}
theme_mode={$ae_loc.theme_mode}
class_li="rounded-lg border border-surface-500/20" />
</section>
</div>
{/if}
</div>
@@ -470,10 +600,10 @@ async function handle_update_entry() {
{#snippet footer()}
<button
type="button"
class="btn preset-filled-primary min-w-[120px] font-bold"
class="btn preset-filled-primary min-w-30 font-bold"
onclick={() => (show = false)}>
<Check size="1.2em" class="mr-2" />
Done
</button>
{/snippet}
</Modal>
</Modal>