feat: Integrate cheerful notifications into decision and verification enums, enhancing user feedback with engaging messages across the admin verification page.
This commit is contained in:
parent
be8408f9b3
commit
63843ff18d
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Enums;
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use App\Filament\Support\CheerfulNotification;
|
||||||
use App\Traits\Enum\WithComment;
|
use App\Traits\Enum\WithComment;
|
||||||
use App\Traits\Enum\WithValue;
|
use App\Traits\Enum\WithValue;
|
||||||
use Filament\Support\Contracts\HasColor;
|
use Filament\Support\Contracts\HasColor;
|
||||||
@ -18,9 +19,9 @@ enum DecisionAdmin: int implements HasColor, HasLabel
|
|||||||
public function getLabel(): ?string
|
public function getLabel(): ?string
|
||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
self::APPROVED => 'Disetujui',
|
self::APPROVED => CheerfulNotification::getMessage('Sudah Disetujui! ✅🚀', 'Disetujui'),
|
||||||
self::NEED_REVISION => 'Perlu Revisi',
|
self::NEED_REVISION => CheerfulNotification::getMessage('Perlu Revisi nih! ✍️🛠️', 'Perlu Revisi'),
|
||||||
self::REJECTED => 'Ditolak',
|
self::REJECTED => CheerfulNotification::getMessage('Ditolak, Tetap Semangat! 🛑😔', 'Ditolak'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Enums;
|
namespace App\Enums;
|
||||||
|
|
||||||
|
use App\Filament\Support\CheerfulNotification;
|
||||||
use App\Traits\Enum\WithComment;
|
use App\Traits\Enum\WithComment;
|
||||||
use App\Traits\Enum\WithValue;
|
use App\Traits\Enum\WithValue;
|
||||||
use Filament\Support\Contracts\HasColor;
|
use Filament\Support\Contracts\HasColor;
|
||||||
@ -19,10 +20,10 @@ enum VerificationStatus: int implements HasColor, HasLabel
|
|||||||
public function getLabel(): ?string
|
public function getLabel(): ?string
|
||||||
{
|
{
|
||||||
return match ($this) {
|
return match ($this) {
|
||||||
self::PENDING => 'Menunggu Verifikasi',
|
self::PENDING => CheerfulNotification::getMessage('Menunggu Verifikasi ⏳✨', 'Menunggu Verifikasi'),
|
||||||
self::APPROVED => 'Disetujui',
|
self::APPROVED => CheerfulNotification::getMessage('Sudah Disetujui! ✅🚀', 'Disetujui'),
|
||||||
self::NEED_REVISION => 'Perlu Revisi',
|
self::NEED_REVISION => CheerfulNotification::getMessage('Perlu Revisi nih! ✍️🛠️', 'Perlu Revisi'),
|
||||||
self::REJECTED => 'Ditolak',
|
self::REJECTED => CheerfulNotification::getMessage('Ditolak, Tetap Semangat! 🛑😔', 'Ditolak'),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -165,6 +165,12 @@ public function verifications(): LengthAwarePaginator
|
|||||||
'createdAt' => $review->created_at->translatedFormat('l, d M Y H:i'),
|
'createdAt' => $review->created_at->translatedFormat('l, d M Y H:i'),
|
||||||
]),
|
]),
|
||||||
],
|
],
|
||||||
|
'messages' => [
|
||||||
|
'detail' => CheerfulNotification::getMessage('Detail Data 🔍✨', 'Detail'),
|
||||||
|
'revision' => CheerfulNotification::getMessage('Sabar ya, pengguna lagi sibuk revisi data nih! ⏳✍️', 'Menunggu revisi dari pengguna...'),
|
||||||
|
'approved' => CheerfulNotification::getMessage('Yeay! Verifikasi sudah beres dan disetujui! ✅🚀', 'Verifikasi selesai'),
|
||||||
|
'rejected' => CheerfulNotification::getMessage('Yah, pengajuannya terpaksa belum bisa diterima. 🛑😔', 'Pengajuan ditolak'),
|
||||||
|
],
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -245,4 +251,14 @@ public function rejectAction(): Action
|
|||||||
{
|
{
|
||||||
return RejectAction::make();
|
return RejectAction::make();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmptyStateHeading(): string
|
||||||
|
{
|
||||||
|
return CheerfulNotification::getMessage('Belum ada pengajuan verifikasi nih! 📭✨', 'Tidak ada pengajuan verifikasi');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmptyStateDescription(): string
|
||||||
|
{
|
||||||
|
return CheerfulNotification::getMessage('Tenang saja, mungkin sebentar lagi bakal ada yang kirim pengajuan verifikasi. Ditunggu saja ya! 😊⏳', 'Belum ada pengajuan verifikasi dari user.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -212,9 +212,9 @@ public static function table(Table $table): Table
|
|||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->paginated([25, 50, 100, 'all'])
|
->paginated([25, 50, 100, 'all'])
|
||||||
->deferLoading()
|
->deferLoading()
|
||||||
->when(auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value) && ! auth()->user()->company?->partnerMedia, function (Table $table): Table {
|
->when(fn () => auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value) && ! auth()->user()->company?->partnerMedia, function (Table $table): Table {
|
||||||
return $table
|
return $table
|
||||||
->emptyStateHeading('Akses Dibatasi')
|
->emptyStateHeading(fn () => CheerfulNotification::getMessage('Wah, Pintunya Dikunci Nih! 🔒✨', 'Akses Dibatasi'))
|
||||||
->emptyStateDescription(fn () => CheerfulNotification::getMessage('Ups! Silakan lengkapi data media Anda dulu ya sebelum mengelola jurnalis. ✨📝', 'Silakan lengkapi data media Anda terlebih dahulu untuk dapat mengelola informasi jurnalis.'))
|
->emptyStateDescription(fn () => CheerfulNotification::getMessage('Ups! Silakan lengkapi data media Anda dulu ya sebelum mengelola jurnalis. ✨📝', 'Silakan lengkapi data media Anda terlebih dahulu untuk dapat mengelola informasi jurnalis.'))
|
||||||
->emptyStateIcon(Heroicon::OutlinedLockClosed)
|
->emptyStateIcon(Heroicon::OutlinedLockClosed)
|
||||||
->emptyStateActions([
|
->emptyStateActions([
|
||||||
@ -236,7 +236,7 @@ public static function getPages(): array
|
|||||||
public static function getEloquentQuery(): Builder
|
public static function getEloquentQuery(): Builder
|
||||||
{
|
{
|
||||||
return parent::getEloquentQuery()
|
return parent::getEloquentQuery()
|
||||||
->when(auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value) && ! auth()->user()->company?->partnerMedia, function (Builder $query): Builder {
|
->when(fn () => auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value) && ! auth()->user()->company?->partnerMedia, function (Builder $query): Builder {
|
||||||
return $query->whereRaw('1 = 0');
|
return $query->whereRaw('1 = 0');
|
||||||
})
|
})
|
||||||
->when(auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value), function (Builder $query): Builder {
|
->when(auth()->user()->hasRole(RoleEnum::PERUSAHAAN->value), function (Builder $query): Builder {
|
||||||
|
|||||||
@ -228,7 +228,7 @@ class="w-4 h-4 text-gray-500 transition-transform duration-200"
|
|||||||
@if ($verification['company']['detailUrl'])
|
@if ($verification['company']['detailUrl'])
|
||||||
<x-filament::button color="gray" size="sm" icon="heroicon-o-eye" tag="a"
|
<x-filament::button color="gray" size="sm" icon="heroicon-o-eye" tag="a"
|
||||||
:href="$verification['company']['detailUrl']">
|
:href="$verification['company']['detailUrl']">
|
||||||
Detail
|
{{ $verification['messages']['detail'] }}
|
||||||
</x-filament::button>
|
</x-filament::button>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@ -241,19 +241,19 @@ class="w-4 h-4 text-gray-500 transition-transform duration-200"
|
|||||||
<span
|
<span
|
||||||
class="flex items-center gap-1 text-xs text-warning-600 dark:text-warning-400 font-medium italic">
|
class="flex items-center gap-1 text-xs text-warning-600 dark:text-warning-400 font-medium italic">
|
||||||
<x-heroicon-s-clock class="w-3 h-3 animate-pulse" />
|
<x-heroicon-s-clock class="w-3 h-3 animate-pulse" />
|
||||||
Menunggu revisi dari pengguna...
|
{{ $verification['messages']['revision'] }}
|
||||||
</span>
|
</span>
|
||||||
@elseif($verification['status']['isApproved'])
|
@elseif($verification['status']['isApproved'])
|
||||||
<span
|
<span
|
||||||
class="flex items-center gap-1 text-xs text-success-600 dark:text-success-400 font-medium">
|
class="flex items-center gap-1 text-xs text-success-600 dark:text-success-400 font-medium">
|
||||||
<x-heroicon-s-check-circle class="w-3 h-3" />
|
<x-heroicon-s-check-circle class="w-3 h-3" />
|
||||||
Verifikasi selesai
|
{{ $verification['messages']['approved'] }}
|
||||||
</span>
|
</span>
|
||||||
@elseif($verification['status']['isRejected'])
|
@elseif($verification['status']['isRejected'])
|
||||||
<span
|
<span
|
||||||
class="flex items-center gap-1 text-xs text-danger-600 dark:text-danger-400 font-medium">
|
class="flex items-center gap-1 text-xs text-danger-600 dark:text-danger-400 font-medium">
|
||||||
<x-heroicon-s-x-circle class="w-3 h-3" />
|
<x-heroicon-s-x-circle class="w-3 h-3" />
|
||||||
Pengajuan ditolak
|
{{ $verification['messages']['rejected'] }}
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@ -261,8 +261,11 @@ class="flex items-center gap-1 text-xs text-danger-600 dark:text-danger-400 font
|
|||||||
</x-filament::section>
|
</x-filament::section>
|
||||||
@empty
|
@empty
|
||||||
<div class="col-span-full">
|
<div class="col-span-full">
|
||||||
<x-filament::empty-state icon="heroicon-o-inbox" heading="Tidak ada pengajuan verifikasi"
|
<x-filament::empty-state
|
||||||
description="Belum ada pengajuan verifikasi dari user." iconColor="gray">
|
icon="heroicon-o-inbox"
|
||||||
|
:heading="$this->getEmptyStateHeading()"
|
||||||
|
:description="$this->getEmptyStateDescription()"
|
||||||
|
icon-color="gray">
|
||||||
</x-filament::empty-state>
|
</x-filament::empty-state>
|
||||||
</div>
|
</div>
|
||||||
@endforelse
|
@endforelse
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user