Restructure Core management into linkable routes and add common layout navigation

- Renamed person route to people for consistency
- Refactored /core dashboard to use standard <a> links
- Added common management <nav> to core layout
- Replaced goto() with standard links across all list and detail pages
- Fixed 500 error caused by broken import path and strict layout data
This commit is contained in:
Scott Idem
2026-01-06 15:33:08 -05:00
parent 5d2186e8ca
commit a0f04726e0
14 changed files with 135 additions and 167 deletions

View File

@@ -1,10 +1,6 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { core_func } from '$lib/ae_core/ae_core_functions';
import { Building, Globe, Users, ShieldCheck, List, Plus } from 'lucide-svelte';
import { ae_loc, ae_sess, ae_api, slct } from '$lib/stores/ae_stores';
import Comp_person_obj_tbl from './ae_comp__person_obj_tbl.svelte';
import Comp_person_search from './person/ae_comp__person_search.svelte';
import { Building, Globe, Users, ShieldCheck, List } from 'lucide-svelte';
import { ae_loc, slct } from '$lib/stores/ae_stores';
interface Props {
data: any;
@@ -14,8 +10,6 @@
// Quickly save the data passed from the parent(s)
$slct.account_id = data.account_id;
let person_id_random_li: string[] = $state([]);
</script>
<section class="ae_core md:container mx-auto p-4 space-y-6">
@@ -35,9 +29,9 @@
<h3 class="h4">Accounts</h3>
</div>
<p class="text-sm opacity-80 text-balance">Manage client accounts and high-level system settings.</p>
<button class="btn variant-filled-primary w-full" onclick={() => goto('/core/accounts')}>
<a class="btn variant-filled-primary w-full" href="/core/accounts">
Manage Accounts
</button>
</a>
</div>
<!-- Site Management Card -->
@@ -47,9 +41,9 @@
<h3 class="h4">Sites</h3>
</div>
<p class="text-sm opacity-80 text-balance">Configure sites and domains associated with the active account.</p>
<button class="btn variant-filled-secondary w-full" onclick={() => goto('/core/sites')}>
<a class="btn variant-filled-secondary w-full" href="/core/sites">
Manage Sites
</button>
</a>
</div>
<!-- User Management Card -->
@@ -59,51 +53,21 @@
<h3 class="h4">Users</h3>
</div>
<p class="text-sm opacity-80 text-balance">Manage system access, permissions, and user credentials.</p>
<button class="btn variant-filled-error w-full" onclick={() => goto('/core/users')}>
<a class="btn variant-filled-error w-full" href="/core/users">
Manage Users
</button>
</a>
</div>
<!-- Person Management Card -->
<div class="card p-4 space-y-4 variant-soft-warning md:col-span-2 lg:col-span-1">
<div class="flex justify-between items-center">
<div class="flex items-center gap-2">
<Users size={20} />
<h3 class="h4">People</h3>
</div>
<button
type="button"
onclick={async () => {
if (!confirm(`Add a new person to ${$ae_loc.account_name}?`)) return;
let person_data = {
account_id_random: $slct.account_id,
source_code: 'manual:SK-core',
given_name: 'New',
family_name: 'Person',
enable: true
};
let new_person_obj = await core_func.create_ae_obj__person({
api_cfg: $ae_api,
data_kv: person_data,
log_lvl: 1
});
if (new_person_obj && confirm(`Person created. View details?`)) {
goto(`/core/person/${new_person_obj.person_id_random}`);
}
}}
class="btn variant-filled-warning btn-sm"
class:hidden={!$ae_loc.edit_mode}
>
<Plus size={16} class="mr-1" /> Add
</button>
<div class="card p-4 space-y-4 variant-soft-warning">
<div class="flex items-center gap-2">
<Users size={20} />
<h3 class="h4">People</h3>
</div>
<p class="text-sm opacity-80">Search and manage person records.</p>
<Comp_person_search on_results={(results) => {
person_id_random_li = results.map(p => p.person_id_random);
$ae_sess.person.show_report__person_li = true;
}} />
<p class="text-sm opacity-80 text-balance">Search and manage person records and their user linking.</p>
<a class="btn variant-filled-warning w-full" href="/core/people">
Manage People
</a>
</div>
<!-- Lookups Card -->
@@ -113,26 +77,9 @@
<h3 class="h4">Lookups</h3>
</div>
<p class="text-sm opacity-80 text-balance">View system lookup tables (countries, time zones, etc).</p>
<button class="btn variant-filled-surface w-full" onclick={() => goto('/core/lookups')}>
<a class="btn variant-filled-surface w-full" href="/core/lookups">
View Lookups
</button>
</a>
</div>
</div>
<!-- Show people results -->
{#if $ae_sess.person.show_report__person_li}
<div class="space-y-4">
<div class="flex justify-between items-center">
<h3 class="h4">Search Results ({person_id_random_li.length})</h3>
<button class="btn btn-sm variant-soft" onclick={() => $ae_sess.person.show_report__person_li = false}>Clear</button>
</div>
<div class="card p-4 variant-soft">
<Comp_person_obj_tbl
bind:person_id_random_li
show_user_fields={$ae_loc.administrator_access}
></Comp_person_obj_tbl>
</div>
</div>
{/if}
</section>