refactor: implement key-based retrieval for empty state headings in Filament resources to enhance localization and maintainability

This commit is contained in:
Yoga Pangestu 2026-04-06 09:45:09 +07:00
parent 3a5ef20334
commit 745b6d21be
25 changed files with 129 additions and 1 deletions

View File

@ -175,6 +175,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedEnvelope)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('contact.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('contact.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -65,6 +65,7 @@ public function table(Table $table): Table
->visible(fn (CooperationMedia $record): bool => $record->status === ApprovalStatus::ACCEPTED && $record->payment()->exists()),
])
->emptyStateIcon(Heroicon::OutlinedNewspaper)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.media_data_empty_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.media_data_empty'))
->defaultSort('created_at', 'desc');
}

View File

@ -66,6 +66,7 @@ public function table(Table $table): Table
->headerActions([])
->recordActions([])
->emptyStateIcon(Heroicon::OutlinedCreditCard)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.payment_empty_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.payment_empty'))
->defaultSort('created_at', 'desc');
}

View File

@ -115,6 +115,7 @@ public function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedDocumentText)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.proposal_empty_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.proposal_empty'))
->defaultSort('created_at', 'desc');
}

View File

@ -219,6 +219,7 @@ public function table(Table $table): Table
])
->toolbarActions([])
->emptyStateIcon(Heroicon::OutlinedInboxArrowDown)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.report_empty_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.report_empty'))
->defaultSort('created_at', 'desc');
}

View File

@ -104,6 +104,7 @@ public function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedArchiveBoxXMark)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.assignment_empty_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.assignment_empty'));
}
}

View File

