Refine journal search filtering
This commit is contained in:
@@ -1,72 +1,33 @@
|
||||
<script lang="ts">
|
||||
interface JournalObjLike {
|
||||
name?: string;
|
||||
cfg_json?: {
|
||||
category_li?: Array<{
|
||||
code: string;
|
||||
name: string;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
lq__journal_obj: any;
|
||||
lq__journal_obj: JournalObjLike | null | undefined;
|
||||
}
|
||||
|
||||
let { log_lvl = $bindable(0), lq__journal_obj }: Props = $props();
|
||||
|
||||
import {
|
||||
ArrowDown01,
|
||||
ArrowDown10,
|
||||
ArrowDownUp,
|
||||
BetweenVerticalEnd,
|
||||
BetweenVerticalStart,
|
||||
BookHeart,
|
||||
BookImage,
|
||||
Bookmark,
|
||||
BookOpenText,
|
||||
BriefcaseBusiness,
|
||||
Check,
|
||||
Copy,
|
||||
Expand,
|
||||
Eye,
|
||||
EyeOff,
|
||||
Flag,
|
||||
FlagOff,
|
||||
FilePlus,
|
||||
Fingerprint,
|
||||
Globe,
|
||||
Library,
|
||||
MessageSquareWarning,
|
||||
Minus,
|
||||
Notebook,
|
||||
Pencil,
|
||||
Plus,
|
||||
RemoveFormatting,
|
||||
SquareLibrary,
|
||||
Shapes,
|
||||
Share2,
|
||||
ShieldCheck,
|
||||
ShieldMinus,
|
||||
Siren,
|
||||
Skull,
|
||||
Tags,
|
||||
Target,
|
||||
ToggleLeft,
|
||||
ToggleRight,
|
||||
Trash2,
|
||||
TypeOutline,
|
||||
X
|
||||
RemoveFormatting
|
||||
} from '@lucide/svelte';
|
||||
|
||||
import {
|
||||
ae_snip,
|
||||
ae_loc,
|
||||
ae_sess,
|
||||
ae_api,
|
||||
ae_trig,
|
||||
slct,
|
||||
slct_trigger
|
||||
} from '$lib/stores/ae_stores';
|
||||
import {
|
||||
journals_loc,
|
||||
journals_sess,
|
||||
journals_slct,
|
||||
journals_prom,
|
||||
journals_trig
|
||||
journals_sess
|
||||
} from '$lib/ae_journals/ae_journals_stores';
|
||||
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
||||
|
||||
// *** Functions and Logic
|
||||
function handle_search_trigger() {
|
||||
@@ -102,10 +63,10 @@ function prevent_default<T extends Event>(fn: (event: T) => void) {
|
||||
type="text"
|
||||
placeholder="Search Journal Entries"
|
||||
bind:value={$journals_loc.entry.qry__search_text}
|
||||
onkeyup={(event) => {
|
||||
onkeyup={() => {
|
||||
// Reactive effect in parent handles this debounced
|
||||
}}
|
||||
title={`Search for Entries in "${$lq__journal_obj?.name}. Press Enter to search.`}
|
||||
title={`Search for Entries in "${lq__journal_obj?.name}. Press Enter to search.`}
|
||||
autocomplete="off"
|
||||
class="
|
||||
input input-sm
|
||||
@@ -153,17 +114,47 @@ function prevent_default<T extends Event>(fn: (event: T) => void) {
|
||||
<select
|
||||
class="select select-sm"
|
||||
bind:value={$journals_loc.entry.qry__category_code}
|
||||
onchange={(event) => {
|
||||
onchange={() => {
|
||||
handle_search_trigger();
|
||||
}}
|
||||
title="Filter by category">
|
||||
<option value="">All Categories</option>
|
||||
{#each $lq__journal_obj?.cfg_json?.category_li as category (category.code)}
|
||||
{#each lq__journal_obj?.cfg_json?.category_li as category (category.code)}
|
||||
<option value={category.code}>{category.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</span>
|
||||
|
||||
<span class="flex flex-row flex-wrap items-center gap-2">
|
||||
<span class="hidden text-sm text-gray-500 lg:inline"> Filters: </span>
|
||||
|
||||
<label class="flex flex-row items-center gap-1 text-xs font-semibold text-gray-500">
|
||||
<span>Enabled</span>
|
||||
<select
|
||||
class="select select-sm"
|
||||
bind:value={$journals_loc.entry.qry__enabled}
|
||||
onchange={handle_search_trigger}
|
||||
title="Filter by enabled status">
|
||||
<option value="enabled">Enabled Only</option>
|
||||
<option value="not_enabled">Disabled Only</option>
|
||||
<option value="all">All</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label class="flex flex-row items-center gap-1 text-xs font-semibold text-gray-500">
|
||||
<span>Hidden</span>
|
||||
<select
|
||||
class="select select-sm"
|
||||
bind:value={$journals_loc.entry.qry__hidden}
|
||||
onchange={handle_search_trigger}
|
||||
title="Filter by hidden status">
|
||||
<option value="not_hidden">Visible Only</option>
|
||||
<option value="hidden">Hidden Only</option>
|
||||
<option value="all">All</option>
|
||||
</select>
|
||||
</label>
|
||||
</span>
|
||||
|
||||
<!-- Search Control Toggles -->
|
||||
<span
|
||||
class="border-surface-300-700 flex flex-row flex-wrap items-center gap-2 border-l pl-2">
|
||||
|
||||
Reference in New Issue
Block a user