2026-04-20 22:54:19 +02:00
|
|
|
import { createListPageModule } from '../core/app-list-page-module.js';
|
2026-03-05 08:26:51 +01:00
|
|
|
import { initUsersListPage } from './app-users-list.js';
|
|
|
|
|
import { bindBulkVisibility } from '../components/app-bulk-selection.js';
|
2026-04-22 15:49:10 +02:00
|
|
|
import { initDetailDrawer } from '../components/app-detail-drawer.js';
|
|
|
|
|
import { buildUrl, badgeHtml, escapeHtml, buildBadgeList, withCurrentListReturn } from './app-list-utils.js';
|
2026-03-05 08:26:51 +01:00
|
|
|
import { showAsyncFlash, withLoading } from '../components/app-async-flash.js';
|
|
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
createListPageModule({
|
|
|
|
|
configId: 'admin-users-index',
|
|
|
|
|
moduleId: 'admin-users-index',
|
|
|
|
|
missingGridMessage: 'Users grid init failed: Grid.js missing',
|
|
|
|
|
initErrorMessage: 'Users grid init failed',
|
|
|
|
|
setup: ({ config, gridjs, appBase, initListPage }) => {
|
|
|
|
|
const gridSearch = config.gridSearch ?? null;
|
|
|
|
|
const filterSchema = config.filterSchema ?? [];
|
|
|
|
|
const usersFilterChipMeta = config.filterChipMeta ?? [];
|
|
|
|
|
const currentUserUuid = String(config.currentUserUuid || '');
|
|
|
|
|
const canUpdateUsers = config.canUpdateUsers === true;
|
|
|
|
|
const canUpdateSelf = config.canUpdateSelf === true;
|
|
|
|
|
const csrf = config.csrf ?? null;
|
|
|
|
|
const labels = config.labels ?? {};
|
2026-03-05 08:26:51 +01:00
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
const buildBulkUrl = (action) => buildUrl(appBase, `admin/users/bulk/${action}`);
|
2026-03-05 08:26:51 +01:00
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
const rowSelection = gridjs?.plugins?.selection?.RowSelection;
|
2026-03-05 08:26:51 +01:00
|
|
|
if (!rowSelection) {
|
|
|
|
|
throw new Error('Grid.js RowSelection plugin is not available.');
|
|
|
|
|
}
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
|
|
|
|
|
// Layout:
|
|
|
|
|
// col 0: User compound (display)
|
|
|
|
|
// col 1: Tenants
|
|
|
|
|
// col 2: Last login
|
|
|
|
|
// col 3: State
|
|
|
|
|
// col 4: UUID (hidden scalar)
|
|
|
|
|
// Selection plugin prepends a checkbox cell, so runtime cells[] are
|
|
|
|
|
// shifted by +1. Cell accessors therefore use indices 1..5 (1-based
|
|
|
|
|
// from the user-visible column order + 1 for the selection col).
|
|
|
|
|
const uuidIndex = 5;
|
|
|
|
|
const activeIndex = 4;
|
2026-03-05 08:26:51 +01:00
|
|
|
const canEditRow = (row) => {
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
const uuid = String(row?.cells?.[uuidIndex]?.data ?? '');
|
2026-04-20 22:54:19 +02:00
|
|
|
if (!uuid) { return false; }
|
2026-03-05 08:26:51 +01:00
|
|
|
if (uuid === currentUserUuid) {
|
|
|
|
|
return canUpdateUsers || canUpdateSelf;
|
|
|
|
|
}
|
|
|
|
|
return canUpdateUsers;
|
|
|
|
|
};
|
|
|
|
|
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
const initialsFromUser = (user) => {
|
|
|
|
|
const parts = [user?.firstName, user?.lastName]
|
2026-03-05 08:26:51 +01:00
|
|
|
.map((value) => String(value || '').trim())
|
|
|
|
|
.filter(Boolean);
|
|
|
|
|
const chars = parts.map((value) => value[0] || '').join('').toUpperCase();
|
|
|
|
|
return chars || '?';
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
name: labels.user || 'User',
|
2026-04-22 15:49:10 +02:00
|
|
|
sort: true,
|
|
|
|
|
formatter: (cell, row) => {
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
const uuid = String(row?.cells?.[uuidIndex]?.data ?? '');
|
|
|
|
|
const firstName = String(cell?.firstName ?? '').trim();
|
|
|
|
|
const lastName = String(cell?.lastName ?? '').trim();
|
|
|
|
|
const email = String(cell?.email ?? '').trim();
|
|
|
|
|
const fullName = [firstName, lastName].filter(Boolean).join(' ') || email || '-';
|
|
|
|
|
const avatarHtml = cell?.hasAvatar && uuid
|
|
|
|
|
? `<img class="grid-avatar" src="${new URL(`admin/users/avatar-file?uuid=${encodeURIComponent(uuid)}&size=64`, appBase).toString()}" alt="" loading="lazy">`
|
|
|
|
|
: `<span class="grid-avatar grid-avatar-placeholder">${escapeHtml(initialsFromUser(cell))}</span>`;
|
|
|
|
|
const nameEsc = escapeHtml(fullName);
|
|
|
|
|
const emailEsc = escapeHtml(email);
|
|
|
|
|
const subtitle = email && email !== fullName ? `<small>${emailEsc}</small>` : '';
|
|
|
|
|
const inner = `${avatarHtml}<span class="grid-user-profile-text"><strong>${nameEsc}</strong>${subtitle}</span>`;
|
|
|
|
|
if (!uuid) {
|
|
|
|
|
return gridjs.html(`<div class="grid-user-profile">${inner}</div>`);
|
|
|
|
|
}
|
2026-04-22 15:49:10 +02:00
|
|
|
const editUrl = escapeHtml(withCurrentListReturn(new URL(`admin/users/edit/${uuid}`, appBase).toString()));
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
return gridjs.html(`<a class="grid-user-profile app-grid-link-cell" href="${editUrl}" data-drawer-trigger>${inner}</a>`);
|
2026-04-22 15:49:10 +02:00
|
|
|
},
|
|
|
|
|
},
|
2026-03-05 08:26:51 +01:00
|
|
|
{
|
|
|
|
|
name: labels.tenants || 'Tenants',
|
|
|
|
|
sort: false,
|
|
|
|
|
formatter: (cell) => gridjs.html(buildBadgeList(cell, { primaryTooltip: labels.primaryTenant || '' })),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: labels.lastLogin || 'Last login',
|
|
|
|
|
sort: true,
|
|
|
|
|
formatter: (cell) => badgeHtml(gridjs, cell || labels.never || 'Never'),
|
|
|
|
|
},
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
{
|
|
|
|
|
name: labels.state || 'State',
|
|
|
|
|
sort: true,
|
|
|
|
|
formatter: (cell) => cell
|
|
|
|
|
? gridjs.html(`<span class="badge" data-variant="success">${labels.active || 'Active'}</span>`)
|
|
|
|
|
: gridjs.html(`<span class="badge" data-variant="danger">${labels.inactive || 'Inactive'}</span>`),
|
|
|
|
|
},
|
|
|
|
|
{ name: 'UUID', hidden: true },
|
2026-03-05 08:26:51 +01:00
|
|
|
];
|
|
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
const { gridConfig } = initListPage({
|
|
|
|
|
grid: {
|
|
|
|
|
gridjs,
|
|
|
|
|
container: '#users-grid',
|
|
|
|
|
dataUrl: 'admin/users/data',
|
|
|
|
|
appBase,
|
|
|
|
|
columns,
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
sortColumns: ['first_name', null, 'last_login_at', 'active', null],
|
2026-04-20 22:54:19 +02:00
|
|
|
paginationLimit: 10,
|
|
|
|
|
language: config.gridLang ?? {},
|
|
|
|
|
mapData: (data) => data.data.map((row) => [
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
{
|
|
|
|
|
firstName: row.first_name ?? '',
|
|
|
|
|
lastName: row.last_name ?? '',
|
|
|
|
|
email: row.email ?? '',
|
|
|
|
|
hasAvatar: !!row.has_avatar,
|
|
|
|
|
},
|
2026-04-20 22:54:19 +02:00
|
|
|
row.tenants,
|
|
|
|
|
row.last_login,
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
row.active,
|
|
|
|
|
row.uuid ?? '',
|
2026-04-20 22:54:19 +02:00
|
|
|
]),
|
|
|
|
|
selection: {
|
|
|
|
|
enabled: true,
|
|
|
|
|
id: 'selectRow',
|
|
|
|
|
component: rowSelection,
|
|
|
|
|
selectAllLabel: labels.selectAll || 'Select all',
|
|
|
|
|
props: {
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
id: (row) => String(row.cell(uuidIndex).data ?? ''),
|
2026-04-20 22:54:19 +02:00
|
|
|
},
|
|
|
|
|
getSelectedIds: ({ container }) => {
|
|
|
|
|
if (!container) { return []; }
|
|
|
|
|
return Array.from(container.querySelectorAll('.gridjs-tr-selected'))
|
|
|
|
|
.map((row) => row.getAttribute('data-uuid'))
|
|
|
|
|
.filter(Boolean);
|
|
|
|
|
},
|
2026-03-05 08:26:51 +01:00
|
|
|
},
|
2026-04-20 22:54:19 +02:00
|
|
|
search: gridSearch,
|
|
|
|
|
filterSchema,
|
|
|
|
|
urlSync: true,
|
|
|
|
|
rowDataset: (row) => ({
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
uuid: String(row?.cells?.[uuidIndex]?.data ?? ''),
|
2026-04-20 22:54:19 +02:00
|
|
|
}),
|
2026-04-22 15:49:10 +02:00
|
|
|
rowInteraction: { linkColumn: false },
|
2026-04-20 22:54:19 +02:00
|
|
|
rowDblClick: {
|
|
|
|
|
getUrl: (rowData) => {
|
|
|
|
|
if (!canEditRow(rowData)) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
refactor(admin-lists): slim tenant + user grids, Stripe-style pagination
Tenant list:
- Drop the avatar/logo column — the list now shows only Tenant name
and user count. Also drop the logo-hasLogo server lookup and the
initials/placeholder markup.
User list (13 → 4 columns, Stripe pattern):
- User (compound: avatar + Name + email subtitle, click opens drawer)
- Tenants (badges, primary tooltip)
- Last login (relative badge)
- State (active/inactive badge)
- UUID hidden at the last column for cells[uuidIndex].data
- Everything else (departments, roles, phone, mobile, short_dial,
created, modified) lives in the detail drawer.
- Document the off-by-one gotcha: with row selection enabled gridjs
prepends a checkbox cell, so runtime cells[] are shifted by +1;
uuidIndex is 5 (column position 4 + selection offset).
- New .grid-user-profile css mirrors .grid-tenant-profile (avatar +
stacked name/email) with ellipsis and primary-color hover affordance.
Pagination (all Grid.js lists):
- Non-current page buttons now use the neutral-chip secondary-outline
tokens (--app-button-neutral-*) plus the raised box-shadow — matches
the rest of the button system in both light and dark themes.
- Current page stays distinctly primary-filled with the filled-shadow;
focus-visible combines the chip shadow with the primary focus ring.
- Disabled pager buttons remain neutral but lose the lift shadow.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 21:52:44 +02:00
|
|
|
const uuid = String(rowData?.cells?.[uuidIndex]?.data ?? '');
|
2026-04-20 22:54:19 +02:00
|
|
|
return uuid ? new URL(`admin/users/edit/${uuid}`, appBase).toString() : '';
|
|
|
|
|
},
|
2026-03-05 08:26:51 +01:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
filters: {
|
|
|
|
|
mode: 'drawer',
|
|
|
|
|
chipMeta: usersFilterChipMeta,
|
|
|
|
|
watchInputs: ['#user-search'],
|
|
|
|
|
preserveFilterParamsOnReset: ['tenant'],
|
|
|
|
|
drawer: {
|
|
|
|
|
countExcludeParams: ['tenant'],
|
|
|
|
|
},
|
|
|
|
|
clearMetaOptions: {
|
|
|
|
|
preserveFilterParams: ['tenant'],
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-04-20 22:54:19 +02:00
|
|
|
}) || {};
|
2026-03-05 08:26:51 +01:00
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
const usersGridConfig = gridConfig ? { ...gridConfig, indices: { activeIndex, uuidIndex } } : null;
|
|
|
|
|
initUsersListPage({
|
|
|
|
|
gridConfig: usersGridConfig,
|
|
|
|
|
appBase,
|
|
|
|
|
csrf,
|
|
|
|
|
labels,
|
refactor(admin/users): migrate CSV export to core primitive
Replace the inline export implementation with the new generic primitive
(core/Service/Export + helpers/export + app-list-export.js). No more
hand-rolled fputcsv loop, header setup, or escape closure duplicated
here — one implementation, tested once, reused everywhere.
- export().php: uses exportRequireGetRequest, exportCapLimit,
exportResolveFlavor, ExportColumn[], exportSendCsv. Phone/mobile/
short_dial keep allowSignedNumeric=true so +49 numbers render
untouched.
- export(none).phtml: deleted — headers + fputcsv now live in the
core helper.
- index(default).phtml: inline <details class="dropdown"> "Export CSV"
replaced by the reusable app-list-export-dropdown partial, exposing
CSV and Excel flavors. exportUrl added to pageConfig.
- app-users-list.js: hand-rolled export-button binding removed in
favor of initListExport({ gridConfig, exportUrl }).
- admin-users-index.js: forwards config.exportUrl into
initUsersListPage.
Net effect: ~100 lines of duplicated export plumbing removed from the
users page; users gain the Excel flavor for free.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 21:57:31 +02:00
|
|
|
exportUrl: config.exportUrl,
|
2026-04-20 22:54:19 +02:00
|
|
|
buildBulkUrl,
|
|
|
|
|
bulkDownloadForms: {
|
|
|
|
|
'access-pdf': '#users-access-pdf-bulk-form',
|
|
|
|
|
},
|
|
|
|
|
resetOptions: {
|
|
|
|
|
resetPage: true,
|
|
|
|
|
urlHistoryMode: 'push',
|
|
|
|
|
preserveFilterParams: ['tenant'],
|
|
|
|
|
},
|
|
|
|
|
showFlash: showAsyncFlash,
|
|
|
|
|
withLoading,
|
|
|
|
|
});
|
2026-03-05 08:26:51 +01:00
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
bindBulkVisibility({
|
|
|
|
|
containerSelector: '#users-grid',
|
|
|
|
|
buttonSelector: '[data-users-bulk]',
|
|
|
|
|
});
|
2026-03-05 08:26:51 +01:00
|
|
|
|
2026-04-22 15:49:10 +02:00
|
|
|
initDetailDrawer({
|
|
|
|
|
gridConfig,
|
|
|
|
|
triggerSelector: '[data-drawer-trigger]',
|
|
|
|
|
rowUuidAttr: 'uuid',
|
|
|
|
|
fetchUrl: (uuid) => new URL(`admin/users/view-fragment/${uuid}`, appBase).toString(),
|
|
|
|
|
fullUrl: (uuid) => withCurrentListReturn(new URL(`admin/users/edit/${uuid}`, appBase).toString()),
|
|
|
|
|
hashPrefix: 'user',
|
|
|
|
|
});
|
|
|
|
|
|
2026-04-20 22:54:19 +02:00
|
|
|
return usersGridConfig;
|
|
|
|
|
},
|
|
|
|
|
});
|