user()->hasRole(RoleEnum::PERUSAHAAN)) {
return null;
}
return static::getModel()::pending()->count();
}
public static function infolist(Schema $schema): Schema
{
return $schema
->schema([
Section::make('Perbandingan Data')
->schema([
TextEntry::make('comparison')
->hiddenLabel()
->html()
->state(function (DataChangeRequest $record): string {
$old = $record->old_data ?? [];
$new = $record->new_data ?? [];
if (! is_array($old) || ! is_array($new)) {
return 'Format data tidak valid.';
}
$renderValue = function ($value) {
if (empty($value)) {
return 'Kosong';
}
$paths = is_array($value) ? $value : [$value];
$isProbablyPath = false;
foreach ($paths as $path) {
if (is_string($path) && (str_contains($path, '/') || str_contains($path, '\\'))) {
$isProbablyPath = true;
break;
}
}
if ($isProbablyPath) {
return collect($paths)
->map(function ($path) {
if (! is_string($path)) {
return e(json_encode($path));
}
$url = Storage::disk(config('filesystems.default'))->url($path);
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
if (in_array($extension, ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'])) {
return "";
}
if ($extension === 'pdf') {
return "
User mengajukan penghapusan permanen untuk data ini. Semua informasi terkait akan dihapus setelah disetujui.
Berikut adalah data baru yang akan dibuat.