The archives are looking better now. Mostly style and sorting improvements.
This commit is contained in:
@@ -9,22 +9,22 @@ export async function get_ae_obj_li_for_obj_id_crud(
|
|||||||
obj_type,
|
obj_type,
|
||||||
for_obj_type,
|
for_obj_type,
|
||||||
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
|
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
|
||||||
use_alt_table=false,
|
use_alt_table = false,
|
||||||
use_alt_base=false,
|
use_alt_base = false,
|
||||||
inc={},
|
// inc = {},
|
||||||
enabled='enabled',
|
enabled = 'enabled',
|
||||||
hidden='not_hidden',
|
hidden = 'not_hidden',
|
||||||
order_by_li=null,
|
order_by_li = null,
|
||||||
limit=999999,
|
limit = 999999,
|
||||||
offset=0,
|
offset = 0,
|
||||||
// key,
|
// key,
|
||||||
// jwt=null,
|
// jwt = null,
|
||||||
headers={},
|
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" } }
|
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.
|
// 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={},
|
params = {},
|
||||||
return_meta=false,
|
return_meta = false,
|
||||||
log_lvl=1
|
log_lvl = 0
|
||||||
}: {
|
}: {
|
||||||
api_cfg: any,
|
api_cfg: any,
|
||||||
obj_type: string,
|
obj_type: string,
|
||||||
@@ -32,7 +32,7 @@ export async function get_ae_obj_li_for_obj_id_crud(
|
|||||||
for_obj_id?: string,
|
for_obj_id?: string,
|
||||||
use_alt_table?: boolean,
|
use_alt_table?: boolean,
|
||||||
use_alt_base?: boolean,
|
use_alt_base?: boolean,
|
||||||
inc?: key_val
|
// inc?: key_val
|
||||||
enabled?: string,
|
enabled?: string,
|
||||||
hidden?: string,
|
hidden?: string,
|
||||||
order_by_li?: any,
|
order_by_li?: any,
|
||||||
@@ -49,7 +49,7 @@ export async function get_ae_obj_li_for_obj_id_crud(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
if (log_lvl) {
|
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 = {};
|
// data = {};
|
||||||
|
|||||||
@@ -364,6 +364,9 @@ export async function db_save_ae_obj_li__archive_content(
|
|||||||
created_on: obj.created_on,
|
created_on: obj.created_on,
|
||||||
updated_on: obj.updated_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
|
// From SQL view
|
||||||
archive_code: obj.archive_code,
|
archive_code: obj.archive_code,
|
||||||
archive_name: obj.archive_name,
|
archive_name: obj.archive_name,
|
||||||
|
|||||||
@@ -109,6 +109,9 @@ export interface Archive_Content {
|
|||||||
created_on: Date;
|
created_on: Date;
|
||||||
updated_on?: null|Date;
|
updated_on?: null|Date;
|
||||||
|
|
||||||
|
tmp_sort_1?: null|string;
|
||||||
|
tmp_sort_2?: null|string;
|
||||||
|
|
||||||
// Additional fields for convenience (database views)
|
// Additional fields for convenience (database views)
|
||||||
archive_code?: null|string;
|
archive_code?: null|string;
|
||||||
archive_name?: null|string;
|
archive_name?: null|string;
|
||||||
@@ -139,7 +142,9 @@ export class MySubClassedDexie extends Dexie {
|
|||||||
archive_content_type,
|
archive_content_type,
|
||||||
name,
|
name,
|
||||||
hosted_file_id,
|
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,
|
// file_path,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export async function load({ params, parent }) { // route
|
|||||||
for_obj_id: account_id,
|
for_obj_id: account_id,
|
||||||
inc_content_li: true,
|
inc_content_li: true,
|
||||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'name': 'ASC'},
|
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,
|
try_cache: true,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ $: lq__archive_obj_li = liveQuery(async () => {
|
|||||||
// .orderBy('updated_on')
|
// .orderBy('updated_on')
|
||||||
// .toArray()
|
// .toArray()
|
||||||
.reverse()
|
.reverse()
|
||||||
.sortBy('updated_on');
|
.sortBy('sort');
|
||||||
|
// .sortBy('updated_on');
|
||||||
// .sortBy('updated_on, created_on');
|
// .sortBy('updated_on, created_on');
|
||||||
// .sortBy('[updated_on+created_on]');
|
// .sortBy('[updated_on+created_on]');
|
||||||
// .sortBy('[created_on+updated_on]');
|
// .sortBy('[created_on+updated_on]');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/** @type {import('./$types').PageData} */
|
/** @type {import('./$types').PageData} */
|
||||||
export let data: any;
|
export let data: any;
|
||||||
let log_lvl = 0;
|
let log_lvl = 1;
|
||||||
|
|
||||||
// Imports
|
// Imports
|
||||||
import { Modal } from 'flowbite-svelte';
|
import { Modal } from 'flowbite-svelte';
|
||||||
@@ -55,14 +55,30 @@ $: lq__archive_obj = liveQuery(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$: lq__archive_content_obj_li = liveQuery(async () => {
|
$: lq__archive_content_obj_li = liveQuery(async () => {
|
||||||
let results = await db_archives.content
|
if (log_lvl) {
|
||||||
.where('archive_id')
|
console.log(`$lq__archive_obj.cfg_json = `, $lq__archive_obj?.cfg_json);
|
||||||
.equals($idaa_slct?.archive_id ?? '') // null or undefined does not reset things like '' does
|
}
|
||||||
.reverse()
|
if ($lq__archive_obj?.cfg_json?.content_group_sort === 'DESC') {
|
||||||
.sortBy('updated_on');
|
let results = await db_archives.content
|
||||||
// .sortBy('title');
|
// .orderBy('updated_on')
|
||||||
|
.where('archive_id')
|
||||||
|
.equals($idaa_slct?.archive_id ?? '') // null or undefined does not reset things like '' does
|
||||||
|
.reverse()
|
||||||
|
.sortBy('tmp_sort_2');
|
||||||
|
// .sortBy('updated_on');
|
||||||
|
// .sortBy('title');
|
||||||
|
|
||||||
|
return results;
|
||||||
|
} else {
|
||||||
|
let results = await db_archives.content
|
||||||
|
.where('archive_id')
|
||||||
|
.equals($idaa_slct?.archive_id ?? '') // null or undefined does not reset things like '' does
|
||||||
|
// .reverse()
|
||||||
|
.sortBy('tmp_sort_2');
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
return results;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$: lq__archive_content_obj = liveQuery(async () => {
|
$: lq__archive_content_obj = liveQuery(async () => {
|
||||||
|
|||||||
@@ -13,21 +13,53 @@ import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
|||||||
export let lq__archive_content_obj_li: any;
|
export let lq__archive_content_obj_li: any;
|
||||||
|
|
||||||
let ae_promises: key_val = {};
|
let ae_promises: key_val = {};
|
||||||
let ae_tmp: key_val = {};
|
// let ae_tmp: key_val = {};
|
||||||
let ae_triggers: key_val = {};
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
console.log('** Component Mounted: ** List - Archive Obj');
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<section class="archive_list">
|
<section class="archive_list flex flex-col gap-2 items-center justify-center w-full">
|
||||||
{#if $lq__archive_content_obj_li && $lq__archive_content_obj_li.length}
|
{#if $lq__archive_content_obj_li && $lq__archive_content_obj_li.length}
|
||||||
|
|
||||||
|
<!-- <div class="ae_group">
|
||||||
|
<span class="ae_label">Group:</span>
|
||||||
|
<span class="ae_value">{current_group}</span> -->
|
||||||
|
|
||||||
{#each $lq__archive_content_obj_li as idaa_archive_content_obj, index}
|
{#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}
|
||||||
|
<div class="ae_row archive_content__group flex flex-row items-center justify-center">
|
||||||
|
<button
|
||||||
|
class="btn btn-md variant-glass-secondary hover:variant-filled-secondary transition w-96"
|
||||||
|
on:click={() => {
|
||||||
|
if ($idaa_loc.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group) {
|
||||||
|
$idaa_loc.archives.show_list__archive_content_li_group = null;
|
||||||
|
} else {
|
||||||
|
$idaa_loc.archives.show_list__archive_content_li_group = idaa_archive_content_obj.group;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{#if $idaa_loc.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group}
|
||||||
|
<span class="fas fa-caret-down"></span>
|
||||||
|
<!-- <span class="fas fa-minus"></span> -->
|
||||||
|
<span class="ae_label text-xs">Hide:</span>
|
||||||
|
{:else}
|
||||||
|
<span class="fas fa-caret-right"></span>
|
||||||
|
<!-- <span class="fas fa-plus"></span> -->
|
||||||
|
<span class="ae_label text-xs">Show:</span>
|
||||||
|
{/if}
|
||||||
|
<!-- <span class="fas fa-caret-down"></span> -->
|
||||||
|
<!-- <span class="ae_label">Show:</span> -->
|
||||||
|
<span class="ae_value text-lg font-bold">{idaa_archive_content_obj.group}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if $idaa_loc.archives.show_list__archive_content_li_group == idaa_archive_content_obj.group}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="container archive archive_content_obj border border-1 rounded p-2 mb-2 space-y-2"
|
class="container archive archive_content_obj border border-1 rounded p-2 mb-2 space-y-2 w-full max-w-screen-lg flex flex-col items-center justify-center"
|
||||||
class:dim={idaa_archive_content_obj.hide}
|
class:dim={idaa_archive_content_obj.hide}
|
||||||
class:bg-warning-100={!idaa_archive_content_obj?.enable}
|
class:bg-warning-100={!idaa_archive_content_obj?.enable}
|
||||||
>
|
>
|
||||||
@@ -44,6 +76,7 @@ onMount(() => {
|
|||||||
<span class="ae_value">{idaa_archive_content_obj.original_location}</span>
|
<span class="ae_value">{idaa_archive_content_obj.original_location}</span>
|
||||||
</h4>
|
</h4>
|
||||||
{/if}
|
{/if}
|
||||||
|
<!-- <span>group: {idaa_archive_content_obj.group}</span> -->
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{#if idaa_archive_content_obj.description}<pre class="archive__description p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html idaa_archive_content_obj.description}</pre>{/if}
|
{#if idaa_archive_content_obj.description}<pre class="archive__description p-2 bg-white shadow-md rounded-lg text-wrap text-sm font-normal whitespace-pre-wrap">{@html idaa_archive_content_obj.description}</pre>{/if}
|
||||||
@@ -206,9 +239,14 @@ onMount(() => {
|
|||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
|
<!-- </div> -->
|
||||||
|
|
||||||
{:else}
|
{:else}
|
||||||
<p>No archive content available to show.</p>
|
<p>No archive content available to show.</p>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// *** Import Svelte core
|
// *** Import Svelte core
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { Spinner } from 'flowbite-svelte';
|
import { Spinner } from 'flowbite-svelte';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
// *** Import Aether core variables and functions
|
// *** Import Aether core variables and functions
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
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_view__archive_id = false;
|
||||||
$idaa_sess.archives.show__modal_edit__archive_id = $idaa_slct.archive_id;
|
$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"
|
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||||
title={`Edit archive: ${idaa_archive_obj.title}`}
|
title={`Edit archive: ${idaa_archive_obj.title}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user