From 34bcd9dd2d0195c5d46d6515056362cabe6292b1 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 12 Nov 2024 16:20:18 -0500 Subject: [PATCH] The archives are looking better now. Mostly style and sorting improvements. --- src/lib/ae_api/api_get__crud_obj_li_v1.ts | 34 ++++++------ .../ae_archives__archive_content.ts | 3 ++ src/lib/db_archives.ts | 7 ++- src/routes/idaa/(idaa)/archives/+layout.ts | 2 +- src/routes/idaa/(idaa)/archives/+page.svelte | 3 +- .../(idaa)/archives/[archive_id]/+page.svelte | 32 ++++++++--- ...e_idaa_comp__archive_content_obj_li.svelte | 54 ++++++++++++++++--- .../ae_idaa_comp__archive_obj_li.svelte | 3 ++ 8 files changed, 102 insertions(+), 36 deletions(-) diff --git a/src/lib/ae_api/api_get__crud_obj_li_v1.ts b/src/lib/ae_api/api_get__crud_obj_li_v1.ts index d0166d5a..68d8f8fe 100644 --- a/src/lib/ae_api/api_get__crud_obj_li_v1.ts +++ b/src/lib/ae_api/api_get__crud_obj_li_v1.ts @@ -9,22 +9,22 @@ export async function get_ae_obj_li_for_obj_id_crud( obj_type, for_obj_type, for_obj_id, // NOTE: Changed 2023-12-06 to no longer required - use_alt_table=false, - use_alt_base=false, - inc={}, - enabled='enabled', - hidden='not_hidden', - order_by_li=null, - limit=999999, - offset=0, + use_alt_table = false, + use_alt_base = false, + // inc = {}, + enabled = 'enabled', + hidden = 'not_hidden', + order_by_li = null, + limit = 999999, + offset = 0, // key, - // jwt=null, - headers={}, - params_json=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } } - // json_obj=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. - params={}, - return_meta=false, - log_lvl=1 + // jwt = null, + headers = {}, + params_json = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } } + // json_obj = null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint. + params = {}, + return_meta = false, + log_lvl = 0 }: { api_cfg: any, obj_type: string, @@ -32,7 +32,7 @@ export async function get_ae_obj_li_for_obj_id_crud( for_obj_id?: string, use_alt_table?: boolean, use_alt_base?: boolean, - inc?: key_val + // inc?: key_val enabled?: string, hidden?: string, order_by_li?: any, @@ -49,7 +49,7 @@ export async function get_ae_obj_li_for_obj_id_crud( } ) { if (log_lvl) { - console.log('*** get_ae_obj_li_for_obj_id_crud() ***'); + console.log(`*** get_ae_obj_li_for_obj_id_crud() *** [${obj_type}]`); } // data = {}; diff --git a/src/lib/ae_archives/ae_archives__archive_content.ts b/src/lib/ae_archives/ae_archives__archive_content.ts index 1e4e7f8d..71650618 100644 --- a/src/lib/ae_archives/ae_archives__archive_content.ts +++ b/src/lib/ae_archives/ae_archives__archive_content.ts @@ -364,6 +364,9 @@ export async function db_save_ae_obj_li__archive_content( created_on: obj.created_on, updated_on: obj.updated_on, + tmp_sort_1: `${obj.original_datetime}_${obj.group}_${obj.priority}_${obj.sort}`, + tmp_sort_2: `${obj.group}_${obj.original_datetime}_${obj.priority}_${obj.sort}`, + // From SQL view archive_code: obj.archive_code, archive_name: obj.archive_name, diff --git a/src/lib/db_archives.ts b/src/lib/db_archives.ts index 73974232..04f5c54a 100644 --- a/src/lib/db_archives.ts +++ b/src/lib/db_archives.ts @@ -109,6 +109,9 @@ export interface Archive_Content { created_on: Date; updated_on?: null|Date; + tmp_sort_1?: null|string; + tmp_sort_2?: null|string; + // Additional fields for convenience (database views) archive_code?: null|string; archive_name?: null|string; @@ -139,7 +142,9 @@ export class MySubClassedDexie extends Dexie { archive_content_type, name, hosted_file_id, - enable, hide, priority, sort, group, notes, created_on, updated_on`, + original_datetime, original_timezone, original_location, + [group+original_datetime],tmp_sort_1,tmp_sort_2, + enable, hide, priority, sort, group, notes, created_on, updated_on, [group+priority+sort+updated_on]`, }); // file_path, diff --git a/src/routes/idaa/(idaa)/archives/+layout.ts b/src/routes/idaa/(idaa)/archives/+layout.ts index ff37a180..a46bbbf6 100644 --- a/src/routes/idaa/(idaa)/archives/+layout.ts +++ b/src/routes/idaa/(idaa)/archives/+layout.ts @@ -31,7 +31,7 @@ export async function load({ params, parent }) { // route for_obj_id: account_id, inc_content_li: true, order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'}, - params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200}, + params: {qry__enabled: 'enabled', qry__hidden: 'not_hidden', qry__limit: 20}, try_cache: true, log_lvl: log_lvl }); diff --git a/src/routes/idaa/(idaa)/archives/+page.svelte b/src/routes/idaa/(idaa)/archives/+page.svelte index 10f35b1b..1a048202 100644 --- a/src/routes/idaa/(idaa)/archives/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/+page.svelte @@ -28,7 +28,8 @@ $: lq__archive_obj_li = liveQuery(async () => { // .orderBy('updated_on') // .toArray() .reverse() - .sortBy('updated_on'); + .sortBy('sort'); + // .sortBy('updated_on'); // .sortBy('updated_on, created_on'); // .sortBy('[updated_on+created_on]'); // .sortBy('[created_on+updated_on]'); diff --git a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte index ae2262b5..e991af36 100644 --- a/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte +++ b/src/routes/idaa/(idaa)/archives/[archive_id]/+page.svelte @@ -1,7 +1,7 @@ -
+
{#if $lq__archive_content_obj_li && $lq__archive_content_obj_li.length} + + {#each $lq__archive_content_obj_li as idaa_archive_content_obj, index} + +{#if idaa_archive_content_obj.group && idaa_archive_content_obj.group != $lq__archive_content_obj_li[index - 1]?.group} +
+ +
+{/if} + +{#if $idaa_loc.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group} +
@@ -44,6 +76,7 @@ onMount(() => { {idaa_archive_content_obj.original_location} {/if} + {#if idaa_archive_content_obj.description}
{@html idaa_archive_content_obj.description}
{/if} @@ -206,9 +239,14 @@ onMount(() => {
- + + +{/if} + {/each} + + {:else}

No archive content available to show.

{/if} diff --git a/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte b/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte index a56dcd1f..cf6f3741 100644 --- a/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte +++ b/src/routes/idaa/(idaa)/archives/ae_idaa_comp__archive_obj_li.svelte @@ -2,6 +2,7 @@ // *** Import Svelte core import { onMount } from 'svelte'; import { Spinner } from 'flowbite-svelte'; +import { goto } from '$app/navigation'; // *** Import Aether core variables and functions import { ae_util } from '$lib/ae_utils/ae_utils'; @@ -95,6 +96,8 @@ onMount(() => { $idaa_sess.archives.show__modal_view__archive_id = false; $idaa_sess.archives.show__modal_edit__archive_id = $idaa_slct.archive_id; + + goto(`/idaa/archives/${idaa_archive_obj?.archive_id}`); }} class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition" title={`Edit archive: ${idaa_archive_obj.title}`}