Migrate Event Badges to V3 and implement Core Management pages

- Completed V3 migration for Event Badge CRUD operations
- Implemented User module V3 logic and editable fields
- Created management routes for Accounts, Sites, Users, and Lookups
- Updated Site Domain logic to use 'fqdn' and show 'access_key'
- Modernized Core Dashboard with navigation cards
- Restored Dexie User table definition
This commit is contained in:
Scott Idem
2026-01-06 13:38:47 -05:00
parent 1b318eeb8b
commit 00e80af3a1
29 changed files with 3800 additions and 218 deletions

View File

@@ -0,0 +1,133 @@
<script lang="ts">
import { onMount } from 'svelte';
import { load_ae_obj_li__site, create_ae_obj__site } from '$lib/ae_core/ae_core__site';
import { ae_api, ae_loc, slct } from '$lib/stores/ae_stores';
import { goto } from '$app/navigation';
import { Plus, Search, Globe } from 'lucide-svelte';
let site_li: any[] = $state([]);
let loading = $state(true);
let qry_enabled = $state('all');
let qry_hidden = $state('all');
async function load_sites() {
if (!$ae_loc.account_id) return;
loading = true;
site_li = await load_ae_obj_li__site({
api_cfg: $ae_api,
for_obj_id: $ae_loc.account_id,
enabled: qry_enabled as any,
hidden: qry_hidden as any,
log_lvl: 1
});
loading = false;
}
onMount(() => {
load_sites();
});
async function handle_add_site() {
const name = prompt('Enter new site name:');
if (!name) return;
const code = prompt('Enter site code (optional):');
const new_site = await create_ae_obj__site({
api_cfg: $ae_api,
account_id: $ae_loc.account_id,
data_kv: {
name,
code: code || undefined,
enable: true
},
log_lvl: 1
});
if (new_site) {
load_sites();
}
}
</script>
<div class="container mx-auto p-4 space-y-4">
<header class="flex justify-between items-center">
<div class="flex items-center gap-2">
<Globe size={24} />
<h1 class="h2">Site Management</h1>
</div>
<button class="btn variant-filled-primary" onclick={handle_add_site}>
<Plus size={16} class="mr-2" /> Add Site
</button>
</header>
<div class="card p-4 variant-soft flex flex-wrap gap-4 items-end">
<label class="label">
<span>Enabled Status</span>
<select class="select" bind:value={qry_enabled} onchange={load_sites}>
<option value="all">All</option>
<option value="enabled">Enabled Only</option>
<option value="not_enabled">Disabled Only</option>
</select>
</label>
<label class="label">
<span>Hidden Status</span>
<select class="select" bind:value={qry_hidden} onchange={load_sites}>
<option value="all">All</option>
<option value="not_hidden">Not Hidden Only</option>
<option value="hidden">Hidden Only</option>
</select>
</label>
<button class="btn variant-filled-secondary" onclick={load_sites} disabled={loading}>
<Search size={16} class="mr-2" /> Refresh
</button>
</div>
{#if loading}
<div class="flex justify-center p-12">
<div class="placeholder animate-pulse w-full h-32"></div>
</div>
{:else if site_li.length === 0}
<div class="card p-8 text-center">
<p>No sites found for this account matching your filters.</p>
</div>
{:else}
<div class="table-container">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Code</th>
<th>Created</th>
<th>Status</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
{#each site_li as site}
<tr>
<td>{site.name}</td>
<td><code class="code">{site.code || '--'}</code></td>
<td>{new Date(site.created_on).toLocaleDateString()}</td>
<td>
{#if site.enable}
<span class="badge variant-filled-success">Enabled</span>
{:else}
<span class="badge variant-filled-error">Disabled</span>
{/if}
{#if site.hide}
<span class="badge variant-filled-warning">Hidden</span>
{/if}
</td>
<td class="text-right">
<button class="btn btn-sm variant-soft-primary" onclick={() => goto(`/core/sites/${site.site_id_random}`)}>
Manage
</button>
</td>
</tr>
{/each}
</tbody>
</table>
</div>
{/if}
</div>