diff --git a/.env.example b/.env.example index 1c3a43d8..d31912fa 100644 --- a/.env.example +++ b/.env.example @@ -11,7 +11,7 @@ LOG_LEVEL=debug # default connection ke database utama DB_CONNECTION=mysql -# database utama aplikasi openkab +# database utama aplikasi OpenKab DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=openkab diff --git a/app/Enums/Modul.php b/app/Enums/Modul.php index 8a1c5ba6..bef64baa 100644 --- a/app/Enums/Modul.php +++ b/app/Enums/Modul.php @@ -13,24 +13,8 @@ */ final class Modul extends Enum { - const Data = [ - 'wilayah', - 'kependudukan', - 'penduduk', - 'dokumen', - 'bantuan', - 'statistik', - 'statistik-penduduk', - 'statistik-keluarga', - 'statistik-rtm', - 'statistik-bantuan', - 'master-data', - 'master-data-bantuan', - 'master-data-artikel', - 'master-data-pengaturan', - 'pengaturan', - 'pengaturan-identitas', - 'pengaturan-users', + const permision = [ + 'read', 'write', 'edit', 'delete', ]; const Menu = [ diff --git a/app/Helpers/general.php b/app/Helpers/general.php index 31189710..aa361d18 100644 --- a/app/Helpers/general.php +++ b/app/Helpers/general.php @@ -10,7 +10,7 @@ */ function openkab_versi() { - return 'v2307.0.0'; + return 'v2308.0.0'; } } diff --git a/app/Http/Controllers/Api/PermisionController.php b/app/Http/Controllers/Api/PermisionController.php new file mode 100644 index 00000000..f32e92b5 --- /dev/null +++ b/app/Http/Controllers/Api/PermisionController.php @@ -0,0 +1,65 @@ +fractal($this->team->listTeam()->where('id', $id)->first(), function ($team) { + return $this->fractal($this->team->listTeam()->with(['role', 'role.permissions'])->where('id', $id)->first(), function ($team) { return $team->toArray(); }, 'team')->respond(); } diff --git a/app/Http/Controllers/DasborController.php b/app/Http/Controllers/DasborController.php index e8ebee60..b7d3d349 100644 --- a/app/Http/Controllers/DasborController.php +++ b/app/Http/Controllers/DasborController.php @@ -2,10 +2,15 @@ namespace App\Http\Controllers; +use App\Models\Identitas; + class DasborController extends Controller { public function index() { - return view('dasbor.index'); + $identitas = new Identitas(); + $data = $identitas->pengaturan(); + + return view('dasbor.index', compact('data')); } } diff --git a/app/Http/Controllers/GroupController.php b/app/Http/Controllers/GroupController.php index 9ba2c401..97972a8d 100644 --- a/app/Http/Controllers/GroupController.php +++ b/app/Http/Controllers/GroupController.php @@ -4,9 +4,18 @@ class GroupController extends Controller { + private $nama_aplikasi; + + public function __construct() + { + $this->nama_aplikasi = 'Group '.config('app.namaAplikasi'); + } + public function index() { - return view('group.index'); + return view('group.index', [ + 'nama_aplikasi' => $this->nama_aplikasi, + ]); } public function create() diff --git a/app/Models/Identitas.php b/app/Models/Identitas.php index e9a95c89..c3b45edf 100644 --- a/app/Models/Identitas.php +++ b/app/Models/Identitas.php @@ -8,4 +8,24 @@ class Identitas extends Model { use HasFactory; + + protected $table = 'identitas'; + + protected $fillable = [ + 'nama_aplikasi', 'deskripsi', 'favicon', + 'logo', 'nama_kabupaten', 'kode_kabupaten', + 'nama_provinsi', 'kode_provinsi', 'sebutan_kab', + ]; + + public static function pengaturan() + { + $identitas = self::first(); + + $data['nama_aplikasi'] = $identitas->nama_aplikasi ?? config('app.namaAplikasi'); + $data['sebutanKab'] = $identitas->sebutan_kab ?? config('app.sebutanKab'); + $nama_kabupaten = preg_replace('/KAB/', '', $identitas->nama_kabupaten) ?? config('app.namaKab'); + $data['nama_kabupaten'] = strtolower($data['sebutanKab']) == 'kota' ? $nama_kabupaten : $data['sebutanKab'].' '.$nama_kabupaten; + + return $data; + } } diff --git a/app/Models/Permision.php b/app/Models/Permision.php new file mode 100644 index 00000000..3bec247a --- /dev/null +++ b/app/Models/Permision.php @@ -0,0 +1,11 @@ + 'json', ]; + + public function role(): HasMany + { + return $this->hasMany(Role::class, 'team_id', 'id'); + } } diff --git a/catatan_rilis.md b/catatan_rilis.md new file mode 100644 index 00000000..7e5505d0 --- /dev/null +++ b/catatan_rilis.md @@ -0,0 +1,13 @@ +Di rilis v2308.0.0 berisi penambahan fitur dan perbaikan lain sesuai dengan pelayanan ke pelanggan. + +#### Penambahan Fitur + +1. [#198](https://github.com/OpenSID/OpenKab/issues/198) Sediakan API untuk manajemen hak akses pengguna OpenKab. + +#### Perbaikan BUG + +1. [#206](https://github.com/OpenSID/OpenKab/issues/206) Perbaikan filter pada bantuan tidak berjalan. +2. [#219](https://github.com/OpenSID/OpenKab/issues/219) Perbaikan hilangkan url pada widget keluarga dan rtm. +3. [#218](https://github.com/OpenSID/OpenKab/issues/218) Perbaikan Sambutan selamat datang tidak sesuai dengan pengaturan. +4. [#220](https://github.com/OpenSID/OpenKab/issues/220) Perbaikan hilangkan duplikat seeder. +5. [#226](https://github.com/OpenSID/OpenKab/issues/226) Perbaikan semua penamaan OpenKAB menjadi OpenKab. diff --git a/config/adminlte.php b/config/adminlte.php index aa72b7c3..0468785b 100644 --- a/config/adminlte.php +++ b/config/adminlte.php @@ -14,7 +14,7 @@ | */ - 'title' => 'OpenKAB', + 'title' => 'OpenKab', 'title_prefix' => '', 'title_postfix' => '', @@ -68,7 +68,7 @@ 'logo_img_class' => 'brand-image elevation-3', 'logo_img_xl' => null, 'logo_img_xl_class' => 'brand-image-xs', - 'logo_img_alt' => 'OpenKAB', + 'logo_img_alt' => 'OpenKab', /* |-------------------------------------------------------------------------- diff --git a/database/migrations/2023_04_29_131347_create_identitas_table.php b/database/migrations/2023_04_29_131347_create_identitas_table.php index 8d3f4e47..7826dc00 100644 --- a/database/migrations/2023_04_29_131347_create_identitas_table.php +++ b/database/migrations/2023_04_29_131347_create_identitas_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Schema; return new class extends Migration @@ -26,6 +27,11 @@ public function up() $table->string('sebutan_kab', 100); $table->timestamps(); }); + + Artisan::call('db:seed', [ + '--class' => 'IdentitasSeeder', + '--force' => true, + ]); } /** diff --git a/database/migrations/2023_05_04_180525_seed_identitas.php b/database/migrations/2023_05_04_180525_seed_identitas.php deleted file mode 100644 index 775cb73e..00000000 --- a/database/migrations/2023_05_04_180525_seed_identitas.php +++ /dev/null @@ -1,30 +0,0 @@ - 'IdentitasSeeder', - '--force' => true, - ]); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - // - } -}; diff --git a/database/migrations/2023_06_13_073258_create_role.php b/database/migrations/2023_06_13_073258_create_role.php index 51c9e81d..f4e3889b 100644 --- a/database/migrations/2023_06_13_073258_create_role.php +++ b/database/migrations/2023_06_13_073258_create_role.php @@ -30,15 +30,29 @@ public function up() 'id_team' => $team->id, ]); - foreach (Modul::Data as $value) { + foreach (Modul::Menu as $main_menu) { + // buat role $role = Role::create( [ - 'name' => $value, + 'name' => $main_menu['role'], 'team_id' => $team->id, 'guard_name' => 'web', ] ); $user->assignRole($role->id); + + if (isset($main_menu['submenu'])) { + foreach ($main_menu['submenu'] as $sub_menu) { + $role = Role::create( + [ + 'name' => $sub_menu['role'], + 'team_id' => $team->id, + 'guard_name' => 'web', + ] + ); + $user->assignRole($role->id); + } + } } } diff --git a/database/migrations/2023_06_21_190927_permision.php b/database/migrations/2023_06_21_190927_permision.php new file mode 100644 index 00000000..1a5bc5b1 --- /dev/null +++ b/database/migrations/2023_06_21_190927_permision.php @@ -0,0 +1,56 @@ +get(); + + foreach (Modul::permision as $permision) { + $name_permision = $main_menu['role'].'-'.$permision; + $permision = Permission::create(['name' => $name_permision]); + foreach ($roles as $role) { + $role->givePermissionTo($name_permision); + } + } + + if (isset($main_menu['submenu'])) { + foreach ($main_menu['submenu'] as $sub_menu) { + $roles = Role::where('name', $sub_menu['role'])->get(); + foreach (Modul::permision as $permision) { + $name_permision = $sub_menu['role'].'-'.$permision; + Permission::create(['name' => $name_permision]); + foreach ($roles as $role) { + $role->givePermissionTo($name_permision); + } + } + } + } + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index ceaa8ae2..fec85d33 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -14,9 +14,6 @@ class DatabaseSeeder extends Seeder */ public function run() { - $this->call([ - CreateAdminUserSeeder::class, - IdentitasSeeder::class, - ]); + // } } diff --git a/resources/views/components/progressive-image.blade.php b/resources/views/components/progressive-image.blade.php index 60e4bfaf..8f30de93 100644 --- a/resources/views/components/progressive-image.blade.php +++ b/resources/views/components/progressive-image.blade.php @@ -1,4 +1,5 @@ @push('css') + @endpush diff --git a/resources/views/dasbor/index.blade.php b/resources/views/dasbor/index.blade.php index fdbeb36c..148ecc0c 100644 --- a/resources/views/dasbor/index.blade.php +++ b/resources/views/dasbor/index.blade.php @@ -12,7 +12,7 @@ @section('content') Selamat datang {{ Auth::user()->username ?? '' }} di Dasbor Utama - {{ config('app.namaAplikasi') . ' ' . config('app.sebutanKab') . ' ' . config('app.namaKab') }}. + {{ ucwords(strtolower($data['nama_aplikasi'])) . ' ' . ucwords(strtolower($data['nama_kabupaten'])) }}.
@@ -21,12 +21,12 @@ icon-theme="blue" /> - + - + diff --git a/resources/views/group/index.blade.php b/resources/views/group/index.blade.php index e411671f..4f1a70e8 100644 --- a/resources/views/group/index.blade.php +++ b/resources/views/group/index.blade.php @@ -1,9 +1,9 @@ @extends('layouts.index') -@section('title', 'Identitas OpenKAB') +@section('title', $nama_aplikasi) @section('content_header') -

Group OpenKAB

+

{{ $nama_aplikasi }}

@stop @section('content') diff --git a/resources/views/identitas/edit.blade.php b/resources/views/identitas/edit.blade.php index 959e75bd..816d2b50 100644 --- a/resources/views/identitas/edit.blade.php +++ b/resources/views/identitas/edit.blade.php @@ -22,7 +22,7 @@ Logo -
Logo OpenKAB
+
Logo {{ config('app.namaAplikasi') }}