feat(core): enhance Person management and modernize Address/Contact lists

- Improved Person table with 'Not Linked' badge for better visibility.
- Updated Person form with 'prefix' field and direct User account linking.
- Standardized Address and Contact list views to show all records (enabled/hidden).
- Amending previous refactor to include all verified import and type fixes.
This commit is contained in:
Scott Idem
2026-01-15 14:36:25 -05:00
parent 74d107f157
commit df9e14d896
4 changed files with 48 additions and 12 deletions

View File

@@ -17,6 +17,7 @@
api_cfg: $ae_api, api_cfg: $ae_api,
for_obj_id: $ae_loc.account_id, for_obj_id: $ae_loc.account_id,
enabled: 'all', enabled: 'all',
hidden: 'all',
log_lvl: 1 log_lvl: 1
}); });
loading = false; loading = false;

View File

@@ -111,21 +111,32 @@
{#if show_user_fields} {#if show_user_fields}
<td class="px-4 py-2"> <td class="px-4 py-2">
{#if person_obj?.user_id_random} {#if person_obj?.user_id_random}
<span class="fas fa-user"></span> <div class="flex flex-col gap-1">
<a <span class="font-bold flex items-center gap-1">
href="/core/users/{person_obj?.user_id_random}" <span class="fas fa-user-check text-success-500"></span>
class="text-blue-500 underline hover:text-blue-800" <a
> href="/core/users/{person_obj?.user_id_random}"
{@html person_obj?.username ?? ae_snip.html__not_set} class="text-blue-500 underline hover:text-blue-800"
</a> >
{@html person_obj?.username ?? '-- no username --'}
</a>
</span>
<span class="text-[10px] opacity-50 font-mono">{person_obj.user_id_random}</span>
</div>
{:else} {:else}
{@html ae_snip.html__not_set} <span class="badge variant-soft-warning">
<span class="fas fa-link-slash mr-1"></span>
Not Linked
</span>
{/if} {/if}
</td> </td>
<td class="px-4 py-2"> <td class="px-4 py-2">
{person_obj?.user_super ? 'Super' : ''} <div class="flex flex-wrap gap-1">
{person_obj?.user_manager ? 'Manager' : ''} {#if person_obj?.user_super}<span class="badge variant-filled-error text-[10px]">Super</span>{/if}
{person_obj?.user_administrator ? 'Administrator' : ''} {#if person_obj?.user_manager}<span class="badge variant-filled-warning text-[10px]">Manager</span>{/if}
{#if person_obj?.user_administrator}<span class="badge variant-filled-primary text-[10px]">Admin</span>{/if}
{#if !person_obj?.user_id_random}<span class="opacity-30">--</span>{/if}
</div>
</td> </td>
{/if} {/if}

View File

@@ -17,6 +17,7 @@
api_cfg: $ae_api, api_cfg: $ae_api,
for_obj_id: $ae_loc.account_id, for_obj_id: $ae_loc.account_id,
enabled: 'all', enabled: 'all',
hidden: 'all',
log_lvl: 1 log_lvl: 1
}); });
loading = false; loading = false;

View File

@@ -7,7 +7,7 @@
import { ae_api, ae_loc } from '$lib/stores/ae_stores'; import { ae_api, ae_loc } from '$lib/stores/ae_stores';
import { core_func } from '$lib/ae_core/ae_core_functions'; import { core_func } from '$lib/ae_core/ae_core_functions';
import type { ae_Person } from '$lib/types/ae_types'; import type { ae_Person } from '$lib/types/ae_types';
import { Save, X, User, Mail, Phone, Building, Briefcase, Tag } from 'lucide-svelte'; import { Save, X, User, Mail, Phone, Building, Briefcase, Tag, Link } from 'lucide-svelte';
interface Props { interface Props {
person?: ae_Person | null; person?: ae_Person | null;
@@ -31,6 +31,7 @@
phone: person?.phone ?? '', phone: person?.phone ?? '',
tagline: person?.tagline ?? '', tagline: person?.tagline ?? '',
notes: person?.notes ?? '', notes: person?.notes ?? '',
user_id_random: person?.user_id_random ?? '',
enable: person?.enable ?? true, enable: person?.enable ?? true,
hide: person?.hide ?? false, hide: person?.hide ?? false,
priority: person?.priority ?? false priority: person?.priority ?? false
@@ -60,6 +61,7 @@
primary_email: formData.primary_email.trim() || null, primary_email: formData.primary_email.trim() || null,
tagline: formData.tagline.trim() || null, tagline: formData.tagline.trim() || null,
notes: formData.notes.trim() || null, notes: formData.notes.trim() || null,
user_id_random: formData.user_id_random.trim() || null,
allow_auth_key: true, allow_auth_key: true,
enable: formData.enable, enable: formData.enable,
hide: formData.hide, hide: formData.hide,
@@ -250,6 +252,27 @@
<textarea class="textarea placeholder-surface-400" rows="3" bind:value={formData.notes} placeholder="Additional details..."></textarea> <textarea class="textarea placeholder-surface-400" rows="3" bind:value={formData.notes} placeholder="Additional details..."></textarea>
</label> </label>
</fieldset> </fieldset>
{#if $ae_loc.manager_access}
<!-- Admin/Linking Section -->
<fieldset class="space-y-4 md:col-span-2 border-t border-surface-500/30 pt-4">
<legend class="text-sm font-bold uppercase tracking-widest opacity-60">System Linking (Managers Only)</legend>
<label class="label max-w-md">
<span>Linked User ID (Random)</span>
<div class="input-group input-group-divider grid-cols-[auto_1fr]">
<div class="input-group-shim"><Link size={16} /></div>
<input
class="input font-mono placeholder-surface-400"
type="text"
bind:value={formData.user_id_random}
placeholder="e.g. AB12CD34"
/>
</div>
<small class="opacity-60 text-xs">Enter the unique random ID of the user account to link to this person.</small>
</label>
</fieldset>
{/if}
</div> </div>
<footer class="flex justify-end gap-2 border-t border-surface-500/30 pt-4"> <footer class="flex justify-end gap-2 border-t border-surface-500/30 pt-4">