Fix Exhibit Licensee list parsing and standardize terminology
- Hardened 'Comp_exhibit_license_list' to handle both raw JSON and IDB object formats. - Updated all labels to 'Licensed Leads User' or 'Licensee' for consistency. - Verified Admin-only restriction for the licensee management section. - Fixed silent parsing failures that caused empty staff lists.
This commit is contained in:
@@ -23,7 +23,20 @@
|
|||||||
// Parse JSON into local state
|
// Parse JSON into local state
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
try {
|
try {
|
||||||
const parsed = JSON.parse(license_li_json || '[]');
|
const raw = license_li_json;
|
||||||
|
if (!raw) {
|
||||||
|
untrack(() => local_license_li = []);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle both string and pre-parsed array/object formats
|
||||||
|
let parsed = [];
|
||||||
|
if (Array.isArray(raw)) {
|
||||||
|
parsed = raw;
|
||||||
|
} else if (typeof raw === 'string') {
|
||||||
|
parsed = JSON.parse(raw || '[]');
|
||||||
|
}
|
||||||
|
|
||||||
untrack(() => {
|
untrack(() => {
|
||||||
local_license_li = Array.isArray(parsed) ? parsed : [];
|
local_license_li = Array.isArray(parsed) ? parsed : [];
|
||||||
});
|
});
|
||||||
@@ -141,7 +154,7 @@
|
|||||||
onclick={add_license}
|
onclick={add_license}
|
||||||
disabled={local_license_li.length >= (license_max || 1)}
|
disabled={local_license_li.length >= (license_max || 1)}
|
||||||
>
|
>
|
||||||
<Plus size="1.2em" class="mr-2" /> Add Staff License
|
<Plus size="1.2em" class="mr-2" /> Add Leads Licensee
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -230,8 +230,8 @@
|
|||||||
<div class="flex items-center gap-4">
|
<div class="flex items-center gap-4">
|
||||||
<div class="bg-primary-500/10 p-2 rounded-lg text-primary-500"><Users size="1.2em" /></div>
|
<div class="bg-primary-500/10 p-2 rounded-lg text-primary-500"><Users size="1.2em" /></div>
|
||||||
<div class="text-left">
|
<div class="text-left">
|
||||||
<div class="font-bold text-sm">Exhibit Staff Licenses</div>
|
<div class="font-bold text-sm">Exhibit Leads Licensees</div>
|
||||||
<div class="text-xs opacity-50">Manage assigned staff and codes (Admin Only)</div>
|
<div class="text-xs opacity-50">Manage assigned users and codes (Admin Only)</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{#if show_license_mgmt}
|
{#if show_license_mgmt}
|
||||||
|
|||||||
Reference in New Issue
Block a user