@ -287,6 +287,7 @@ public static function configure(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedHandRaised)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('cooperation.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('cooperation.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -268,6 +268,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedDocumentText)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('data_change.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('data_change.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -207,6 +207,7 @@ public static function table(Table $table): Table
])->visible(fn () => ! (in_array(auth()->user()->company?->verificationRequest?->status, [VerificationStatus::PENDING, VerificationStatus::REJECTED]) || auth()->user()->company?->verificationRequest()->pending()->exists())),
])
->emptyStateIcon(Heroicon::OutlinedIdentification)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('journalist.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('journalist.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -415,6 +415,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedBuildingOffice2)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('company.partner_empty_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('company.partner_empty'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -111,6 +111,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedListBullet)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('category.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('category.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -111,6 +111,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedBookOpen)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('classification.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('classification.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -122,6 +122,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedBuildingLibrary)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('opd.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('opd.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -111,6 +111,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedMapPin)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('locus.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('locus.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -132,7 +132,8 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedQueueList)
->emptyStateDescription(fn () => CheerfulNotification::getByKey('user.empty_state'))
->emptyStateHeading(fn () => CheerfulNotification::getByKey('classification.sub.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('classification.sub.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)
->paginated([25, 50, 100, 'all'])

View File

@ -129,6 +129,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedNumberedList)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('locus.sub.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('locus.sub.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -105,6 +105,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedPuzzlePiece)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('theme.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('theme.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -192,6 +192,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedUserGroup)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('user.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('user.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -201,6 +201,7 @@ public static function configure(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedClipboardDocumentList)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('content.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('content.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -229,6 +229,7 @@ public static function configure(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedExclamationCircle)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('issue.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('issue.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -214,6 +214,7 @@ public static function configure(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedClipboardDocumentCheck)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('news.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('news.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -162,6 +162,7 @@ public static function table(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedMegaphone)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('announcement.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('announcement.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -115,6 +115,7 @@ public static function configure(Table $table): Table
]),
])
->emptyStateIcon(Heroicon::OutlinedNewspaper)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('news.content.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('news.content.empty_state'))
->defaultSort('created_at', 'desc')
->deferFilters(false)

View File

@ -168,6 +168,7 @@ public static function table(Table $table): Table
], FiltersLayout::AboveContentCollapsible)
->filtersFormColumns(3)
->emptyStateIcon(Heroicon::OutlinedChartBar)
->emptyStateHeading(fn () => CheerfulNotification::getByKey('visitor.empty_state_heading'))
->emptyStateDescription(fn () => CheerfulNotification::getByKey('visitor.empty_state'))
->defaultSort('date', 'desc')
->deferFilters(false)

View File

@ -565,6 +565,14 @@
'formal' => 'Silakan masukkan alasan Anda melakukan perubahan profil perusahaan.',
],
],
'partner_empty' => [
'cheerful' => 'Belum ada data rekanan nih! Masih menunggu rekanan bergabung. 🤝✨',
'formal' => 'Belum ada data rekanan yang tersedia saat ini.',
],
'partner_empty_heading' => [
'cheerful' => 'Belum Ada Data Rekanan! 🤝✨',
'formal' => 'Tidak Ada Data Rekanan',
],
],
'data_change' => [
'existing' => [
@ -607,6 +615,14 @@
'formal' => 'Pengguna :name telah mengajukan perubahan data.',
],
],
'empty_state' => [
'cheerful' => 'Belum ada pengajuan perubahan data nih! 🚀✨',
'formal' => 'Belum ada pengajuan perubahan data yang tersedia.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Pengajuan Perubahan! 📂✨',
'formal' => 'Tidak Ada Pengajuan Perubahan',
],
],
'enum' => [
'news_status' => [
@ -721,6 +737,10 @@
'cheerful' => 'Belum ada data Pengunjung nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Pengunjung yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Pengunjung! 👤✨',
'formal' => 'Tidak Ada Data Pengunjung',
],
],
'content' => [
'section_title' => [
@ -743,6 +763,10 @@
'cheerful' => 'Belum ada data Rekap Konten nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Rekap Konten yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Rekap Konten! 📝✨',
'formal' => 'Tidak Ada Data Rekap Konten',
],
],
'crawl' => [
'success' => [
@ -775,6 +799,10 @@
'cheerful' => 'Belum ada data Monitoring Media nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Monitoring Media yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Monitoring Media! 📰✨',
'formal' => 'Tidak Ada Monitoring Media',
],
'content' => [
'title' => [
'cheerful' => 'Konten Berita ✍️',
@ -796,6 +824,10 @@
'cheerful' => 'Belum ada data Berita nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Berita yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Berita! 🗞️✨',
'formal' => 'Tidak Ada Data Berita',
],
'fetch_success' => [
'cheerful' => 'Mantap! Ada :count berita baru nih tentang \':data__keyword\' di Purwakarta. Databasenya makin kaya! 😎',
'formal' => 'Berhasil mendapatkan :count berita baru terkait kata kunci \':data__keyword\'.',
@ -827,6 +859,10 @@
'cheerful' => 'Belum ada data Manajemen Isu nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Manajemen Isu yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Manajemen Isu! 📊✨',
'formal' => 'Tidak Ada Manajemen Isu',
],
],
'user' => [
'activated' => [
@ -849,6 +885,10 @@
'cheerful' => 'Belum ada data pengguna nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Pengguna! 👥✨',
'formal' => 'Tidak Ada Data Pengguna',
],
'create_title' => [
'cheerful' => 'Tambah Pengguna Baru 🚀✨',
'formal' => 'Tambah Pengguna',
@ -871,6 +911,10 @@
'cheerful' => 'Belum ada data Tema nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Tema yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Tema! 📂✨',
'formal' => 'Tidak Ada Data Tema',
],
],
'category' => [
'create_title' => [
@ -885,6 +929,10 @@
'cheerful' => 'Belum ada data Kategori nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Kategori yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Kategori! 🏷️✨',
'formal' => 'Tidak Ada Data Kategori',
],
],
'classification' => [
'create_title' => [
@ -899,11 +947,19 @@
'cheerful' => 'Belum ada data Klasifikasi nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Klasifikasi yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Klasifikasi! 📂✨',
'formal' => 'Tidak Ada Data Klasifikasi',
],
'sub' => [
'empty_state' => [
'cheerful' => 'Belum ada data Subklasifikasi nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Subklasifikasi! 📑✨',
'formal' => 'Tidak Ada Data Subklasifikasi',
],
'create_title' => [
'cheerful' => 'Tambah Subklasifikasi Baru 📑✨',
'formal' => 'Tambah Subklasifikasi',
@ -919,6 +975,10 @@
'cheerful' => 'Belum ada data Lokus nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Lokus yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Lokus! 📍✨',
'formal' => 'Tidak Ada Data Lokus',
],
'create_title' => [
'cheerful' => 'Tambah Lokus Baru 📍✨',
'formal' => 'Tambah Lokus',
@ -940,6 +1000,10 @@
'cheerful' => 'Belum ada data Sublokus nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Sublokus yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Sublokus! 📌✨',
'formal' => 'Tidak Ada Data Sublokus',
],
],
],
'opd' => [
@ -955,6 +1019,10 @@
'cheerful' => 'Belum ada data OPD nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data OPD yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data OPD! 🏢✨',
'formal' => 'Tidak Ada Data OPD',
],
],
'status' => [
'updated' => [
@ -1183,10 +1251,18 @@
'cheerful' => 'Ups! Belum ada data pembayaran yang tercatat nih. Sabar ya! 💸✨',
'formal' => 'Belum ada data pembayaran yang tersedia saat ini.',
],
'payment_empty_heading' => [
'cheerful' => 'Belum Ada Pembayaran! 💸',
'formal' => 'Tidak Ada Data Pembayaran',
],
'media_data_empty' => [
'cheerful' => 'Daftar media pendukung masih kosong nih! Yuk, tambahkan media sekarang. 📰✨',
'formal' => 'Belum ada data media yang tersedia.',
],
'media_data_empty_heading' => [
'cheerful' => 'Belum Ada Media! 📰',
'formal' => 'Tidak Ada Data Media',
],
'proposal_deleted' => [
'cheerful' => 'Proposal Dihapus! 🗑️',
'formal' => 'Proposal Dihapus',
@ -1199,6 +1275,10 @@
'cheerful' => 'Belum ada proposal yang masuk nih! Tenang, nanti juga ada yang tertarik kok. ✨🚀',
'formal' => 'Belum ada data proposal yang diajukan saat ini.',
],
'proposal_empty_heading' => [
'cheerful' => 'Belum Ada Proposal! 📄',
'formal' => 'Tidak Ada Data Proposal',
],
'create_report_title' => [
'cheerful' => 'Sampaikan Laporan Baru 📝🚀',
'formal' => 'Buat Laporan Baru',
@ -1219,6 +1299,10 @@
'cheerful' => 'Belum ada laporan yang dikirimkan nih! Yuk, kirimkan hasil kerjamu sekarang juga! 🚀✨',
'formal' => 'Belum ada data laporan yang diajukan saat ini.',
],
'report_empty_heading' => [
'cheerful' => 'Belum Ada Laporan! 📝',
'formal' => 'Tidak Ada Data Laporan',
],
'assignment_success' => [
'cheerful' => 'Penugasan Dibuat! 🚀✨',
'formal' => 'Penugasan Berhasil',
@ -1255,10 +1339,18 @@
'cheerful' => 'Belum ada penugasan nih! Mari buat penugasan pertama untuk media. 🚀✨',
'formal' => 'Tidak ada data penugasan yang tersedia.',
],
'assignment_empty_heading' => [
'cheerful' => 'Belum Ada Penugasan! 📋',
'formal' => 'Tidak Ada Data Penugasan',
],
'empty_state' => [
'cheerful' => 'Belum ada data kerja sama nih. Yuk, mulai buat data pertama Anda! 🤝✨',
'formal' => 'Belum ada data kerja sama yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Kerja Sama! 🤝✨',
'formal' => 'Tidak Ada Data Kerja Sama',
],
'new_report' => [
'cheerful' => 'Ada Laporan Baru! 📝✨',
'formal' => 'Laporan Kerja Sama Baru',
@ -1341,6 +1433,10 @@
'cheerful' => 'Belum ada data Jurnalis nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Jurnalis yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Data Jurnalis! 👤✨',
'formal' => 'Tidak Ada Data Jurnalis',
],
],
'access' => [
'restricted' => [
@ -1397,6 +1493,10 @@
'cheerful' => 'Belum ada kontak atau pesan masuk nih! Santai dulu yuk. ✨✅',
'formal' => 'Belum ada kontak atau pesan masuk yang tersedia.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Pesan Masuk! ✉️✨',
'formal' => 'Tidak Ada Pesan Masuk',
],
],
'announcement' => [
'create_title' => [
@ -1411,6 +1511,10 @@
'cheerful' => 'Belum ada data Pengumuman nih! Mulai buat data pertama sekarang biar makin rame! 🚀✨',
'formal' => 'Belum ada data Pengumuman yang tersedia saat ini.',
],
'empty_state_heading' => [
'cheerful' => 'Belum Ada Pengumuman! 📢✨',
'formal' => 'Tidak Ada Pengumuman',
],
],
'notification' => [
'proposal_from_rejected' => [