96 lines
2.8 KiB
PHP
96 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Support\ActivityLog;
|
|
|
|
use App\Models\Attendance;
|
|
use App\Models\CashAccount;
|
|
use App\Models\CashTransaction;
|
|
use App\Models\Category;
|
|
use App\Models\Customer;
|
|
use App\Models\Cutting;
|
|
use App\Models\CuttingMaterial;
|
|
use App\Models\CuttingResult;
|
|
use App\Models\Employee;
|
|
use App\Models\EmployeeAdvance;
|
|
use App\Models\Expense;
|
|
use App\Models\LeaveRequest;
|
|
use App\Models\Order;
|
|
use App\Models\OrderItem;
|
|
use App\Models\Payroll;
|
|
use App\Models\PayrollAdjustment;
|
|
use App\Models\PayrollPeriod;
|
|
use App\Models\Product;
|
|
use App\Models\ProductPrice;
|
|
use App\Models\ProductVariant;
|
|
use App\Models\Purchase;
|
|
use App\Models\PurchaseItem;
|
|
use App\Models\RawMaterial;
|
|
use App\Models\RawMaterialPrice;
|
|
use App\Models\Rejection;
|
|
use App\Models\Supplier;
|
|
use App\Models\SystemConfiguration;
|
|
use App\Models\User;
|
|
use App\Models\UserProfile;
|
|
|
|
class ModelLabel
|
|
{
|
|
/**
|
|
* @var array<class-string, string>
|
|
*/
|
|
private const LABELS = [
|
|
Attendance::class => 'Presensi',
|
|
CashAccount::class => 'Akun Kas',
|
|
CashTransaction::class => 'Transaksi Kas',
|
|
Category::class => 'Kategori',
|
|
Customer::class => 'Pelanggan',
|
|
Cutting::class => 'Cutting',
|
|
CuttingMaterial::class => 'Bahan Cutting',
|
|
CuttingResult::class => 'Hasil Cutting',
|
|
Employee::class => 'Pegawai',
|
|
EmployeeAdvance::class => 'Kasbon',
|
|
Expense::class => 'Pengeluaran',
|
|
LeaveRequest::class => 'Pengajuan Cuti',
|
|
Order::class => 'Pesanan',
|
|
OrderItem::class => 'Item Pesanan',
|
|
Payroll::class => 'Gaji',
|
|
PayrollAdjustment::class => 'Penyesuaian Gaji',
|
|
PayrollPeriod::class => 'Periode Gaji',
|
|
Product::class => 'Produk',
|
|
ProductPrice::class => 'Harga Produk',
|
|
ProductVariant::class => 'Varian Produk',
|
|
Purchase::class => 'Belanja',
|
|
PurchaseItem::class => 'Item Belanja',
|
|
RawMaterial::class => 'Bahan Baku',
|
|
RawMaterialPrice::class => 'Harga Bahan Baku',
|
|
Rejection::class => 'Penolakan',
|
|
Supplier::class => 'Supplier',
|
|
SystemConfiguration::class => 'Konfigurasi Sistem',
|
|
User::class => 'Pengguna',
|
|
UserProfile::class => 'Profil Pengguna',
|
|
];
|
|
|
|
public static function for(?string $modelClass): string
|
|
{
|
|
if ($modelClass === null) {
|
|
return '-';
|
|
}
|
|
|
|
return self::LABELS[$modelClass] ?? class_basename($modelClass);
|
|
}
|
|
|
|
/**
|
|
* @return list<array{value: string, label: string}>
|
|
*/
|
|
public static function selectOptions(): array
|
|
{
|
|
return collect(self::LABELS)
|
|
->map(fn (string $label, string $class) => [
|
|
'value' => $class,
|
|
'label' => $label,
|
|
])
|
|
->sortBy('label')
|
|
->values()
|
|
->all();
|
|
}
|
|
}
|