👤 User List

Manage and view all users in the system.

{ const searchTerm = (e.target as HTMLInputElement).value; fetchData( "", "created_at", "desc", searchTerm, 0, rowsPerPage, ); }} />
{#each columns as col} {/each} {#if allRows.length === 0} {:else} {#each allRows as row, i} {#each columns as col} {/each} {/each} {/if}
{col.title} Actions
No users found Try adjusting your search or add a new user.
{#if col.key === "no"} {offset + i + 1} {:else if col.key === "is_active" || col.key === "is_verified" || col.key === "is_deleted"} {(row as Record)[col.key] ? "✅" : "❌"} {:else if col.key === "profile_picture"} {#if row.profile_picture} {#if typeof row[col.key] === "string" && row[col.key]} {#await getPublicUrl(row[col.key] as string) then publicUrl} View Picture {:catch} Error loading image {/await} {:else} No Picture {/if} {/if} {:else} {(row as Record)[col.key]} {/if}
Showing {offset + 1}–{Math.min(offset + rowsPerPage, totalItems)} of {totalItems}
{#each Array(totalPages) .fill(0) .map((_, i) => i + 1) as page} {/each}
{#if showModal}

{isEditing ? "Edit User" : "Add New User"}

{#each formColumns as col}
{#if col.key === "role"} {#if $formErrors.role}

{$formErrors.role}

{/if} {:else if col.key === "email"} {#if $formErrors.email}

{$formErrors.email}

{/if} {:else if col.key === "password"} {#if $formErrors.password}

{$formErrors.password}

{/if} {:else if col.key === "phone"} {#if $formErrors.phone}

{$formErrors.phone}

{/if} {:else if col.key === "profile_picture"}
{#if imagePreviewUrl} Preview

Preview of selected image

{:else if newUser.profile_picture} {#await getPublicUrl(newUser.profile_picture) then publicUrl} Profile Picture {:catch} Error loading image {/await} {:else} No Image {/if}
{:else if col.key === "is_active" || col.key === "is_verified" || col.key === "is_deleted"} {:else} {#if $formErrors[col.key]}

{$formErrors[col.key]}

{/if} {/if}
{/each}
{/if}