Karyawan · Detail

One employee: profile, tabs (Ringkasan, Cuti, Dokumen, Gaji, Akun login), the Ubah panels, archive and upload.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/screen-karyawan-detail.json
Buka layar penuh

When to use

  • One employee for the admin / HR: who they are, their job, leave, documents, pay and login account, and the edits to them.
  • The target of "Lihat detail" in the Karyawan list row menu (onRowAction(id, "detail")) and of "Lihat data" in the toast after Tambah karyawan.
  • An archived person opens the same page, read-only, with "Pulihkan".

When not to use

  • Many people at once → Karyawan · Daftar (the list), not prev / next through 48 records.
  • The signed-in employee's own data → Profil saya (a later phase): the same cards with access "request" / "locked".
  • A leave request or a payslip on its own → the Cuti and Gaji modules; here they are summaries with a link.

Built from

Usage

The screen is the page content only. Put it inside AppShell (once, in your layout) and pass your data.

page.tsx
import { AppShell } from "@/components/mahr/app-shell"import { KaryawanDetail } from "@/components/screens/karyawan-detail/karyawan-detail"import { Toaster } from "@/components/ui/sonner"import Link from "next/link"export default function Page({ params }: { params: { no: string } }) {  const { data, isLoading, error, refetch } = useEmployee(params.no) // + position in the list the user came from  return (    <AppShell role="admin" activeItem="karyawan" title="Karyawan" company={company} user={me}>      <KaryawanDetail        status={error ? "error" : isLoading ? "loading" : "ready"}        data={data}        error={error && { code: error.code, at: error.at }}        onRetry={refetch}        listRender={<Link href={listUrlWithQuery} />} // "‹ Semua karyawan" keeps the list's tab, search and page        onNavigate={(dir) => router.push(neighbourUrl(dir))}        onSaveJob={(form) => updateJob(params.no, form)} // each save: the button says "Menyimpan…" until it settles, then a toast        onSavePersonal={(form) => updatePersonal(params.no, form)}        onSavePay={(form) => updatePay(params.no, form)}        onArchive={(form) => archive(params.no, form)} // then pass the archived record: the page becomes read-only        onRestore={() => restore(params.no)}        onUpload={(form, onProgress) => uploadDocument(params.no, form, onProgress)}        onDocumentAction={(id, action) => action === "hapus" ? confirmDelete(id) : download(id)} // confirm with a destructive Dialog        onAccountAction={(action) => handleAccount(action)} // "nonaktifkan": a destructive Dialog first      />      <Toaster />    </AppShell>  )}

Installation

Adds the screen, its parts and its types. The components it uses come with it (registry dependencies).

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/screen-karyawan-detail.json

API

import { KaryawanDetail } from "@/components/screens/karyawan-detail/karyawan-detail"
PropTypeDefaultDescription
status"ready" | "loading" | "error"–loading keeps every box at its ready height (header row 44, profile card 174, tabs 44, Ringkasan cards). error = the header row + LoadError illustrated.
dataKaryawanDetailData–{ employee, position, today, payRun, departments, locations, managers, banks }. employee holds job, personal data, leave, documents, pay (components first = Gaji pokok), account and archived. See types.ts.
error · onRetry{ code; at } · () => void–Support line under "Coba lagi": "Kode: EMP-500 · 16 Des 2026, 09.41".
listHref · listRenderstring · ReactElement"/karyawan" · –"‹ Semua karyawan" (BackButton, a real link). Keep the list query in it.
onNavigate(direction: "prev" | "next") => void–Prev / next in the list order; disabled at the ends (data.position).
onTabChange(tab: TabId) => void–Ringkasan · Cuti · Dokumen · Gaji · Akun login. A tab change hides the salary again.
onSaveJob · onSavePersonal · onSavePay(form) => void | Promise–The Ubah Sheets. Return a promise: "Menyimpan…" until it settles, then the panel closes and a toast says what was saved (no action). Pass the new record in data.
onArchive · onRestore(form: ArchiveForm) => void | Promise · () => void–Arsipkan (menu) opens a Sheet: Alasan keluar, Alasan lain (Lainnya), Tanggal keluar. After it, pass the archived record: the page is read-only with "Pulihkan".
onUpload(form: UploadForm, onProgress) => Promise–PDF, JPG or PNG up to 5 MB (checked when chosen). Call onProgress(0–100). Then the panel closes, the new row is first with a short tint, toast "Dokumen diunggah".
onDocumentAction · onAccountAction(id, "unduh" | "hapus") · ("atur-ulang-sandi" | "kirim-undangan" | "nonaktifkan")–Callbacks only: the app confirms "hapus" and "nonaktifkan" with a destructive Dialog on the page (never on a Sheet).
onDownloadPdf · onEditLeaveBalance · onRecordLeave · onOpenSlip · onDownloadSlipcallbacks–Menu "Unduh data karyawan (PDF)"; "Ubah saldo" and "Catat cuti" (Cuti module panels); "Lihat slip gaji" (slip id, or null for all); "Unduh" in the slip list.
defaultUi{ tab?, revealed?, menuOpen?, panel?, toast?, newDocumentId? }–Start UI state for previews and tests only.