{#snippet actions()} {/snippet} {#snippet toolbar()}
{ e.preventDefault(); applySearch(); }} > {#if searchInput} {/if}
{/snippet} {#if loading}
{:else} {i18n.t("attributes.col.type")} {i18n.t("attributes.col.unit")} {i18n.t("attributes.col.categories")} {i18n.t("attributes.col.actions")} {#if rootAttributes.length === 0}

{i18n.t("attributes.emptyTitle")}

{#if searchQuery.trim() || categoryFilter} {i18n.t("attributes.emptyFiltered")} {:else} {i18n.t("attributes.emptyHint")} {/if}

{#if searchQuery.trim() || categoryFilter} {:else} {/if}
{:else} {#each rootAttributes as attribute (attribute.id)} {@const key = attrKey(attribute)} {@const hasChildren = isListType(attribute)} {@const isExpanded = expanded.has(key)} {@const children = loadedChildren[key] ?? []} {@const isLoadingKids = loadingChildren.has(key)} {@const hasLoaded = key in loadedChildren} {@const cats = categoryBadges(attribute)}
{#if hasChildren} {/if} {attribute.name} {#if hasChildren && hasLoaded && children.length === 0} {i18n.t("attributes.noValues")} {/if}
{key || i18n.t("status.emDash")} {attributeTypeLabel(attribute.value_type)} {attribute.unit ?? i18n.t("status.emDash")} {#if cats.length === 0} {i18n.t("status.emDash")} {:else if cats.length <= 2}
{#each cats as name} {name} {/each}
{:else}
{cats[0]} +{cats.length - 1}
{/if}
{formatRelative(attribute.updated_at)} {#snippet trigger({ open, toggle })} {/snippet} openEdit(attribute)}>{i18n.t("attributes.editDetails")} {#if hasChildren} void openManageValues(attribute)}> {i18n.t("attributes.manageValues")} {/if} {#if canAdmin} { deleting = attribute; }} > {i18n.t("common.delete")} {/if}
{#if isExpanded && hasChildren} {#if isLoadingKids}
{i18n.t("attributes.loadingValues")}
{:else if children.length > 0} {#each children as child (child.id)}
{child.name}
{attrKey(child)}
{/each} {:else}
{i18n.t("attributes.noValuesYetHint")}
{/if} {/if} {/each} {/if}
{/if} {#snippet footer()} {#if !loading && rootAttributes.length > 0 && !categoryFilter}
{pageLabel}
{/if} {/snippet}
{#if canAdmin} {i18n.t("attributes.tab.single")} {i18n.t("attributes.tab.bulk")} {/if}

{VALUE_TYPES.find((t) => t.value === addType)?.hint ?? i18n.t("attributes.valueTypeHint")}

{i18n.t("attributes.field.categoryHint")}

{#if !isChoiceAttributeType(addType)}
{/if}
{#if error} {/if}
{#if canAdmin}
{ const input = e.currentTarget as HTMLInputElement; addFile = input.files?.[0] ?? null; uploadError = ""; }} required />
{#if uploadError}
{uploadError}
{/if}

{i18n.t("attributes.bulk.uploadHint")}

  • attribute_key: {i18n.t("attributes.bulk.col.key")}
  • name: {i18n.t("attributes.bulk.col.name")}
  • value_type: {i18n.t("attributes.bulk.col.valueType")}
  • category_id: {i18n.t("attributes.bulk.col.categoryId")}
  • unit / example: {i18n.t("attributes.bulk.col.unitExample")}
  • parent_key: {i18n.t("attributes.bulk.col.parentKey")}
{/if}
(editing = null)} > {#if editing}

{i18n.t("attributes.field.keyHint")}

{i18n.t("attributes.field.displayNameHint")}

{#if !isListType(editing)}
{/if}
{#if error} {/if}
{/if}
(deleting = null)} > {#if deleting && isListType(deleting)}

{i18n.t("attributes.deleteWarningValues")}

{/if} {#snippet footer()} {/snippet}
{ manageValuesAttr = null; cancelEditValue(); }} >

{i18n.t("attributes.valueKeyHint")}

{i18n.t("attributes.displayValueHint")}

{#if editingValue} {/if}
{i18n.t("attributes.valueKey")} {i18n.t("attributes.displayValue")} {i18n.t("attributes.col.actions")} {#each listValues as value (value.id)} {attrKey(value)} {value.name}
{#if canAdmin} {/if}
{:else} {i18n.t("attributes.noValuesYet")} {/each}
{ bulkFile = null; bulkStatus = "idle"; bulkError = ""; }} >
{ const input = e.currentTarget as HTMLInputElement; bulkFile = input.files?.[0] ?? null; bulkStatus = "idle"; bulkError = ""; }} required />
{#if bulkError}
{bulkError}
{/if} {#if bulkStatus === "success"}
{i18n.t("attributes.assignSuccess")}
{/if}