General clean up and improvements.
This commit is contained in:
@@ -599,7 +599,7 @@ export function db_save_ae_obj_li__journal(
|
|||||||
// tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`,
|
// tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`,
|
||||||
|
|
||||||
// From SQL view
|
// From SQL view
|
||||||
// journal_other_count: obj.journal_other_count,
|
journal_entry_count: obj.journal_entry_count,
|
||||||
|
|
||||||
// A key value list of the others
|
// A key value list of the others
|
||||||
// journal_other_kv: obj.journal_other_kv,
|
// journal_other_kv: obj.journal_other_kv,
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ export interface Journal {
|
|||||||
journal_location_code?: null|string;
|
journal_location_code?: null|string;
|
||||||
journal_location_name?: null|string;
|
journal_location_name?: null|string;
|
||||||
|
|
||||||
|
journal_entry_count?: null|number;
|
||||||
|
|
||||||
// A key value list of the entries
|
// A key value list of the entries
|
||||||
journal_entry_kv?: null|key_val;
|
journal_entry_kv?: null|key_val;
|
||||||
journal_entry_li?: null|[];
|
journal_entry_li?: null|[];
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ import { onMount } from 'svelte';
|
|||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
// *** Import other supporting libraries
|
// *** Import other supporting libraries
|
||||||
import { BookPlus, FolderPlus } from '@lucide/svelte';
|
import {
|
||||||
|
BookPlus,
|
||||||
|
FolderPlus, Library,
|
||||||
|
SquareLibrary
|
||||||
|
} from '@lucide/svelte';
|
||||||
import { liveQuery } from "dexie";
|
import { liveQuery } from "dexie";
|
||||||
import { Modal } from 'flowbite-svelte';
|
import { Modal } from 'flowbite-svelte';
|
||||||
|
|
||||||
@@ -82,6 +86,14 @@ onMount(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async function create_journal() {
|
async function create_journal() {
|
||||||
|
// Confirm before creating a new journal
|
||||||
|
if (confirm('Are you sure you want to create a new journal?')) {
|
||||||
|
console.log('Creating new journal...');
|
||||||
|
} else {
|
||||||
|
console.log('Journal creation cancelled.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($journals_sess.journal.new_journal_name && $journals_sess.journal.new_journal_type_code) {
|
if ($journals_sess.journal.new_journal_name && $journals_sess.journal.new_journal_type_code) {
|
||||||
$journals_slct.journal_id = null;
|
$journals_slct.journal_id = null;
|
||||||
try {
|
try {
|
||||||
@@ -130,7 +142,11 @@ async function create_journal() {
|
|||||||
|
|
||||||
<section class="ae_journals md:container h-full mx-auto space-y-2">
|
<section class="ae_journals md:container h-full mx-auto space-y-2">
|
||||||
|
|
||||||
<h1 class="h1 text-center">Journals for {$ae_loc.account_name ?? 'Æ loading...'}</h1>
|
<h1 class="h1 text-center">
|
||||||
|
<!-- <Library size="1em" class="mx-1 inline-block" /> -->
|
||||||
|
<SquareLibrary size="1em" class="mx-1 inline-block text-gray-500"/>
|
||||||
|
Journals for {$ae_loc.account_name ?? 'Æ loading...'}
|
||||||
|
</h1>
|
||||||
|
|
||||||
<div class="flex flex-row items-center justify-center w-full border-gray-200 border-y-2 py-2">
|
<div class="flex flex-row items-center justify-center w-full border-gray-200 border-y-2 py-2">
|
||||||
<!-- Add new journal button -->
|
<!-- Add new journal button -->
|
||||||
@@ -233,8 +249,16 @@ async function create_journal() {
|
|||||||
<input type="text" placeholder="Journal Type" bind:value={$journals_sess.journal.new_journal_type_code} class="input input-bordered w-full mb-2" />
|
<input type="text" placeholder="Journal Type" bind:value={$journals_sess.journal.new_journal_type_code} class="input input-bordered w-full mb-2" />
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-action">
|
<div class="modal-action">
|
||||||
<button class="btn btn-primary" onclick={create_journal}>Create</button>
|
<button class="btn variant-glass-primary"
|
||||||
<button class="btn" onclick={$journals_sess.show__modal_new__journal_obj ?? false}>
|
onclick={create_journal}>Create</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onclick={() => {
|
||||||
|
// Close the modal
|
||||||
|
$journals_sess.show__modal_new__journal_obj = false;
|
||||||
|
}}
|
||||||
|
class="btn variant-glass-secondary"
|
||||||
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import {
|
|||||||
Check,
|
Check,
|
||||||
FilePlus, Library,
|
FilePlus, Library,
|
||||||
Minus, Notebook, Pencil, Plus,
|
Minus, Notebook, Pencil, Plus,
|
||||||
|
SquareLibrary,
|
||||||
X
|
X
|
||||||
} from '@lucide/svelte';
|
} from '@lucide/svelte';
|
||||||
|
|
||||||
@@ -130,7 +131,8 @@ async function handle_update_journal() {
|
|||||||
title="View all journals"
|
title="View all journals"
|
||||||
>
|
>
|
||||||
<!-- <BookHeart /> -->
|
<!-- <BookHeart /> -->
|
||||||
<Library />
|
<!-- <Library /> -->
|
||||||
|
<SquareLibrary class="text-gray-500"/>
|
||||||
<span class="hidden md:inline">
|
<span class="hidden md:inline">
|
||||||
All Journals
|
All Journals
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// *** Import Svelte specific
|
// *** Import Svelte specific
|
||||||
|
|
||||||
|
// *** Import other supporting libraries
|
||||||
|
import {
|
||||||
|
BookPlus, BookOpenText
|
||||||
|
} from '@lucide/svelte';
|
||||||
|
|
||||||
// *** Import Aether specific variables and functions
|
// *** Import Aether specific variables and functions
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
@@ -28,6 +33,7 @@ let { log_lvl = 0, lq__journal_obj, lq__journal_entry_obj_li }: Props = $props()
|
|||||||
|
|
||||||
<header class="ae_header journal__header">
|
<header class="ae_header journal__header">
|
||||||
<h2 class="journal__name h3">
|
<h2 class="journal__name h3">
|
||||||
|
<BookOpenText class="inline-block" />
|
||||||
{@html $lq__journal_obj?.name ?? 'Loading...'}
|
{@html $lq__journal_obj?.name ?? 'Loading...'}
|
||||||
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
||||||
({$lq__journal_entry_obj_li?.length ?? '0'}×)
|
({$lq__journal_entry_obj_li?.length ?? '0'}×)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ let { lq__journal_obj_li }: Props = $props();
|
|||||||
|
|
||||||
{#if journals_journal_obj?.journal_entry_count}
|
{#if journals_journal_obj?.journal_entry_count}
|
||||||
<span class="ae_badge ae_info journal__journal_entry_count">
|
<span class="ae_badge ae_info journal__journal_entry_count">
|
||||||
<span class="fas fa-content"></span> {(journals_journal_obj?.journal_entry_count == 1 ? `${journals_journal_obj?.journal_entry_count} entry` : `${journals_journal_obj?.journal_entry_count} entries` )}
|
{@html (journals_journal_obj?.journal_entry_count == 1 ? `${journals_journal_obj?.journal_entry_count}× entry` : `${journals_journal_obj?.journal_entry_count}× entries` )}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user