feat: Introduce NotifStyle enum for notification customization and update Filament actions to utilize it, enhancing user engagement and clarity across the application.
This commit is contained in:
parent
a31247172f
commit
91d2266a20
@ -4,7 +4,7 @@
|
||||
|
||||
use Filament\Support\Contracts\HasLabel;
|
||||
|
||||
enum UxStyle: string implements HasLabel
|
||||
enum NotifStyle: string implements HasLabel
|
||||
{
|
||||
case CHEERFUL = 'cheerful';
|
||||
case FORMAL = 'formal';
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Filament\Actions\Cheerful;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use Filament\Actions\DeleteAction as ActionsDeleteAction;
|
||||
|
||||
@ -12,12 +12,12 @@ protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->modalHeading(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL
|
||||
$this->modalHeading(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL
|
||||
? 'Betulan Mau Hapus? 🗑️🤔'
|
||||
: 'Hapus Data'
|
||||
);
|
||||
|
||||
$this->modalDescription(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL
|
||||
$this->modalDescription(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL
|
||||
? 'Data ini akan kita lepas ya. Hati-hati, data berelasi juga mungkin bakal ikut berpamitan! 🏃💨'
|
||||
: 'Apakah Anda yakin ingin menghapus data ini secara permanen?'
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Filament\Actions\Cheerful;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use Filament\Actions\ForceDeleteAction as ActionsForceDeleteAction;
|
||||
|
||||
@ -12,12 +12,12 @@ protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->modalHeading(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL
|
||||
$this->modalHeading(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL
|
||||
? 'Yakin Hapus Selamanya? 🗑️🔥'
|
||||
: 'Hapus Permanen'
|
||||
);
|
||||
|
||||
$this->modalDescription(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL
|
||||
$this->modalDescription(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL
|
||||
? 'Data ini bakal hilang dari muka bumi sistem dan nggak bisa balik lagi. Hati-hati ya! 😨🙏'
|
||||
: 'Tindakan ini tidak dapat dibatalkan. Apakah Anda yakin ingin menghapus data ini secara permanen?'
|
||||
);
|
||||
|
||||
@ -32,13 +32,13 @@ public function setUp()
|
||||
->heading('Lokus'),
|
||||
|
||||
Column::make('subLocation.name')
|
||||
->heading('Sub Lokus'),
|
||||
->heading('Sublokus'),
|
||||
|
||||
Column::make('classification.name')
|
||||
->heading('Klasifikasi'),
|
||||
|
||||
Column::make('subClassification.name')
|
||||
->heading('Sub Klasifikasi'),
|
||||
->heading('Subklasifikasi'),
|
||||
|
||||
Column::make('description')
|
||||
->heading('Keterangan'),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Filament\Pages\Auth;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use Filament\Auth\Pages\EditProfile;
|
||||
use Filament\Facades\Filament;
|
||||
@ -92,7 +92,7 @@ public function form(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(CheerfulNotification::getMessage('Detail Profil 👤✨', 'Profil Pengguna'))
|
||||
->description(CheerfulNotification::getMessage('Yuk, kelola informasi detail profil Anda agar selalu terkini! 👤🚀', 'Kelola informasi profil dasar Anda di bawah ini.'))
|
||||
->icon(CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->icon(CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->schema([
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
@ -129,13 +129,13 @@ public function form(Schema $schema): Schema
|
||||
|
||||
Section::make(CheerfulNotification::getMessage('Pengaturan Tampilan & UX 🎨✨', 'Preferensi Tampilan'))
|
||||
->description(CheerfulNotification::getMessage('Personalisasi pengalaman aplikasi Anda agar lebih nyaman dan sesuai selera! 🌈🚀', 'Sesuaikan gaya bahasa, warna tema, dan jenis huruf aplikasi Anda.'))
|
||||
->icon(CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-swatch' : null)
|
||||
->icon(CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-swatch' : null)
|
||||
->schema([
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
Select::make('settings.ux_style')
|
||||
Select::make('settings.notif_style')
|
||||
->label('Gaya Bahasa')
|
||||
->options(UxStyle::class)
|
||||
->options(NotifStyle::class)
|
||||
->native(false)
|
||||
->required(),
|
||||
|
||||
@ -199,7 +199,7 @@ public function form(Schema $schema): Schema
|
||||
|
||||
Section::make(CheerfulNotification::getMessage('Keamanan Akun 🔐✨', 'Ubah Kata Sandi'))
|
||||
->description(CheerfulNotification::getMessage('Ingin ganti kata sandi? Pastikan pilih yang kuat ya biar makin aman! 🔐💪', 'Silakan masukkan kata sandi baru untuk memperbarui keamanan akun Anda.'))
|
||||
->icon(CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-lock-closed' : null)
|
||||
->icon(CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-lock-closed' : null)
|
||||
->schema([
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Enums\DataChangeStatus;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Enums\VerificationStatus;
|
||||
use App\Filament\Resources\Manage\DataChanges\DataChangesResource;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
@ -194,7 +194,7 @@ public static function form(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Informasi Perusahaan 🏗️✨', 'Profil Perusahaan'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Kelola informasi perusahaan Anda biar tetap resmi dan kredibel! 🚀✨', 'Kelola informasi detail perusahaan Anda di sini.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-building-office-2' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-building-office-2' : null)
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Nama')
|
||||
@ -240,7 +240,7 @@ public static function form(Schema $schema): Schema
|
||||
array_merge(
|
||||
[
|
||||
Section::make(fn () => CheerfulNotification::getMessage('NIK Direktur 👤✨', 'NIK Direktur'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->schema([
|
||||
TextInput::make('director_nik')
|
||||
->hiddenLabel()
|
||||
@ -265,7 +265,7 @@ public static function form(Schema $schema): Schema
|
||||
collect($documents)
|
||||
->map(function (array $doc): Section {
|
||||
return Section::make(fn () => CheerfulNotification::getMessage($doc['title'].' 📄✨', $doc['title']))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextInput::make($doc['text_name'])
|
||||
->hiddenLabel()
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
use App\Enums\DataChangeStatus;
|
||||
use App\Enums\MediaClassification;
|
||||
use App\Enums\MediaType;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Enums\RoleEnum;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\VerificationStatus;
|
||||
use App\Filament\Resources\Manage\DataChanges\DataChangesResource;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
@ -167,7 +167,7 @@ public static function form(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Detail Informasi 📰✨', 'Informasi Media'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Kelola informasi media Anda biar tetap eksis dan terpercaya! 🚀✨', 'Kelola informasi detail media Anda di sini.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-newspaper' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-newspaper' : null)
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Nama')
|
||||
@ -214,7 +214,7 @@ public static function form(Schema $schema): Schema
|
||||
collect($documents)
|
||||
->map(function (array $doc): Section {
|
||||
return Section::make(fn () => CheerfulNotification::getMessage($doc['title'].' 📄✨', $doc['title']))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextInput::make($doc['text_name'])
|
||||
->hiddenLabel()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Manage\Contacts;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Actions\Cheerful\DeleteAction;
|
||||
use App\Filament\Actions\DefaultBulkActions;
|
||||
use App\Filament\Columns\RowIndexColumn;
|
||||
@ -54,7 +54,7 @@ public static function infolist(Schema $schema): Schema
|
||||
->schema([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Informasi Pengirim 📧', 'Informasi Pengirim'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Cek detail identitas pengirim pesan biar makin kenal! 📧✨', 'Detail mengenai identitas pengirim pesan.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->schema([
|
||||
Grid::make(4)
|
||||
->schema([
|
||||
@ -80,7 +80,7 @@ public static function infolist(Schema $schema): Schema
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Isi Pesan 💬', 'Isi Pesan'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Yuk, baca pesan lengkap yang dikirimkan oleh pengguna! 💬✨', 'Pesan lengkap yang dikirimkan oleh pengguna.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-chat-bubble-left-right' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-chat-bubble-left-right' : null)
|
||||
->schema([
|
||||
TextEntry::make('message')
|
||||
->label('Konten Pesan')
|
||||
@ -90,7 +90,7 @@ public static function infolist(Schema $schema): Schema
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Riwayat Balasan 📤', 'Riwayat Balasan'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Lihat detail tanggapan yang sudah Admin berikan sebelumnya! 📤✨', 'Detail mengenai tanggapan yang telah diberikan.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-paper-airplane' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-paper-airplane' : null)
|
||||
->schema([
|
||||
TextEntry::make('repliedBy.name')
|
||||
->label('Dibalas Oleh')
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Manage\Cooperations;
|
||||
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Enums\RoleEnum;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Filament\Resources\Manage\Cooperations\Pages\CreateCooperation;
|
||||
use App\Filament\Resources\Manage\Cooperations\Pages\EditCooperation;
|
||||
use App\Filament\Resources\Manage\Cooperations\Pages\ListCooperations;
|
||||
@ -76,7 +76,7 @@ public static function infolist(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Informasi Kerja Sama 🤝', 'Informasi Kerja Sama'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Detail lengkap mengenai data kerja sama yang sedang berjalan. 🤝✨', 'Informasi detail mengenai pelaksanaan kerja sama.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-hand-raised' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-hand-raised' : null)
|
||||
->headerActions([
|
||||
Action::make('status')
|
||||
->label(fn (Cooperation $record): ?string => $record->status->getLabel())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Manage\Cooperations\Schemas;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use App\Models\PartnerMedia;
|
||||
use Asmit\FilamentUpload\Forms\Components\AdvancedFileUpload;
|
||||
@ -27,7 +27,7 @@ public static function configure(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Detail Kerja Sama 🤝', 'Detail Kerja Sama'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Ayo lengkapi informasi mengenai judul, durasi, dan media yang diajak kerja sama! 🤝✨', 'Lengkapi informasi mengenai judul, durasi, dan media yang terlibat.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-hand-raised' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-hand-raised' : null)
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->label('Judul Kerja Sama')
|
||||
@ -90,7 +90,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Lampiran & Media 🖼️', 'Lampiran & Media'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Jangan lupa unggah banner promosi dan template pengajuannya ya! 🖼️✨', 'Unggah banner promosi dan template untuk pengajuan.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-paper-clip' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-paper-clip' : null)
|
||||
->schema([
|
||||
SpatieMediaLibraryFileUpload::make('banner')
|
||||
->label('Banner Promosi')
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
use App\Enums\DecisionAdmin;
|
||||
use App\Enums\MediaClassification;
|
||||
use App\Enums\MediaType;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Enums\RoleEnum;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\VerificationStatus;
|
||||
use App\Filament\Actions\DefaultBulkActions;
|
||||
use App\Filament\Columns\RowIndexColumn;
|
||||
@ -123,7 +123,7 @@ public static function infolist(Schema $schema): Schema
|
||||
Grid::make(3)
|
||||
->schema([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('NIK Direktur 👤✨', 'NIK Direktur'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-user' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.director_nik')
|
||||
->hiddenLabel(),
|
||||
@ -158,7 +158,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Akta Pendirian 📄✨', 'Akta Pendirian'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.deed_incorporation')
|
||||
->hiddenLabel(),
|
||||
@ -167,7 +167,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('SIUP / NIB 📄✨', 'SIUP / NIB'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.trade_license')
|
||||
->hiddenLabel(),
|
||||
@ -176,7 +176,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('NPWP 📄✨', 'NPWP'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.tax_id_number')
|
||||
->hiddenLabel(),
|
||||
@ -185,7 +185,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('PKP 📄✨', 'PKP'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.taxable_enterprise')
|
||||
->hiddenLabel(),
|
||||
@ -194,7 +194,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('SPT Tahunan 📄✨', 'SPT Tahunan'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.annual_tax_return')
|
||||
->hiddenLabel(),
|
||||
@ -203,7 +203,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('SK Domisili 📄✨', 'SK Domisili'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.domicile_certificate')
|
||||
->hiddenLabel(),
|
||||
@ -212,7 +212,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Profil Perusahaan 📄✨', 'Profil Perusahaan'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.profile')
|
||||
->hiddenLabel(),
|
||||
@ -250,7 +250,7 @@ public static function infolist(Schema $schema): Schema
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Sertifikat Organisasi Kewartawanan 📄✨', 'Sertifikat Organisasi Kewartawanan'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.partnerMedia.journalism_organization')
|
||||
->hiddenLabel(),
|
||||
@ -259,7 +259,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Sertifikat Dewan Pers 📄✨', 'Sertifikat Dewan Pers'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('company.partnerMedia.press_council_certificate')
|
||||
->hiddenLabel(),
|
||||
@ -289,7 +289,7 @@ public static function infolist(Schema $schema): Schema
|
||||
Grid::make(2)
|
||||
->schema([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Kartu Pers 🆔✨', 'Kartu Pers'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-identification' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-identification' : null)
|
||||
->schema([
|
||||
TextEntry::make('press_card')
|
||||
->hiddenLabel(),
|
||||
@ -298,7 +298,7 @@ public static function infolist(Schema $schema): Schema
|
||||
]),
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Sertifikat UKW 📄✨', 'Sertifikat UKW'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextEntry::make('ukw_certificate')
|
||||
->hiddenLabel(),
|
||||
|
||||
@ -12,15 +12,15 @@ class ManageSubClassifications extends ManageRecords
|
||||
{
|
||||
protected static string $resource = SubClassificationResource::class;
|
||||
|
||||
protected static ?string $title = 'Sub Klasifikasi';
|
||||
protected static ?string $title = 'Subklasifikasi';
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->label('Tambah')
|
||||
->modalHeading(fn () => CheerfulNotification::getMessage('Tambah Sub Klasifikasi Baru 📑✨', 'Tambah Sub Klasifikasi'))
|
||||
->modalDescription(fn () => CheerfulNotification::getMessage('Perdalam klasifikasi data biar makin detail dan tertata! 🗂️😊', 'Silakan masukkan detail sub klasifikasi data di bawah ini.'))
|
||||
->modalHeading(fn () => CheerfulNotification::getMessage('Tambah Subklasifikasi Baru 📑✨', 'Tambah Subklasifikasi'))
|
||||
->modalDescription(fn () => CheerfulNotification::getMessage('Perdalam klasifikasi data biar makin detail dan tertata! 🗂️😊', 'Silakan masukkan detail subklasifikasi data di bawah ini.'))
|
||||
->modalSubmitActionLabel('Simpan')
|
||||
->modalCancelActionLabel('Batal')
|
||||
->extraModalFooterActions(fn (CreateAction $action): array => [
|
||||
|
||||
@ -41,7 +41,7 @@ class SubClassificationResource extends Resource
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedQueueList;
|
||||
|
||||
protected static ?string $navigationLabel = 'Sub Klasifikasi';
|
||||
protected static ?string $navigationLabel = 'Subklasifikasi';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
@ -63,7 +63,7 @@ public static function form(Schema $schema): Schema
|
||||
->autofocus(),
|
||||
|
||||
TextInput::make('name')
|
||||
->label('Nama Sub-Klasifikasi')
|
||||
->label('Nama Subklasifikasi')
|
||||
->placeholder('Korupsi')
|
||||
->autocomplete(false)
|
||||
->required()
|
||||
@ -128,7 +128,7 @@ public static function table(Table $table): Table
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
...DefaultBulkActions::make('Sub Klasifikasi'),
|
||||
...DefaultBulkActions::make('Subklasifikasi'),
|
||||
]),
|
||||
])
|
||||
->emptyStateIcon(Heroicon::OutlinedQueueList)
|
||||
|
||||
@ -12,15 +12,15 @@ class ManageSubLocations extends ManageRecords
|
||||
{
|
||||
protected static string $resource = SubLocationResource::class;
|
||||
|
||||
protected static ?string $title = 'Sub Lokus';
|
||||
protected static ?string $title = 'Sublokus';
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->label('Tambah')
|
||||
->modalHeading(fn () => CheerfulNotification::getMessage('Tambah Sub Lokus Baru 📌✨', 'Tambah Sub Lokus'))
|
||||
->modalDescription(fn () => CheerfulNotification::getMessage('Detailkan lebih dalam lagi titik lokasinya, ya! 📍😊', 'Silakan masukkan detail sub lokasi/lokus data di bawah ini.'))
|
||||
->modalHeading(fn () => CheerfulNotification::getMessage('Tambah Sublokus Baru 📌✨', 'Tambah Sublokus'))
|
||||
->modalDescription(fn () => CheerfulNotification::getMessage('Detailkan lebih dalam lagi titik lokasinya, ya! 📍😊', 'Silakan masukkan detail sublokus data di bawah ini.'))
|
||||
->modalSubmitActionLabel('Simpan')
|
||||
->modalCancelActionLabel('Batal')
|
||||
->extraModalFooterActions(fn (CreateAction $action): array => [
|
||||
|
||||
@ -41,7 +41,7 @@ class SubLocationResource extends Resource
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedNumberedList;
|
||||
|
||||
protected static ?string $navigationLabel = 'Sub Lokus';
|
||||
protected static ?string $navigationLabel = 'Sublokus';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
@ -63,7 +63,7 @@ public static function form(Schema $schema): Schema
|
||||
->autofocus(),
|
||||
|
||||
TextInput::make('name')
|
||||
->label('Nama Sub-Lokus')
|
||||
->label('Nama Sublokus')
|
||||
->placeholder('Kecamatan Purwakarta')
|
||||
->autocomplete(false)
|
||||
->required()
|
||||
@ -125,7 +125,7 @@ public static function table(Table $table): Table
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
...DefaultBulkActions::make('Sub Lokus'),
|
||||
...DefaultBulkActions::make('Sublokus'),
|
||||
]),
|
||||
])
|
||||
->emptyStateIcon(Heroicon::OutlinedNumberedList)
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
use App\Enums\Channel;
|
||||
use App\Enums\ContentType;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Enums\SocialMedia;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
@ -24,7 +24,7 @@ public static function configure(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Informasi Konten 📝', 'Informasi Konten'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Lengkapi detail judul, tautan, dan jenis konten Anda biar makin keren! 🚀😊', 'Lengkapi detail judul, tautan, dan jenis konten Anda.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-document-text' : null)
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->label('Judul Konten')
|
||||
@ -76,7 +76,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Klasifikasi & Lampiran 📁', 'Klasifikasi & Lampiran'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Pilih klasifikasi yang pas dan unggah gambar pendukung ya! 📁✨', 'Pilih klasifikasi yang sesuai dan unggah gambar pendukung.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-folder-open' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-folder-open' : null)
|
||||
->schema([
|
||||
Select::make('classification_id')
|
||||
->label('Klasifikasi')
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Filament\Resources\Monitoring\IssueManagements\Schemas;
|
||||
|
||||
use App\Enums\IssueSentiment;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
@ -22,7 +22,7 @@ public static function configure(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Identifikasi Isu 🔍', 'Identifikasi Isu'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Yuk, hubungkan dengan berita monitoring dan tentukan lokasi isunya! 🔍✨', 'Hubungkan dengan berita monitoring dan tentukan lokasi isu.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-magnifying-glass' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-magnifying-glass' : null)
|
||||
->schema([
|
||||
Select::make('media_monitoring_id')
|
||||
->label('Monitoring Media')
|
||||
@ -59,7 +59,7 @@ public static function configure(Schema $schema): Schema
|
||||
->required(),
|
||||
|
||||
Select::make('sub_location_id')
|
||||
->label('Sub Lokus')
|
||||
->label('Sublokus')
|
||||
->relationship('subLocation', 'name', fn (Builder $query, Get $get): Builder => $query->active()->where('location_id', $get('location_id')))
|
||||
->searchable()
|
||||
->preload()
|
||||
@ -75,7 +75,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Sentimen & Klasifikasi 📊', 'Sentimen & Klasifikasi'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Tentukan sentimen isu, respon, dan kategorinya biar makin jelas! 📊✨', 'Tentukan sentimen isu, respon, dan kategori klasifikasinya.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-chart-bar' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-chart-bar' : null)
|
||||
->schema([
|
||||
Select::make('issue')
|
||||
->label('Sentimen Isu')
|
||||
@ -103,7 +103,7 @@ public static function configure(Schema $schema): Schema
|
||||
->required(),
|
||||
|
||||
Select::make('sub_classification_id')
|
||||
->label('Sub Klasifikasi')
|
||||
->label('Subklasifikasi')
|
||||
->relationship('subClassification', 'name', fn (Builder $query, Get $get): Builder => $query->where('classification_id', $get('location_id'))->active())
|
||||
->searchable()
|
||||
->preload()
|
||||
|
||||
@ -62,7 +62,7 @@ public static function configure(Table $table): Table
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('subLocation.name')
|
||||
->label('Sub Lokus')
|
||||
->label('Sublokus')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
@ -72,7 +72,7 @@ public static function configure(Table $table): Table
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('subClassification.name')
|
||||
->label('Sub Klasifikasi')
|
||||
->label('Subklasifikasi')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
@ -101,7 +101,7 @@ public static function configure(Table $table): Table
|
||||
->native(false),
|
||||
|
||||
SelectFilter::make('subLocation')
|
||||
->label('Sub Lokus')
|
||||
->label('Sublokus')
|
||||
->relationship('subLocation', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
@ -123,7 +123,7 @@ public static function configure(Table $table): Table
|
||||
->native(false),
|
||||
|
||||
SelectFilter::make('subClassification')
|
||||
->label('Sub Klasifikasi')
|
||||
->label('Subklasifikasi')
|
||||
->relationship('subClassification', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Filament\Resources\Monitoring\MediaMonitorings\Schemas;
|
||||
|
||||
use App\Enums\Channel;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use Filament\Forms\Components\DatePicker;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
@ -23,7 +23,7 @@ public static function configure(Schema $schema): Schema
|
||||
->components([
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Detail Berita 📰', 'Detail Berita'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Masukkan informasi lengkap mengenai pemberitaan media biar makin lengkap! 📰✨', 'Masukkan informasi lengkap mengenai pemberitaan media.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-newspaper' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-newspaper' : null)
|
||||
->schema([
|
||||
TextInput::make('media_name')
|
||||
->label('Nama Media')
|
||||
@ -77,7 +77,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Section::make(fn () => CheerfulNotification::getMessage('Kategori & Metadata 🏷️', 'Kategori & Metadata'))
|
||||
->description(fn () => CheerfulNotification::getMessage('Tentukan kategori berita dan informasi tambahan lainnya biar makin rapi! 🏷️✨', 'Tentukan kategori berita dan informasi tambahan lainnya.'))
|
||||
->icon(fn () => CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-tag' : null)
|
||||
->icon(fn () => CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-tag' : null)
|
||||
->schema([
|
||||
Select::make('channel')
|
||||
->label('Kanal')
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
namespace App\Filament\Resources\Publication\News\Schemas;
|
||||
|
||||
use App\Enums\NewsStatus;
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Filament\Support\CheerfulNotification;
|
||||
use App\Models\News;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
@ -29,7 +29,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Section::make(CheerfulNotification::getMessage('Konten Berita ✍️', 'Konten Berita'))
|
||||
->description(CheerfulNotification::getMessage('Yuk, tuliskan judul, ringkasan, dan isi lengkap berita Anda biar makin menarik! 🚀😊', 'Silakan tuliskan judul, ringkasan, dan isi lengkap berita Anda.'))
|
||||
->icon(CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-pencil-square' : null)
|
||||
->icon(CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-pencil-square' : null)
|
||||
->schema([
|
||||
TextInput::make('title')
|
||||
->label('Judul Berita')
|
||||
@ -54,7 +54,7 @@ public static function configure(Schema $schema): Schema
|
||||
|
||||
Section::make(CheerfulNotification::getMessage('Kategori & Publikasi 🏷️', 'Kategori & Publikasi'))
|
||||
->description(CheerfulNotification::getMessage('Tentukan kategori, tautan media, dan status publikasi biar berita kita gampang dicari! 🏷️✨', 'Tentukan kategori, tautan media, dan status publikasi.'))
|
||||
->icon(CheerfulNotification::getUxStyle() === UxStyle::CHEERFUL ? 'heroicon-o-tag' : null)
|
||||
->icon(CheerfulNotification::getNotifStyle() === NotifStyle::CHEERFUL ? 'heroicon-o-tag' : null)
|
||||
->schema([
|
||||
TextInput::make('link')
|
||||
->label('Tautan Media (Opsional)')
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Filament\Support;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
class CheerfulNotification
|
||||
@ -16,20 +16,20 @@ public static function make(): Notification
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current user's UX style preference.
|
||||
* Get the current user's Notification style preference.
|
||||
*/
|
||||
public static function getUxStyle(): UxStyle
|
||||
public static function getNotifStyle(): NotifStyle
|
||||
{
|
||||
try {
|
||||
return auth()->user()?->settings?->ux_style ?? UxStyle::CHEERFUL;
|
||||
return auth()->user()?->settings?->notif_style ?? NotifStyle::CHEERFUL;
|
||||
} catch (\Throwable $e) {
|
||||
return UxStyle::CHEERFUL;
|
||||
return NotifStyle::CHEERFUL;
|
||||
}
|
||||
}
|
||||
|
||||
public static function create(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Hore! Data Tersimpan 🎉✨' : 'Data Berhasil Disimpan')
|
||||
@ -39,7 +39,7 @@ public static function create(): Notification
|
||||
|
||||
public static function update(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Mantap! Data Diperbarui ✅🔥' : 'Perubahan Tersimpan')
|
||||
@ -49,7 +49,7 @@ public static function update(): Notification
|
||||
|
||||
public static function delete(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Oke, Data Dihapus 🗑️👋' : 'Data Dihapus')
|
||||
@ -59,7 +59,7 @@ public static function delete(): Notification
|
||||
|
||||
public static function forceDelete(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Selamat Tinggal Selamanya 👋😢' : 'Data Dihapus Permanen')
|
||||
@ -69,7 +69,7 @@ public static function forceDelete(): Notification
|
||||
|
||||
public static function restore(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Welcome Back! Data Pulih ♻️✨' : 'Data Berhasil Dipulihkan')
|
||||
@ -79,7 +79,7 @@ public static function restore(): Notification
|
||||
|
||||
public static function statusUpdated(?string $title = null, ?string $body = null): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($title ?? ($cheerful ? 'Status Berubah! 🔄✨' : 'Status Diperbarui'))
|
||||
@ -89,7 +89,7 @@ public static function statusUpdated(?string $title = null, ?string $body = null
|
||||
|
||||
public static function bulkDelete(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Oke, Banyak Data Dihapus 🗑️👋' : 'Data Berhasil Dihapus')
|
||||
@ -99,7 +99,7 @@ public static function bulkDelete(): Notification
|
||||
|
||||
public static function bulkForceDelete(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Bye Bye Semua! 👋🔥' : 'Data Dihapus Permanen')
|
||||
@ -109,7 +109,7 @@ public static function bulkForceDelete(): Notification
|
||||
|
||||
public static function bulkRestore(): Notification
|
||||
{
|
||||
$cheerful = self::getUxStyle() === UxStyle::CHEERFUL;
|
||||
$cheerful = self::getNotifStyle() === NotifStyle::CHEERFUL;
|
||||
|
||||
return self::make()
|
||||
->title($cheerful ? 'Hore! Banyak Data Pulih ♻️🎉' : 'Data Berhasil Dipulihkan')
|
||||
@ -166,6 +166,6 @@ public static function danger(string $title, string $body): Notification
|
||||
*/
|
||||
public static function getMessage(string $cheerful, string $formal): string
|
||||
{
|
||||
return self::getUxStyle() === UxStyle::CHEERFUL ? $cheerful : $formal;
|
||||
return self::getNotifStyle() === NotifStyle::CHEERFUL ? $cheerful : $formal;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
@ -13,7 +13,7 @@ class UserSetting extends Model
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'ux_style' => UxStyle::class,
|
||||
'notif_style' => NotifStyle::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Observers;
|
||||
|
||||
use App\Enums\UxStyle;
|
||||
use App\Enums\NotifStyle;
|
||||
use App\Models\User;
|
||||
|
||||
class UserObserver
|
||||
@ -13,7 +13,7 @@ class UserObserver
|
||||
public function created(User $user): void
|
||||
{
|
||||
$user->settings()->create([
|
||||
'ux_style' => UxStyle::CHEERFUL,
|
||||
'notif_style' => NotifStyle::CHEERFUL,
|
||||
'primary_color' => 'blue',
|
||||
]);
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('ux_style')->default('cheerful')->after('email_verified_at');
|
||||
$table->string('notif_style')->default('cheerful')->after('email_verified_at');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -15,18 +15,18 @@ public function up(): void
|
||||
Schema::create('user_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->unique()->constrained()->onDelete('cascade');
|
||||
$table->string('ux_style')->default('cheerful');
|
||||
$table->string('notif_style')->default('cheerful');
|
||||
$table->string('primary_color')->nullable(); // For future extension
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Migrate existing data from users table (already has ux_style from earlier migration)
|
||||
// Migrate existing data from users table (already has notif_style from earlier migration)
|
||||
$users = DB::table('users')->get();
|
||||
foreach ($users as $user) {
|
||||
DB::table('user_settings')->updateOrInsert(
|
||||
['user_id' => $user->id],
|
||||
[
|
||||
'ux_style' => $user->ux_style ?? 'cheerful',
|
||||
'notif_style' => $user->notif_style ?? 'cheerful',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
@ -35,7 +35,7 @@ public function up(): void
|
||||
|
||||
// Drop the old column from users
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('ux_style');
|
||||
$table->dropColumn('notif_style');
|
||||
});
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public function up(): void
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('ux_style')->default('cheerful')->after('email_verified_at');
|
||||
$table->string('notif_style')->default('cheerful')->after('email_verified_at');
|
||||
});
|
||||
|
||||
// Revert data
|
||||
@ -53,7 +53,7 @@ public function down(): void
|
||||
foreach ($settings as $setting) {
|
||||
DB::table('users')
|
||||
->where('id', $setting->user_id)
|
||||
->update(['ux_style' => $setting->ux_style]);
|
||||
->update(['notif_style' => $setting->notif_style]);
|
||||
}
|
||||
|
||||
Schema::dropIfExists('user_settings');
|
||||
|
||||
@ -34,14 +34,14 @@
|
||||
]);
|
||||
});
|
||||
|
||||
test('can render sub-classification list page', function () {
|
||||
test('can render subklasifikasi list page', function () {
|
||||
$this->actingAs($this->user);
|
||||
|
||||
Livewire::test(ManageSubClassifications::class)
|
||||
->assertSuccessful();
|
||||
});
|
||||
|
||||
test('can list sub-classifications', function () {
|
||||
test('can list subklasifikasi', function () {
|
||||
$subClassifications = SubClassification::factory()->count(5)->create();
|
||||
|
||||
$this->actingAs($this->user);
|
||||
@ -51,7 +51,7 @@
|
||||
->assertCanSeeTableRecords($subClassifications);
|
||||
});
|
||||
|
||||
test('can create sub-classification', function () {
|
||||
test('can create subklasifikasi', function () {
|
||||
$classification = Classification::factory()->create(['is_active' => IsActive::ACTIVE]);
|
||||
|
||||
$this->actingAs($this->user);
|
||||
@ -60,18 +60,18 @@
|
||||
->mountAction('create')
|
||||
->setActionData([
|
||||
'classification_id' => $classification->id,
|
||||
'name' => 'Sub Klasifikasi Baru',
|
||||
'name' => 'Subklasifikasi Baru',
|
||||
])
|
||||
->callMountedAction()
|
||||
->assertHasNoActionErrors();
|
||||
|
||||
$this->assertDatabaseHas('sub_classifications', [
|
||||
'classification_id' => $classification->id,
|
||||
'name' => 'Sub Klasifikasi Baru',
|
||||
'name' => 'Subklasifikasi Baru',
|
||||
]);
|
||||
});
|
||||
|
||||
test('cannot create sub-classification with invalid data', function () {
|
||||
test('cannot create subklasifikasi with invalid data', function () {
|
||||
$this->actingAs($this->user);
|
||||
|
||||
// Empty name
|
||||
@ -89,7 +89,7 @@
|
||||
->assertHasActionErrors(['classification_id']);
|
||||
});
|
||||
|
||||
test('can edit sub-classification', function () {
|
||||
test('can edit subklasifikasi', function () {
|
||||
$subClassification = SubClassification::factory()->create();
|
||||
$newClassification = Classification::factory()->create(['is_active' => IsActive::ACTIVE]);
|
||||
|
||||
@ -99,12 +99,12 @@
|
||||
->mountTableAction('edit', $subClassification)
|
||||
->setActionData([
|
||||
'classification_id' => $newClassification->id,
|
||||
'name' => 'Sub Klasifikasi Updated',
|
||||
'name' => 'Subklasifikasi Updated',
|
||||
])
|
||||
->callMountedTableAction()
|
||||
->assertHasNoActionErrors();
|
||||
|
||||
expect($subClassification->refresh()->name)->toBe('Sub Klasifikasi Updated');
|
||||
expect($subClassification->refresh()->name)->toBe('Subklasifikasi Updated');
|
||||
expect($subClassification->classification_id)->toBe($newClassification->id);
|
||||
});
|
||||
|
||||
@ -119,7 +119,7 @@
|
||||
expect($subClassification->refresh()->is_active)->toBe(IsActive::ACTIVE);
|
||||
});
|
||||
|
||||
test('unauthorized user cannot render sub-classification page', function () {
|
||||
test('unauthorized user cannot render subklasifikasi page', function () {
|
||||
$unauthorizedUser = User::factory()->create(['is_active' => IsActive::ACTIVE]);
|
||||
|
||||
$this->actingAs($unauthorizedUser);
|
||||
@ -139,7 +139,7 @@
|
||||
->assertTableActionHidden('edit', $subClassification);
|
||||
});
|
||||
|
||||
test('can delete sub-classification', function () {
|
||||
test('can delete subklasifikasi', function () {
|
||||
$subClassification = SubClassification::factory()->create();
|
||||
|
||||
$this->actingAs($this->user);
|
||||
@ -150,7 +150,7 @@
|
||||
$this->assertSoftDeleted($subClassification);
|
||||
});
|
||||
|
||||
test('can restore deleted sub-classification', function () {
|
||||
test('can restore deleted subklasifikasi', function () {
|
||||
$roleDev = Role::firstOrCreate(['name' => RoleEnum::DEVELOPER->value, 'guard_name' => 'web']);
|
||||
$this->user->assignRole($roleDev);
|
||||
|
||||
@ -168,7 +168,7 @@
|
||||
]);
|
||||
});
|
||||
|
||||
test('can force delete sub-classification', function () {
|
||||
test('can force delete subklasifikasi', function () {
|
||||
$roleDev = Role::firstOrCreate(['name' => RoleEnum::DEVELOPER->value, 'guard_name' => 'web']);
|
||||
$this->user->assignRole($roleDev);
|
||||
|
||||
|
||||
@ -40,14 +40,14 @@
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
test('can render sub-location list page', function () {
|
||||
test('can render sublokus list page', function () {
|
||||
$this->actingAs($this->user);
|
||||
|
||||
Livewire::test(ManageSubLocations::class)
|
||||
->assertSuccessful();
|
||||
});
|
||||
|
||||
test('can list sub-locations', function () {
|
||||
test('can list sublokus', function () {
|
||||
$subLocations = SubLocation::factory()->count(5)->create();
|
||||
|
||||
$this->actingAs($this->user);
|
||||
@ -57,7 +57,7 @@
|
||||
->assertCanSeeTableRecords($subLocations);
|
||||
});
|
||||
|
||||
test('can create sub-location', function () {
|
||||
test('can create sublokus', function () {
|
||||
$location = Location::factory()->create(['is_active' => IsActive::ACTIVE]);
|
||||
|
||||
$this->actingAs($this->user);
|
||||
@ -66,18 +66,18 @@
|
||||
->mountAction('create')
|
||||
->setActionData([
|
||||
'location_id' => $location->id,
|
||||
'name' => 'Sub Lokus Baru',
|
||||
'name' => 'Sublokus Baru',
|
||||
])
|
||||
->callMountedAction()
|
||||
->assertHasNoActionErrors();
|
||||
|
||||
$this->assertDatabaseHas('sub_locations', [
|
||||
'location_id' => $location->id,
|
||||
'name' => 'Sub Lokus Baru',
|
||||
'name' => 'Sublokus Baru',
|
||||
]);
|
||||
});
|
||||
|
||||
test('can edit sub-location', function () {
|
||||
test('can edit sublokus', function () {
|
||||
$subLocation = SubLocation::factory()->create();
|
||||
$newLocation = Location::factory()->create(['is_active' => IsActive::ACTIVE]);
|
||||
|
||||
@ -87,12 +87,12 @@
|
||||
->mountTableAction('edit', $subLocation)
|
||||
->setActionData([
|
||||
'location_id' => $newLocation->id,
|
||||
'name' => 'Sub Lokus Updated',
|
||||
'name' => 'Sublokus Updated',
|
||||
])
|
||||
->callMountedTableAction()
|
||||
->assertHasNoActionErrors();
|
||||
|
||||
expect($subLocation->refresh()->name)->toBe('Sub Lokus Updated');
|
||||
expect($subLocation->refresh()->name)->toBe('Sublokus Updated');
|
||||
expect($subLocation->location_id)->toBe($newLocation->id);
|
||||
});
|
||||
|
||||
@ -113,7 +113,7 @@
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
test('cannot create sub-location with invalid data', function () {
|
||||
test('cannot create sublokus with invalid data', function () {
|
||||
$this->actingAs($this->user);
|
||||
|
||||
// Empty name
|
||||
@ -131,7 +131,7 @@
|
||||
->assertHasActionErrors(['location_id']);
|
||||
});
|
||||
|
||||
test('unauthorized user cannot render sub-location page', function () {
|
||||
test('unauthorized user cannot render sublokus page', function () {
|
||||
$unauthorizedUser = User::factory()->create(['is_active' => IsActive::ACTIVE]);
|
||||
|
||||
$this->actingAs($unauthorizedUser);
|
||||
@ -157,7 +157,7 @@
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
test('can delete sub-location', function () {
|
||||
test('can delete sublokus', function () {
|
||||
$subLocation = SubLocation::factory()->create();
|
||||
|
||||
$this->actingAs($this->user);
|
||||
@ -168,7 +168,7 @@
|
||||
$this->assertSoftDeleted($subLocation);
|
||||
});
|
||||
|
||||
test('can restore deleted sub-location', function () {
|
||||
test('can restore deleted sublokus', function () {
|
||||
$roleDev = Role::firstOrCreate(['name' => RoleEnum::DEVELOPER->value, 'guard_name' => 'web']);
|
||||
$this->user->assignRole($roleDev);
|
||||
|
||||
@ -186,7 +186,7 @@
|
||||
]);
|
||||
});
|
||||
|
||||
test('can force delete sub-location', function () {
|
||||
test('can force delete sublokus', function () {
|
||||
$roleDev = Role::firstOrCreate(['name' => RoleEnum::DEVELOPER->value, 'guard_name' => 'web']);
|
||||
$this->user->assignRole($roleDev);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user