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:
@@ -17,6 +17,7 @@
|
||||
api_cfg: $ae_api,
|
||||
for_obj_id: $ae_loc.account_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
log_lvl: 1
|
||||
});
|
||||
loading = false;
|
||||
|
||||
@@ -111,21 +111,32 @@
|
||||
{#if show_user_fields}
|
||||
<td class="px-4 py-2">
|
||||
{#if person_obj?.user_id_random}
|
||||
<span class="fas fa-user"></span>
|
||||
<a
|
||||
href="/core/users/{person_obj?.user_id_random}"
|
||||
class="text-blue-500 underline hover:text-blue-800"
|
||||
>
|
||||
{@html person_obj?.username ?? ae_snip.html__not_set}
|
||||
</a>
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="font-bold flex items-center gap-1">
|
||||
<span class="fas fa-user-check text-success-500"></span>
|
||||
<a
|
||||
href="/core/users/{person_obj?.user_id_random}"
|
||||
class="text-blue-500 underline hover:text-blue-800"
|
||||
>
|
||||
{@html person_obj?.username ?? '-- no username --'}
|
||||
</a>
|
||||
</span>
|
||||
<span class="text-[10px] opacity-50 font-mono">{person_obj.user_id_random}</span>
|
||||
</div>
|
||||
{: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}
|
||||
</td>
|
||||
<td class="px-4 py-2">
|
||||
{person_obj?.user_super ? 'Super' : ''}
|
||||
{person_obj?.user_manager ? 'Manager' : ''}
|
||||
{person_obj?.user_administrator ? 'Administrator' : ''}
|
||||
<div class="flex flex-wrap gap-1">
|
||||
{#if person_obj?.user_super}<span class="badge variant-filled-error text-[10px]">Super</span>{/if}
|
||||
{#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>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
api_cfg: $ae_api,
|
||||
for_obj_id: $ae_loc.account_id,
|
||||
enabled: 'all',
|
||||
hidden: 'all',
|
||||
log_lvl: 1
|
||||
});
|
||||
loading = false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { ae_api, ae_loc } from '$lib/stores/ae_stores';
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
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 {
|
||||
person?: ae_Person | null;
|
||||
@@ -31,6 +31,7 @@
|
||||
phone: person?.phone ?? '',
|
||||
tagline: person?.tagline ?? '',
|
||||
notes: person?.notes ?? '',
|
||||
user_id_random: person?.user_id_random ?? '',
|
||||
enable: person?.enable ?? true,
|
||||
hide: person?.hide ?? false,
|
||||
priority: person?.priority ?? false
|
||||
@@ -60,6 +61,7 @@
|
||||
primary_email: formData.primary_email.trim() || null,
|
||||
tagline: formData.tagline.trim() || null,
|
||||
notes: formData.notes.trim() || null,
|
||||
user_id_random: formData.user_id_random.trim() || null,
|
||||
allow_auth_key: true,
|
||||
enable: formData.enable,
|
||||
hide: formData.hide,
|
||||
@@ -250,6 +252,27 @@
|
||||
<textarea class="textarea placeholder-surface-400" rows="3" bind:value={formData.notes} placeholder="Additional details..."></textarea>
|
||||
</label>
|
||||
</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>
|
||||
|
||||
<footer class="flex justify-end gap-2 border-t border-surface-500/30 pt-4">
|
||||
|
||||
Reference in New Issue
Block a user