fix(hse): allow soft deleting employee without losing operational history, fix simper checklist badge overflow, and enforce valid future expiry date

This commit is contained in:
Ray1111-aa
2026-11-02 14:35:24 +07:00
parent 23377631b3
commit 008e5f6b9d
12 changed files with 302 additions and 58 deletions
+5
View File
@@ -422,6 +422,11 @@ class TrashService
}
if ($item instanceof Employee) {
// Cegah hapus permanen jika karyawan memiliki riwayat operasional (menjaga integritas data)
if ($item->activities()->exists() || $item->p2hRecords()->exists() || $item->supportTimesheets()->exists()) {
throw new \RuntimeException("Karyawan '{$item->name}' ({$item->nik}) memiliki riwayat transaksi aktif dan tidak dapat dihapus permanen untuk menjaga integritas data.");
}
EmployeeSimper::withTrashed()
->where('employee_id', $item->id)
->forceDelete();