Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ public function getUsers(Request $request)
if ($request->ajax()) {
$permission = $this->generateListPermission();

return DataTables::of(User::with('team')->visibleForAuthenticatedUser()->get())
$allKabupaten = (new ConfigApiService)->kabupaten();
$kabupatenMap = collect($allKabupaten)->keyBy('kode_kabupaten');

return DataTables::of(User::with(['team'])->visibleForAuthenticatedUser()->get())
->addIndexColumn()
->addColumn('nama_kabupaten', function ($row) {
->addColumn('nama_kabupaten', function ($row) use ($kabupatenMap) {
if (empty($row->kode_kabupaten)) {
return '-';
}

$kabupaten = (new ConfigApiService)->kabupaten([
'filter[kode_kabupaten]' => $row->kode_kabupaten,
]);

return optional($kabupaten->first())->nama_kabupaten ?? '-';
return $kabupatenMap->get($row->kode_kabupaten)?->nama_kabupaten ?? '-';
})
->addColumn('aksi', function ($row) use ($permission) {
$data = [];
Expand Down Expand Up @@ -127,7 +126,7 @@ public function store(UserRequest $request)
'email' => $data['email'],
'company' => $data['company'],
'phone' => $data['phone'],
'password' => $data['password'],
'password' => $data['password'],
'active' => 1,
'telegram_chat_id' => $data['telegram_chat_id'],
'kode_kabupaten' => $currentUser->getEffectiveKodeKabupaten($request->input('kode_kabupaten')),
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Web/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getCategory(Category $category)
{
return view('web.articles', [
'title' => $category->name,
'articles' => Article::where('category_id', $category->id)->paginate(4),
'articles' => Article::with('category')->where('category_id', $category->id)->paginate(4),
]);
}

Expand Down
10 changes: 9 additions & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ public function team()

public function getTeamId()
{
if ($this->relationLoaded('team') && $this->team !== null) {
return $this->team->first()?->id;
}

return $this->team()->first()?->id;
}

Expand All @@ -141,7 +145,11 @@ public function adminlte_profile_url()

public function adminlte_desc()
{
return $this->team()->first()->name;
if ($this->relationLoaded('team') && $this->team !== null) {
return $this->team->first()?->name ?? '-';
}

return $this->team()->first()?->name ?? '-';
}

public function isSuperAdmin()
Expand Down
6 changes: 1 addition & 5 deletions catatan_rilis.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ Di rilis ini, versi 2603.0.0 berisi penambahan dan perbaikan yang diminta penggu

#### Penambahan Fitur

1. [#933](https://github.com/OpenSID/OpenKab/issues/933) Penambahan fungsi filter data Belum Lengkap pada data presisi.
2. [#934](https://github.com/OpenSID/OpenKab/issues/934) Implementasi Pengurutan (Sorting) di Halaman Statistik Data Presisi.

#### Perbaikan BUG



#### Perubahan Teknis

1. [#932](https://github.com/OpenSID/OpenKab/issues/932) Mengurutkan daftar menu pada OpenKab.
2. [#935](https://github.com/OpenSID/OpenKab/issues/935) Perubahan router yang mendukung server.
1. [#943](https://github.com/OpenSID/OpenKab/issues/943) N+1 Query problem pada manajemen user.
Loading