diff --git a/app/Enums/Modul.php b/app/Enums/Modul.php index 24027cdd..eb1f1a2e 100644 --- a/app/Enums/Modul.php +++ b/app/Enums/Modul.php @@ -19,104 +19,85 @@ final class Modul extends Enum const Menu = [ [ - 'text' => 'Kependudukan', + 'text' => 'Profile Kependudukan', 'icon' => 'fa fa-users', - 'permission' => 'kependudukan', + 'permission' => 'datapokok', 'submenu' => [ [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Penduduk', 'url' => 'penduduk', 'permission' => 'penduduk', ], - ], - ], - [ - 'text' => 'Data Pokok', - 'icon' => 'fas fa-chart-pie', - 'permission' => 'datapokok', - 'submenu' => [ [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Data Agama & Adat', 'url' => 'data-pokok/agama-adat', 'permission' => 'datapokok-agama-adat', ], [ - 'icon' => 'fas fa-angle-right', - 'text' => 'Data Infrastruktur', - 'url' => 'data-pokok/infrastruktur', - 'permission' => 'datapokok-infrastruktur', - ], - [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Kesehatan', 'url' => 'data-pokok/kesehatan', 'permission' => 'datapokok-kesehatan', ], [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Pendidikan', 'url' => 'data-pokok/pendidikan', 'permission' => 'datapokok-pendidikan', ], [ - 'icon' => 'fas fa-angle-right', - 'text' => 'Pariwisata', - 'url' => 'data-pokok/pariwisata', - 'permission' => 'datapokok-pariwisata', - ], - [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Ketenagakerjaan', 'url' => 'data-pokok/ketenagakerjaan', 'permission' => 'datapokok-ketenagakerjaan', ], [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Jaminan Sosial', 'url' => 'data-pokok/jaminan-sosial', 'permission' => 'datapokok-jaminan-sosial', ], [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Data Papan', 'url' => 'satu-data/dtks/papan', 'permission' => 'datapokok-papan', ], [ - 'icon' => 'fas fa-angle-right', - 'text' => 'Kepemilihan Lahan & Produksi', - 'url' => 'prodeskel/ddk/pangan', - 'permission' => 'prodeskel-ddk-pangan', + 'text' => 'Penerima Bantuan', + 'icon' => 'far fa-fw fa-circle', + 'url' => 'bantuan', + 'permission' => 'bantuan', ], ], ], [ - 'text' => 'Statistik', + 'text' => 'Statistik Kependudukan', 'icon' => 'fas fa-chart-pie', 'permission' => 'statistik', 'submenu' => [ [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Penduduk', 'url' => 'statistik/penduduk', 'permission' => 'statistik-penduduk', ], [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Keluarga', 'url' => 'statistik/keluarga', 'permission' => 'statistik-keluarga', ], [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'RTM', 'url' => 'statistik/rtm', 'permission' => 'statistik-rtm', ], [ - 'icon' => 'fas fa-angle-right', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Bantuan', 'url' => 'statistik/bantuan', 'permission' => 'statistik-bantuan', @@ -125,63 +106,36 @@ final class Modul extends Enum ], ], [ - 'text' => 'Bantuan', - 'icon' => 'fas fa-handshake', - 'url' => 'bantuan', - 'permission' => 'bantuan', - ], - [ - 'text' => 'Data Suplemen', 'icon' => 'fa fa-users', - 'url' => 'suplemen', - 'permission' => 'suplemen', + 'text' => 'Pariwisata', + 'url' => 'data-pokok/pariwisata', + 'permission' => 'datapokok-pariwisata', ], - [ - 'text' => 'Master Data', - 'icon' => 'fa fa-tags', - 'permission' => 'master-data', - 'submenu' => [ - [ - 'icon' => 'fas fa-angle-right', - 'text' => 'Bantuan', - 'url' => 'master/bantuan', - 'permission' => 'master-data-bantuan', - ], - [ - 'icon' => 'fas fa-angle-right', - 'text' => 'Kategori Artikel', - 'url' => 'master/kategori/0', - 'permission' => 'master-data-artikel', - ], - ], - ], - - [ - 'text' => 'Organisasi', + 'text' => 'SOTK', 'icon' => 'fa fa-tags', 'permission' => 'organisasi', 'submenu' => [ [ - 'icon' => 'fa fa-building', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Departemen', 'url' => 'departments', 'permission' => 'organisasi-departemen', ], [ - 'icon' => 'fa fa-star', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Jabatan', 'url' => 'positions', 'permission' => 'organisasi-position', ], [ - 'icon' => 'fa fa-users', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Pejabat Daerah', 'url' => 'employees', 'permission' => 'organisasi-employee', ], [ - 'icon' => 'fa fa-sitemap', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Struktur Bagan', 'url' => 'orgchart', 'permission' => 'organisasi-chart', @@ -189,48 +143,74 @@ final class Modul extends Enum ], ], [ - 'text' => 'Modul Web', + 'text' => 'Pengaturan OpenSID', + 'icon' => 'fa fa-tags', + 'permission' => 'pengaturan-opensid', + 'submenu' => [ + [ + 'icon' => 'far fa-fw fa-circle', + 'text' => 'Program Bantuan', + 'url' => 'master/bantuan', + 'permission' => 'master-data-bantuan', + ], + [ + 'text' => 'Data Suplemen', + 'icon' => 'far fa-fw fa-circle', + 'url' => 'suplemen', + 'permission' => 'suplemen', + ], + + [ + 'icon' => 'far fa-fw fa-circle', + 'text' => 'Kategori Artikel', + 'url' => 'master/kategori/0', + 'permission' => 'master-data-artikel', + ], + ], + ], + [ + 'text' => 'Pengaturan Web', 'icon' => 'fa fa-globe', 'permission' => 'website', 'submenu' => [ [ - 'icon' => 'fas fa-bars', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Menu Website', 'url' => 'cms/menus', 'permission' => 'website-menu', ], [ - 'icon' => 'fas fa-file-text', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Halaman', 'url' => 'cms/pages', 'permission' => 'website-pages', ], [ - 'icon' => 'fas fa-list', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Artikel', 'url' => 'cms/articles', 'permission' => 'website-article', ], [ - 'icon' => 'fas fa-folder', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Kategori Artikel', 'url' => 'cms/categories', 'permission' => 'website-categories', ], [ - 'icon' => 'fas fa-image', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Slider', 'url' => 'cms/slides', 'permission' => 'website-slider', ], [ - 'icon' => 'fas fa-download', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Daftar Unduhan', 'url' => 'cms/downloads', 'permission' => 'website-downloads', ], [ - 'icon' => 'fas fa-chart-line', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Statistik Pengunjung', 'url' => 'cms/statistik', 'permission' => 'website-statistik', @@ -238,42 +218,54 @@ final class Modul extends Enum ], ], [ - 'text' => 'Pengaturan', - 'icon' => 'fa fa-cog', - 'permission' => 'pengaturan', + 'text' => 'Pengaturan Pengguna', + 'icon' => 'fa fa-globe', + 'permission' => 'website', 'submenu' => [ [ - 'icon' => 'fas fa-cogs', - 'text' => 'Identitas', - 'url' => 'pengaturan/identitas', - 'permission' => 'pengaturan-identitas', - ], - [ - 'icon' => 'fas fa-user', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Pengguna', 'url' => 'pengaturan/users', 'permission' => 'pengaturan-users', ], [ - 'icon' => 'fas fa-users', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Grup', 'url' => 'pengaturan/groups', 'permission' => 'pengaturan-group', ], [ - 'icon' => 'fas fa-history', + 'icon' => 'far fa-fw fa-circle', 'text' => 'Riwayat Pengguna', 'url' => 'pengaturan/activities', 'permission' => 'pengaturan-activities', ], + ], + ], + [ + 'text' => 'Pengaturan Aplikasi', + 'icon' => 'fa fa-cog', + 'permission' => 'pengaturan', + 'submenu' => [ [ - 'icon' => 'fas fa-gear', + 'icon' => 'far fa-fw fa-circle', + 'text' => 'Identitas', + 'url' => 'pengaturan/identitas', + 'permission' => 'pengaturan-identitas', + ], + [ + 'icon' => 'far fa-fw fa-circle', 'text' => 'Aplikasi', 'url' => 'pengaturan/settings', 'permission' => 'pengaturan-settings', ], + [ + 'icon' => 'far fa-fw fa-circle', + 'text' => 'OpenDK', + 'url' => 'pengaturan/opendk', + 'permission' => 'pengaturan-opendk', + ], ], ], - ]; } diff --git a/app/Helpers/general.php b/app/Helpers/general.php index 8df81477..3937e89d 100644 --- a/app/Helpers/general.php +++ b/app/Helpers/general.php @@ -27,9 +27,6 @@ 'time' => 'Input Jam', 'textarea' => 'Text Area', 'select-manual' => 'Pilihan (Kustom)', - 'select-otomatis' => 'Pilihan (Referensi)', - 'hari' => 'Input Hari', - 'hari-tanggal' => 'Input Hari dan Tanggal', ])); if (! function_exists('openkab_versi')) { @@ -38,7 +35,7 @@ */ function openkab_versi() { - return 'v2501.0.0'; + return 'v2502.0.0'; } } @@ -318,7 +315,7 @@ function generateMenuPresisi($tree, $parentId = null) $result .= "{$icon}{$item->text}"; } else { $href = $item->href; - if ($href != '/presisi' and $href != '/presisi/kesehatan') { + if ($href != '/presisi' and $href != '/presisi/kesehatan' and $href != '/presisi/geo-spasial') { $href = str_contains($item->href, 'module') ? $item->href : '/'.$item->href; } $result .= "{$icon}{$item->text}"; @@ -897,3 +894,62 @@ function selected($value, $selected) } } } + +if (! function_exists('convertMenu')) { + /** + * Helper untuk menentukan convert menu agar sesuai dengan editor. + * + * @param mixed $value + * @param mixed $checked + * + * @return string + */ + function convertMenu($menu, $parentId = null, &$idCounter = 1) + { + $convertedMenu = [ + 'id' => $idCounter++, + 'parent_id' => $parentId, + 'text' => $menu['text'] ?? 'text', + 'href' => $menu['url'] ?? null, + 'icon' => $menu['icon'], + 'permission' => $menu['permission'], + ]; + + if (isset($menu['submenu']) && is_array($menu['submenu'])) { + $convertedMenu['children'] = []; + foreach ($menu['submenu'] as $submenu) { + $convertedMenu['children'][] = convertMenu($submenu, $convertedMenu['id'], $idCounter); + } + } + + return $convertedMenu; + } +} + +if (! function_exists('convertDatabaseMenu')) { + /** + * Helper untuk menentukan convert menu untuk disimpan di database. + * + * @return array + */ + function convertDatabaseMenu($menu, $parentId = null, &$idCounter = 1) + { + $convertedMenu = [ + 'id' => $idCounter++, + 'parent_id' => $parentId, + 'text' => $menu['text'] ?? 'text', + 'url' => $menu['href'] ?? null, + 'icon' => $menu['icon'] ?? null, + 'permission' => $menu['permission'] ?? null, + ]; + + if (isset($menu['children']) && is_array($menu['children'])) { + $convertedMenu['submenu'] = []; + foreach ($menu['children'] as $submenu) { + $convertedMenu['submenu'][] = convertDatabaseMenu($submenu, $convertedMenu['id'], $idCounter); + } + } + + return $convertedMenu; + } +} diff --git a/app/Http/Controllers/Api/Auth/AuthController.php b/app/Http/Controllers/Api/Auth/AuthController.php index 583d735e..2619e488 100644 --- a/app/Http/Controllers/Api/Auth/AuthController.php +++ b/app/Http/Controllers/Api/Auth/AuthController.php @@ -91,4 +91,12 @@ protected function throttleKey() { return Str::lower(request('credential')).'|'.request()->ip(); } + + public function token() + { + $user = User::whereUsername('synchronize')->first(); + $token = $user->createToken('auth_token', ['synchronize-opendk-create'])->plainTextToken; + + return response()->json(['message' => 'Token Synchronize', 'access_token' => $token, 'token_type' => 'Bearer']); + } } diff --git a/app/Http/Controllers/Api/DesaController.php b/app/Http/Controllers/Api/DesaController.php new file mode 100644 index 00000000..efabd888 --- /dev/null +++ b/app/Http/Controllers/Api/DesaController.php @@ -0,0 +1,18 @@ +fractal($this->desa->list(), new DesaTransformer(), 'daftar desa')->respond(); + } +} diff --git a/app/Http/Controllers/Api/OpendkSynchronizeController.php b/app/Http/Controllers/Api/OpendkSynchronizeController.php new file mode 100644 index 00000000..c3e0641c --- /dev/null +++ b/app/Http/Controllers/Api/OpendkSynchronizeController.php @@ -0,0 +1,34 @@ +fractal($this->opendk->listSinkronisasi(), new OpendkSynchronizeTransformer(), 'daftar sinkronisasi')->respond(); + } + + public function getData(Request $request) + { + $namaKecamatan = $request->get('nama_kecamatan'); + $kodeKecamatan = $request->get('kode_kecamatan'); + OpendkSynchronize::upsert([ + ['nama_kecamatan' => $namaKecamatan, 'kode_kecamatan' => $kodeKecamatan], + ], ['kode_kecamatan']); + + return response()->json([ + 'message' => 'Berhasil mengambil data sinkronisasi', + ], Response::HTTP_OK); + } +} diff --git a/app/Http/Controllers/Api/SettingController.php b/app/Http/Controllers/Api/SettingController.php new file mode 100644 index 00000000..26cdea71 --- /dev/null +++ b/app/Http/Controllers/Api/SettingController.php @@ -0,0 +1,59 @@ +fractal($this->setting->listsetting(), new SettingTransformer(), 'daftar setting')->respond(); + } + + /** + * Update the specified resource in storage. + * + * @return \Illuminate\Http\Response + */ + public function update(Request $request) + { + try { + foreach ($request->all() as $key => $value) { + if ($key == 'opendk_api_key') { + $this->removeTokenSynchronize($value); + } + Setting::where('key', $key)->update(['value' => $value]); + activity('data-log')->event('updated')->withProperties($request)->log('setting Aplikasi'); + } + + return response()->json([ + 'success' => true, + ], Response::HTTP_OK); + } catch (\Exception $e) { + report($e); + + return response()->json([ + 'success' => false, + 'message' => $e->getMessage(), + ], Response::HTTP_INTERNAL_SERVER_ERROR); + } + } + + private function removeTokenSynchronize($token) + { + $user = User::whereUsername('synchronize')->first(); + $excludeToken = PersonalAccessToken::findToken($token); + $user->tokens()->where('id', '!=', $excludeToken->id)->delete(); + } +} diff --git a/app/Http/Controllers/Api/SuplemenController.php b/app/Http/Controllers/Api/SuplemenController.php index 90d244bc..119cc0d6 100644 --- a/app/Http/Controllers/Api/SuplemenController.php +++ b/app/Http/Controllers/Api/SuplemenController.php @@ -7,6 +7,7 @@ use App\Http\Transformers\SuplemenTerdataTransformer; use App\Http\Transformers\SuplemenTransformer; use App\Models\Suplemen; +use App\Models\SuplemenTerdata; use Illuminate\Http\Request; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\Validator; @@ -201,6 +202,26 @@ public function destroy($id) } } + public function delete_multiple(Request $request) + { + try { + // Hapus data yang terpilih + SuplemenTerdata::whereIn('id', $request->ids)->delete(); + + return response()->json([ + 'success' => true, + ], Response::HTTP_OK); + } catch (\Exception $e) { + // report($e); + + return response()->json([ + 'success' => false, + 'message' => '', + // 'message' => $e->getMessage(), + ], Response::HTTP_INTERNAL_SERVER_ERROR); + } + } + public function detail($sasaran, $id) { $suplemenData = $this->suplemen->listSuplemenTerdata($sasaran, $id); diff --git a/app/Http/Controllers/Api/TeamController.php b/app/Http/Controllers/Api/TeamController.php index 17dc9079..9d545230 100644 --- a/app/Http/Controllers/Api/TeamController.php +++ b/app/Http/Controllers/Api/TeamController.php @@ -146,6 +146,66 @@ public function menu() ], Response::HTTP_OK); } + public function updateMenu(Request $request, $id) + { + $team = Team::find($id); + $menuTeam = json_decode($request->menu_order, 1); + $menu = []; + foreach ($menuTeam as $menuItem) { + $menu[] = convertDatabaseMenu($menuItem, null, $idCounter); + } + $team->menu_order = $menu; + $team->save(); + + return response()->json([ + 'success' => true, + ], Response::HTTP_OK); + } + + public function listModul(Request $request) + { + $id = (int) $request->id; + $team = Team::find($id); + $idCounter = 1; // Initialize the ID counter + $menuTeam = $team->menu_order ?? $team->menu; + $menu = []; + foreach ($menuTeam as $menuItem) { + $menu[] = convertMenu($menuItem, null, $idCounter); + } + + $modul = collect($team->menu)->flatMap(function ($item) { + // Initialize an array to hold the results + $results = []; + + // If the item has a non-empty URL, add it to the results + if (! empty($item['url'])) { + $results[] = [ + 'text' => $item['text'].' ('.$item['url'].')', + 'url' => $item['url'], + ]; + } + + // If the item has a submenu, recursively process it + if (! empty($item['submenu'])) { + $results = array_merge($results, collect($item['submenu'])->flatMap(function ($submenuItem) { + return ! empty($submenuItem['url']) ? [ + [ + 'text' => $submenuItem['text'].' ('.$submenuItem['url'].')', + 'url' => $submenuItem['url'], + ], + ] : []; + })->toArray()); + } + + return $results; + })->values()->pluck('text', 'url')->toArray(); + + return response()->json([ + 'success' => true, + 'data' => ['modul' => $modul, 'menu' => $menu], + ], Response::HTTP_OK); + } + private function collectPermissions($data) { $permissions = []; diff --git a/app/Http/Controllers/GroupController.php b/app/Http/Controllers/GroupController.php index 2620d3c0..598e2855 100644 --- a/app/Http/Controllers/GroupController.php +++ b/app/Http/Controllers/GroupController.php @@ -2,6 +2,8 @@ namespace App\Http\Controllers; +use App\Models\Team; + class GroupController extends Controller { private $nama_aplikasi; @@ -24,11 +26,17 @@ public function index() public function create() { - return view('group.form'); + $listPermission = $this->generateListPermission(); + + return view('group.form')->with($listPermission)->with('isAdmin', false); } public function edit($id) { - return view('group.form', ['id' => $id]); + $listPermission = $this->generateListPermission(); + $team = Team::find($id); + $isAdmin = $team->name == 'administrator' ? true : false; + + return view('group.form', ['id' => $id])->with($listPermission)->with('isAdmin', $isAdmin); } } diff --git a/app/Http/Controllers/OpenDKController.php b/app/Http/Controllers/OpenDKController.php new file mode 100644 index 00000000..010d828e --- /dev/null +++ b/app/Http/Controllers/OpenDKController.php @@ -0,0 +1,30 @@ +generateListPermission(); + + return view('opendk.index')->with($listPermission); + } + + protected function getOptionItems($id = null) + { + return []; + } +} diff --git a/app/Http/Controllers/Web/PresisiController.php b/app/Http/Controllers/Web/PresisiController.php index 3423567a..6c66ff10 100644 --- a/app/Http/Controllers/Web/PresisiController.php +++ b/app/Http/Controllers/Web/PresisiController.php @@ -518,4 +518,25 @@ public function bantuan($id = '') return view('presisi.bantuan.index', compact('id', 'categoriesItems', 'statistik')); } + + /** + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function geoSpasial() + { + $totalDesa = 0; + $pendudukSummary = 0; + $configSummary = 0; + $keluargaSummary = 0; + $categoriesItems = [ + ['key' => 'kecamatan', 'text' => 'kecamatan', 'value' => $configSummary, 'icon' => 'web/img/kecamatan.jpg'], + ['key' => 'desa', 'text' => 'desa/kelurahan', 'value' => $totalDesa, 'icon' => 'web/img/kelurahan.jpg'], + ['key' => 'penduduk', 'text' => 'jumlah penduduk', 'value' => $pendudukSummary, 'icon' => 'web/img/penduduk.jpg'], + ['key' => 'keluarga', 'text' => 'jumlah keluarga', 'value' => $keluargaSummary, 'icon' => 'web/img/bantuan.jpg'], + ]; + $listKecamatan = ['' => 'Pilih Kecamatan']; + $listDesa = ['' => 'Pilih Desa']; + + return view('presisi.geo_spasial.index', compact('categoriesItems', 'listKecamatan', 'listDesa')); + } } diff --git a/app/Http/Repository/DesaRepository.php b/app/Http/Repository/DesaRepository.php new file mode 100644 index 00000000..3cffe86a --- /dev/null +++ b/app/Http/Repository/DesaRepository.php @@ -0,0 +1,45 @@ +allowedFilters([ + AllowedFilter::exact('kode_kecamatan'), + AllowedFilter::exact('kode_desa'), + AllowedFilter::exact('id'), + AllowedFilter::callback('search', function ($query, $value) { + $query->where(function ($query) use ($value) { + $query->orWhere('nama_desa', 'like', "%{$value}%"); + $query->orWhere('kode_desa', 'like', "%{$value}%"); + $query->orWhere('website', 'like', "%{$value}%"); + }); + }), + ])->allowedSorts([ + 'kode_kecamatan', + 'kode_desa', + 'nama_desa', + 'website', + ]) + ->allowedFields([ + 'id', + 'kode_kecamatan', + 'nama_kecamatan', + 'kode_pos', + 'kode_desa', + 'nama_desa', + 'website', + 'path', + 'lat', + 'lng', + ]) + ->jsonPaginate(); + } +} diff --git a/app/Http/Repository/OpendkSynchronizeRepository.php b/app/Http/Repository/OpendkSynchronizeRepository.php new file mode 100644 index 00000000..6adcd264 --- /dev/null +++ b/app/Http/Repository/OpendkSynchronizeRepository.php @@ -0,0 +1,40 @@ +fieldSearchable; + } + + public function model(): string + { + return OpendkSynchronize::class; + } + + public function listSinkronisasi() + { + return QueryBuilder::for($this->model()) + ->allowedFields('*') + ->allowedFilters([ + AllowedFilter::callback('search', function ($query, $value) { + $query->where(function ($q) use ($value) { + $q->orWhere('kode_kecamatan', 'LIKE', '%'.$value.'%'); + $q->orWhere('nama_kecamatan', 'LIKE', '%'.$value.'%'); + }); + }), + ])->allowedSorts($this->getFieldsSearchable()) + ->jsonPaginate(); + } +} diff --git a/app/Http/Repository/SettingRepository.php b/app/Http/Repository/SettingRepository.php index ee468a6f..7b828d2c 100644 --- a/app/Http/Repository/SettingRepository.php +++ b/app/Http/Repository/SettingRepository.php @@ -42,6 +42,12 @@ public function listSetting() $q->orWhere('description', 'LIKE', '%'.$value.'%'); }); }), + AllowedFilter::callback('notkey', function ($query, $value) { + $query->whereNotIn('key', $value); + }), + AllowedFilter::callback('key', function ($query, $value) { + $query->whereIn('key', $value); + }), ])->allowedSorts($this->getFieldsSearchable()) ->jsonPaginate(); } diff --git a/app/Http/Transformers/DesaTransformer.php b/app/Http/Transformers/DesaTransformer.php new file mode 100644 index 00000000..c4e10b76 --- /dev/null +++ b/app/Http/Transformers/DesaTransformer.php @@ -0,0 +1,31 @@ +load('sebutanDesa'); + + return [ + 'id' => $config->id, + 'nama_desa' => $config->nama_desa, + 'kode_desa' => $config->kode_desa, + 'kode_pos' => $config->kode_pos, + 'nama_kecamatan' => $config->nama_kecamatan, + 'kode_kecamatan' => $config->kode_kecamatan, + 'website' => $config->website, + 'path' => $config->path, + 'sebutan_desa' => $config->sebutanDesa->value ?? '', + ]; + } +} diff --git a/app/Http/Transformers/OpendkSynchronizeTransformer.php b/app/Http/Transformers/OpendkSynchronizeTransformer.php new file mode 100644 index 00000000..dd5079f2 --- /dev/null +++ b/app/Http/Transformers/OpendkSynchronizeTransformer.php @@ -0,0 +1,19 @@ + $sync->id, + 'nama_kecamatan' => $sync->nama_kecamatan, + 'kode_kecamatan' => $sync->kode_kecamatan, + 'updated_at' => $sync->updated_at->format('d M Y, H:i:s'), + ]; + } +} diff --git a/app/Listeners/MenuListener.php b/app/Listeners/MenuListener.php index 884478d6..0ac8f092 100644 --- a/app/Listeners/MenuListener.php +++ b/app/Listeners/MenuListener.php @@ -107,7 +107,8 @@ public function handle(BuildingMenu $event) // tambahkan menu dari group $user = auth()->user(); if ($user) { - foreach ($user->team->first()?->menu ?? [] as $menu) { + $menuTeam = $user->team->first()?->menu_order ?? $user->team->first()?->menu; + foreach ($menuTeam ?? [] as $menu) { $event->menu->add($menu); } } diff --git a/app/Models/Config.php b/app/Models/Config.php index 36f8c186..b5bb2bd8 100644 --- a/app/Models/Config.php +++ b/app/Models/Config.php @@ -94,4 +94,12 @@ public function scopeOrderByTraffic($query) { return $query->orderByRaw('(SELECT sum(jumlah) FROM sys_traffic WHERE config_id = config.id) DESC'); } + + /** + * Get the sebutanDesa associated with the Config. + */ + public function sebutanDesa(): HasOne + { + return $this->hasOne(SettingAplikasi::class, 'config_id', 'id')->where('key', 'sebutan_desa'); + } } diff --git a/app/Models/OpendkSynchronize.php b/app/Models/OpendkSynchronize.php new file mode 100644 index 00000000..002b8b61 --- /dev/null +++ b/app/Models/OpendkSynchronize.php @@ -0,0 +1,24 @@ + 'json', + 'menu_order' => 'json', ]; public function role(): HasMany diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 0b364f49..0895a693 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -122,6 +122,14 @@ protected function bootConfigAdminLTE($identitasAplikasi, $settingAplikasi) $this->app->config['adminlte.title'] = $identitasAplikasi['nama_aplikasi']; $this->app->config['adminlte.title_postfix'] = "| {$identitasAplikasi['sebutan_kab']}"; $this->app->config['adminlte.logo'] = $identitasAplikasi['nama_aplikasi']; - $this->app->config['adminlte.layout_topnav'] = $settingAplikasi->get('layout_menu') !== 'Vertikal'; + if ($settingAplikasi->get('layout_menu') !== 'Vertikal') { + $this->app->config['adminlte.layout_topnav'] = true; + $this->app->config['adminlte.classes_content'] = 'col-12 p-3'; + $this->app->config['adminlte.classes_sidebar'] = 'sidebar-dark-primary elevation-4'; + $this->app->config['adminlte.classes_topnav'] = 'navbar-white navbar-light p-0'; + $this->app->config['adminlte.classes_topnav_nav'] = 'navbar-expand-lg'; + $this->app->config['adminlte.classes_topnav_container'] = 'container col-lg-12 p-2 pl-4'; + $this->app->config['adminlte.classes_content_header'] = 'container ml-3'; + } } } diff --git a/catatan_rilis.md b/catatan_rilis.md index 656ba6d4..b908500e 100644 --- a/catatan_rilis.md +++ b/catatan_rilis.md @@ -1,4 +1,4 @@ -Di rilis ini, versi 2501.0.0 berisi penambahan filter wilayah pada estunting dan perbaikan lain yang diminta pengguna. +Di rilis ini, versi 2502.0.0 berisi penambahan filter wilayah pada estunting dan perbaikan lain yang diminta pengguna. #### Penambahan Fitur @@ -7,8 +7,19 @@ Di rilis ini, versi 2501.0.0 berisi penambahan filter wilayah pada estunting dan 3. [#381](https://github.com/OpenSID/OpenKab/issues/381) Penambahan statistik penduduk berdasarkan pengaturan menu. 4. [#470](https://github.com/OpenSID/OpenKab/issues/470) Penambahan tombol data selengkapnya pada detail suplemen terdata dan pada export data. 5. [#477](https://github.com/OpenSID/OpenKab/issues/477) Penambahan pengaturan menu yang tampil bisa vertikal & horizontal. +6. [#475](https://github.com/OpenSID/OpenKab/issues/475) Penambahan fungsi multiple hapus pada halaman suplemen terdata. +7. [#489](https://github.com/OpenSID/OpenKab/issues/489) Penambahan fungsi pengaturan menu pada halaman admin. +8. [#491](https://github.com/OpenSID/OpenKab/issues/491) Penambahan halaman geo spasial. +9. [#480](https://github.com/OpenSID/OpenKab/issues/480) Penambahan preview data suplemen. +10. [#501](https://github.com/OpenSID/OpenKab/issues/501) Penambahan pengaturan token api key OpenDK. +11. [#502](https://github.com/OpenSID/OpenKab/issues/502) Penambahan API kebutuhan untuk mengambil identitas desa dengan parameter kode kecamatan dari OpenDK. #### Perbaikan BUG +1. [#485](https://github.com/OpenSID/OpenKab/issues/485) Perbaikan terkait menu pilih aksi pada OpenKab tidak berfungsi. #### Perubahan Teknis + +1. [#482](https://github.com/OpenSID/OpenKab/issues/482) Susun ulang urutan menu pada OpenKab. +2. [#487](https://github.com/OpenSID/OpenKab/issues/487) Rapikan tampilan menu horizontal. +3. [#490](https://github.com/OpenSID/OpenKab/issues/490) Hapus menu yang tidak terpakai. \ No newline at end of file diff --git a/database/factories/SuplemenTerdataFactory.php b/database/factories/SuplemenTerdataFactory.php new file mode 100644 index 00000000..dff7fb56 --- /dev/null +++ b/database/factories/SuplemenTerdataFactory.php @@ -0,0 +1,24 @@ + \App\Models\Config::factory()->create()->id ?? 1, + 'id_suplemen' => $this->faker->randomNumber(5), + 'id_terdata' => $this->faker->randomNumber(5), + 'keluarga_id' => $this->faker->randomNumber(5), + 'penduduk_id' => $this->faker->randomNumber(5), + 'sasaran' => $this->faker->randomElement([1, 0]), + 'keterangan' => $this->faker->sentence, + ]; + } +} diff --git a/database/migrations/2025_01_07_055323_update_menu_admin.php b/database/migrations/2025_01_07_055323_update_menu_admin.php new file mode 100644 index 00000000..389df806 --- /dev/null +++ b/database/migrations/2025_01_07_055323_update_menu_admin.php @@ -0,0 +1,27 @@ +longText('menu_order')->nullable()->after('menu'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('team', function (Blueprint $table) { + $table->dropColumn('menu_order'); + }); + } +}; diff --git a/database/migrations/2025_01_09_013033_hapus-menu-ekonomi.php b/database/migrations/2025_01_09_013033_hapus-menu-ekonomi.php new file mode 100644 index 00000000..c18174dc --- /dev/null +++ b/database/migrations/2025_01_09_013033_hapus-menu-ekonomi.php @@ -0,0 +1,27 @@ + di kolom name + DB::table('menus')->where('name', 'Ekonomi')->delete(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +}; diff --git a/database/migrations/2025_01_09_015004_update-menu-geospasial.php b/database/migrations/2025_01_09_015004_update-menu-geospasial.php new file mode 100644 index 00000000..f3517ca9 --- /dev/null +++ b/database/migrations/2025_01_09_015004_update-menu-geospasial.php @@ -0,0 +1,27 @@ + di kolom name + DB::table('menus')->where('name', 'Geo Spasial')->update(['url' => '/presisi/geo-spasial']); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } +}; diff --git a/database/migrations/2025_01_20_063621_create_user_synchronize.php b/database/migrations/2025_01_20_063621_create_user_synchronize.php new file mode 100644 index 00000000..c01bab8c --- /dev/null +++ b/database/migrations/2025_01_20_063621_create_user_synchronize.php @@ -0,0 +1,64 @@ + 'synchronize', + 'name' => 'Admin Sinkronisasi', + 'email' => 'synch@opendesa.id', + 'password' => 'synch@89!OK', + 'active' => StatusEnum::aktif, + ]); + + $team = Team::create([ + 'name' => 'synchronize', + 'menu' => [], + 'menu_order' => null, + ]); + + // joinkan user ke group + UserTeam::create([ + 'id_user' => $user->id, + 'id_team' => $team->id, + ]); + // assign role berdasarkan team + $role = Role::create( + [ + 'name' => $team->name, + 'team_id' => $team->id, + 'guard_name' => 'web', + ] + ); + setPermissionsTeamId($team->id); + $user->assignRole($role); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $team = Team::where('name', 'synchronize')->first(); + UserTeam::where('id_team', $team)->delete(); + $user = User::where('username', 'synchronize')->first(); + $user->delete(); + $team->role()->delete(); + $team->delete(); + } +}; diff --git a/database/migrations/2025_01_20_070417_create_setting_opendk.php b/database/migrations/2025_01_20_070417_create_setting_opendk.php new file mode 100644 index 00000000..17a3ff20 --- /dev/null +++ b/database/migrations/2025_01_20_070417_create_setting_opendk.php @@ -0,0 +1,45 @@ + 'Tidak Aktif', 'value' => 0], + ['text' => 'Aktif', 'value' => 1], + ]; + Setting::create([ + 'key' => 'opendk_synchronize', + 'name' => 'Status', + 'value' => 0, + 'type' => 'dropdown', + 'attribute' => $attribute, + 'description' => 'Pengaturan sinkronisasi dengan OpenDK', + ]); + Setting::create([ + 'key' => 'opendk_api_key', + 'name' => 'API Key', + 'value' => '', + 'type' => 'textarea', + 'description' => 'Pengaturan API Key Untuk Sinkronisasi OpenDK', + ]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Setting::whereIn('key', ['opendk_synchronize', 'opendk_api_key'])->delete(); + } +}; diff --git a/database/migrations/2025_01_20_071023_update_menu_admin.php b/database/migrations/2025_01_20_071023_update_menu_admin.php new file mode 100644 index 00000000..57872079 --- /dev/null +++ b/database/migrations/2025_01_20_071023_update_menu_admin.php @@ -0,0 +1,74 @@ + 'far fa-fw fa-circle', + 'text' => 'OpenDK', + 'url' => 'pengaturan/opendk', + 'permission' => 'pengaturan-opendk', + ]; + $team = Team::where('name', 'administrator')->first(); + $menuOrder = $team->menu_order ?? []; + if (! $menuOrder) { + return; + } + $menuOrderBaru = collect($menuOrder)->map(function ($item) use ($menuBaru) { + if ($item['text'] == 'Pengaturan') { + if (! isset($item['submenu'])) { + $item['submenu'] = []; + } + $menuBaru['parent_id'] = $item['id']; + $item['submenu'][] = $menuBaru; + } + + return $item; + })->toArray(); + $team->menu_order = $menuOrderBaru; + $team->save(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $menuBaru = [ + 'icon' => 'far fa-fw fa-circle', + 'text' => 'OpenDK', + 'url' => 'pengaturan/opendk', + 'permission' => 'pengaturan-opendk', + ]; + $team = Team::where('name', 'administrator')->first(); + $menuOrder = $team->menu_order ?? []; + if (! $menuOrder) { + return; + } + $menuOrderBaru = collect($menuOrder)->map(function ($item) use ($menuBaru) { + if ($item['text'] === 'Pengaturan') { + $item['submenu'] = collect($item['submenu'])->filter(function ($submenu) use ($menuBaru) { + return $submenu['url'] !== $menuBaru['url']; + })->toArray(); + } + + return $item; + })->toArray(); + + $team->menu_order = $menuOrderBaru; + $team->save(); + } +}; diff --git a/database/migrations/2025_01_20_135841_create_table_opendk_synchronize.php b/database/migrations/2025_01_20_135841_create_table_opendk_synchronize.php new file mode 100644 index 00000000..55a3b12e --- /dev/null +++ b/database/migrations/2025_01_20_135841_create_table_opendk_synchronize.php @@ -0,0 +1,33 @@ +id(); + $table->string('kode_kecamatan', 8)->unique(); + $table->string('nama_kecamatan', 60); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('opendk_synchronize'); + } +}; diff --git a/resources/views/bantuan/index.blade.php b/resources/views/bantuan/index.blade.php index 5123c70e..320e26e1 100644 --- a/resources/views/bantuan/index.blade.php +++ b/resources/views/bantuan/index.blade.php @@ -148,8 +148,10 @@ className: 'text-nowrap', { data: function(data) { return ` - - ` + + `; + + }, }, { diff --git a/resources/views/group/akses.blade.php b/resources/views/group/akses.blade.php new file mode 100644 index 00000000..cf7ec30a --- /dev/null +++ b/resources/views/group/akses.blade.php @@ -0,0 +1,111 @@ +
- Ekonomi -
- -