Standardize Core UI forms and unify schemas for V3 API compatibility

- Implement new Svelte 5 Person, Address, and Contact form components with surgical payload logic.
- Refactor core routes (People, Addresses, Contacts) to support unified Create/Edit workflows.
- Update ae_types.ts, db_core.ts, and db_journals.ts to align with V3 backend object models.
- Fix type safety issues in Journal history views and refine metadata display.
- Migrate person core functions to the newer ae_core__person module.
This commit is contained in:
Scott Idem
2026-01-09 15:14:36 -05:00
parent 8e205b2db9
commit 5056d5d8f0
18 changed files with 1276 additions and 944 deletions

View File

@@ -2,11 +2,13 @@
import { onMount } from 'svelte';
import { ae_loc, ae_api, slct } from '$lib/stores/ae_stores';
import { goto } from '$app/navigation';
import { MapPin, Plus, Search, ExternalLink } from 'lucide-svelte';
import { MapPin, Plus, Search, ExternalLink, X } from 'lucide-svelte';
import { load_ae_obj_li__address, create_ae_obj__address } from '$lib/ae_core/ae_core__address';
import Address_form from './ae_comp__address_form.svelte';
let address_li: any[] = $state([]);
let loading = $state(true);
let show_add_form = $state(false);
async function load_addresses() {
if (!$ae_loc.account_id) return;
@@ -20,27 +22,6 @@
loading = false;
}
async function handle_add() {
const city = prompt('Enter city:');
if (!city) return;
const state_province = prompt('Enter state/province:');
const country = prompt('Enter country:', 'USA');
const result = await create_ae_obj__address({
api_cfg: $ae_api,
account_id: $ae_loc.account_id,
data_kv: { city, state_province, country, enable: true },
log_lvl: 1
});
if (result) {
load_addresses();
if (result.address_id_random) {
goto(`/core/addresses/${result.address_id_random}`);
}
}
}
onMount(() => {
if (!$ae_loc.manager_access) {
goto('/core');
@@ -56,11 +37,30 @@
<MapPin size={24} />
<h1 class="h2">Address Management</h1>
</div>
<button class="btn variant-filled-primary" onclick={handle_add}>
<Plus size={16} class="mr-2" /> Add Address
<button class="btn variant-filled-primary" onclick={() => show_add_form = !show_add_form}>
{#if show_add_form}
<X size={16} class="mr-2" /> Cancel
{:else}
<Plus size={16} class="mr-2" /> Add Address
{/if}
</button>
</header>
{#if show_add_form}
<div class="mb-8">
<Address_form
onSave={(new_addr) => {
show_add_form = false;
load_addresses();
if (new_addr.address_id_random) {
goto(`/core/addresses/${new_addr.address_id_random}`);
}
}}
onCancel={() => show_add_form = false}
/>
</div>
{/if}
{#if loading}
<div class="placeholder animate-pulse h-64 w-full"></div>
{:else if address_li.length === 0}