[Operator] Pembaruan Laman Operator
This commit is contained in:
@@ -360,16 +360,28 @@ final class ReferenceCrud implements ReferenceWriter
|
||||
|
||||
// ---- pilihan formulir ----
|
||||
|
||||
/** @return array<int, string> unit pemilik (universitas dan fakultas) */
|
||||
private function units(): array
|
||||
/** @var array{fak: list<int>, prodi: list<int>, all: list<int>}|null batas unit akun; pilihan select sekaligus validasinya (aturan select memakai options) */
|
||||
private ?array $scope = null;
|
||||
|
||||
public function scopeTo(?array $scope): void
|
||||
{
|
||||
return $this->labels($this->db()->table('t_bagian')->whereIn('idjenisbagian', [0, 1])->orderBy('namabagian')->pluck('namabagian', 'idbagian'));
|
||||
$this->scope = $scope;
|
||||
}
|
||||
|
||||
/** @return array<int, string> */
|
||||
/** @return array<int, string> unit pemilik (universitas dan fakultas; akun berunit: fakultasnya saja) */
|
||||
private function units(): array
|
||||
{
|
||||
return $this->labels($this->db()->table('t_bagian')->whereIn('idjenisbagian', [0, 1])
|
||||
->when($this->scope !== null, fn ($q) => $q->whereIn('idbagian', $this->scope['fak']))
|
||||
->orderBy('namabagian')->pluck('namabagian', 'idbagian'));
|
||||
}
|
||||
|
||||
/** @return array<int, string> gedung (akun berunit: gedung milik unitnya saja) */
|
||||
private function buildings(): array
|
||||
{
|
||||
return $this->labels($this->db()->table('t_gedung')->orderBy('namagedung')->orderBy('idgedung')->pluck('namagedung', 'idgedung'));
|
||||
return $this->labels($this->db()->table('t_gedung')
|
||||
->when($this->scope !== null, fn ($q) => $q->whereIn('idbagian', $this->scope['all']))
|
||||
->orderBy('namagedung')->orderBy('idgedung')->pluck('namagedung', 'idgedung'));
|
||||
}
|
||||
|
||||
/** @return array<int, string> */
|
||||
|
||||
Reference in New Issue
Block a user