From f9f6acd05585f5639beeaee877b092db9a5fa2c5 Mon Sep 17 00:00:00 2001 From: Mis Arianto <40069708+misarianto@users.noreply.github.com> Date: Thu, 24 Oct 2024 01:18:07 +0700 Subject: [PATCH] fixed: Penambahan halaman menu dinamis pada halaman admin & penyesuaian halaman public #1025 (#1061) Co-authored-by: Abah Roland <59082428+vickyrolanda@users.noreply.github.com> --- .../Controllers/FrontEnd/PageController.php | 8 + app/Http/Controllers/FrontEndController.php | 2 + .../Informasi/ArtikelController.php | 4 +- .../Controllers/Setting/NavMenuController.php | 105 +++ .../Kerjasama/PendaftaranKerjasama.php | 22 +- app/Http/Requests/ArtikelRequest.php | 1 + app/Models/Artikel.php | 10 +- app/Models/Kategori.php | 40 ++ app/Models/NavMenu.php | 39 ++ app/Services/ApiService.php | 14 +- catatan_rilis.md | 8 +- ...17_10_31_165347_create_nav_menus_table.php | 37 + ...21_10_15_100729_create_kategoris_table.php | 33 + ...add_field_kategori_id_in_table_artikel.php | 33 + ...1813_add_field_type_in_table_nav_menus.php | 32 + .../2024_10_22_120555_add_menu_dinamis.php | 270 ++++++++ database/seeders/DatabaseSeeder.php | 1 + database/seeders/RefKategori.php | 66 ++ .../menu-editor/bootstrap-iconpicker.min.js | 11 + .../menu-editor/jquery-menu-editor-copy.jsxx | 571 ++++++++++++++++ .../menu-editor/jquery-menu-editor.js | 636 ++++++++++++++++++ .../views/informasi/artikel/_form.blade.php | 9 + .../views/layouts/fragments/sidebar.blade.php | 7 +- .../views/setting/nav_menu/field.blade.php | 155 +++++ .../views/setting/nav_menu/field.blade.phpx | 116 ++++ .../views/setting/nav_menu/index.blade.php | 197 ++++++ .../views/setting/nav_menu/index.blade.phpx | 186 +++++ routes/web.php | 8 + .../views/components/header.blade.php | 18 +- .../views/pages/berita/kategori.blade.php | 22 + 30 files changed, 2636 insertions(+), 25 deletions(-) create mode 100644 app/Http/Controllers/Setting/NavMenuController.php create mode 100644 app/Models/Kategori.php create mode 100644 app/Models/NavMenu.php create mode 100644 database/migrations/2017_10_31_165347_create_nav_menus_table.php create mode 100644 database/migrations/2021_10_15_100729_create_kategoris_table.php create mode 100644 database/migrations/2024_10_03_203704_add_field_kategori_id_in_table_artikel.php create mode 100644 database/migrations/2024_10_04_101813_add_field_type_in_table_nav_menus.php create mode 100644 database/migrations/2024_10_22_120555_add_menu_dinamis.php create mode 100644 database/seeders/RefKategori.php create mode 100644 public/bower_components/menu-editor/bootstrap-iconpicker.min.js create mode 100644 public/bower_components/menu-editor/jquery-menu-editor-copy.jsxx create mode 100644 public/bower_components/menu-editor/jquery-menu-editor.js create mode 100644 resources/views/setting/nav_menu/field.blade.php create mode 100644 resources/views/setting/nav_menu/field.blade.phpx create mode 100644 resources/views/setting/nav_menu/index.blade.php create mode 100644 resources/views/setting/nav_menu/index.blade.phpx create mode 100644 themes/opendk/default/resources/views/pages/berita/kategori.blade.php diff --git a/app/Http/Controllers/FrontEnd/PageController.php b/app/Http/Controllers/FrontEnd/PageController.php index 466d92f33..b1449ae55 100644 --- a/app/Http/Controllers/FrontEnd/PageController.php +++ b/app/Http/Controllers/FrontEnd/PageController.php @@ -41,6 +41,7 @@ use Illuminate\Support\Facades\Session; use willvincent\Feeds\Facades\FeedsFacade; use App\Http\Controllers\FrontEndController; +use App\Models\Kategori; use Jenssegers\Agent\Agent; class PageController extends FrontEndController @@ -181,6 +182,13 @@ public function refresh_captcha() return response()->json(['captcha' => captcha_img('mini')]); } + public function kategoriBerita($slug) + { + $kategori = Kategori::where('slug', $slug)->firstOrFail(); + $artikel = Artikel::whereRelation('kategori', 'slug', $slug)->paginate(9); + return view('pages.berita.kategori', compact('artikel', 'kategori')); + } + public function detailBerita($slug, Request $request) { // Temukan artikel berdasarkan slug diff --git a/app/Http/Controllers/FrontEndController.php b/app/Http/Controllers/FrontEndController.php index 94fc40525..19f747216 100644 --- a/app/Http/Controllers/FrontEndController.php +++ b/app/Http/Controllers/FrontEndController.php @@ -35,6 +35,7 @@ use App\Models\Slide; use App\Models\Navigation; use App\Models\MediaSosial; +use App\Models\NavMenu; use App\Models\SinergiProgram; use Illuminate\Support\Facades\View; @@ -49,6 +50,7 @@ public function __construct() 'events' => Event::getOpenEvents(), 'medsos' => MediaSosial::where('status', 1)->get(), 'navigations' => Navigation::with('childrens')->whereNull('parent_id')->where('status', 1)->orderBy('order', 'asc')->get(), + 'navmenus' => NavMenu::with('children')->whereNull('parent_id')->where('is_show', 1)->orderBy('order', 'asc')->get(), 'sinergi' => SinergiProgram::where('status', 1)->orderBy('urutan', 'asc')->get(), 'slides' => Slide::orderBy('created_at', 'DESC')->get(), ]); diff --git a/app/Http/Controllers/Informasi/ArtikelController.php b/app/Http/Controllers/Informasi/ArtikelController.php index 1305d9e6c..5fb4d15c9 100644 --- a/app/Http/Controllers/Informasi/ArtikelController.php +++ b/app/Http/Controllers/Informasi/ArtikelController.php @@ -137,7 +137,7 @@ public function update(ArtikelRequest $request, Artikel $artikel) $file = $request->file('gambar'); $path = Storage::putFile('public/artikel', $file); - Storage::delete('public/artikel/'.$artikel->getRawOriginal('gambar')); + Storage::delete('public/artikel/' . $artikel->getRawOriginal('gambar')); $input['gambar'] = substr($path, 15); } @@ -156,7 +156,7 @@ public function destroy(Artikel $artikel) { try { if ($artikel->delete()) { - Storage::delete('public/artikel/'.$artikel->getRawOriginal('gambar')); + Storage::delete('public/artikel/' . $artikel->getRawOriginal('gambar')); } } catch (\Exception $e) { report($e); diff --git a/app/Http/Controllers/Setting/NavMenuController.php b/app/Http/Controllers/Setting/NavMenuController.php new file mode 100644 index 000000000..2c2bd5e50 --- /dev/null +++ b/app/Http/Controllers/Setting/NavMenuController.php @@ -0,0 +1,105 @@ +whereNull('parent_id') + ->with(['children' => function ($q) { + $q->selectRaw("id, parent_id , name as text, url as href, target, is_show,type,'fa fa-list' as icon"); + }]) + ->orderBy('order') + ->get() + ->toArray(); + + $nav_menus = json_encode($menus); + + $sourceItem = [ + 'Halaman' => Artikel::cursor()->pluck('judul', 'link')->toArray(), + 'Kategori' => Kategori::cursor()->pluck('nama', 'link')->toArray(), + ]; + + return view('setting.nav_menu.index', compact('page_title', 'page_description', 'nav_menus', 'sourceItem')); + } + + + public function store(Request $request) + { + NavMenu::whereNotNull('id')->delete(); + try { + // hapus data lama lalu buat lagi + $json = json_decode($request->json_menu, 1); + + $this->loopTree($json); + + return redirect()->route('setting.navmenu.index')->with('success', 'Menu berhasil disimpan!'); + } catch (\Throwable $th) { + throw $th; + } + } + + private function loopTree(array $elements, $parentId = null) + { + $sequence = 1; + foreach ($elements as $element) { + $input = [ + 'name' => $element['text'], + 'url' => $element['href'], + 'target' => $element['target'], + 'type' => $element['type'], + 'is_show' => isset($element['is_show']) ? $element['is_show'] : 1, + 'order' => $sequence, + 'parent_id' => $parentId, + ]; + + $model = NavMenu::create($input); + + // Jika ada children, rekursi untuk menyimpan sub-menu + if (isset($element['children'])) { + $this->loopTree($element['children'], $model->id); + } + $sequence++; + } + } +} diff --git a/app/Http/Livewire/Kerjasama/PendaftaranKerjasama.php b/app/Http/Livewire/Kerjasama/PendaftaranKerjasama.php index cc151cf15..bfc5a8099 100644 --- a/app/Http/Livewire/Kerjasama/PendaftaranKerjasama.php +++ b/app/Http/Livewire/Kerjasama/PendaftaranKerjasama.php @@ -2,11 +2,12 @@ namespace App\Http\Livewire\Kerjasama; -use App\Models\SettingAplikasi; -use App\Services\ApiService; -use Illuminate\Support\Facades\Storage; use Livewire\Component; +use App\Services\ApiService; use Livewire\WithFileUploads; +use App\Models\SettingAplikasi; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Storage; class PendaftaranKerjasama extends Component { @@ -37,6 +38,21 @@ public function mount() $this->kecamatan_id = view()->shared('profil')->kecamatan_id; $this->domain = config('app.url'); + + // Ambil settings sebagai objek + $setting = (object) SettingAplikasi::pluck('value', 'key')->toArray(); + + // Periksa apakah 'layanan_opendesa_token' tidak ada + if (!property_exists($setting, 'layanan_opendesa_token')) { + DB::table('das_setting')->insert([ + 'key' => 'layanan_opendesa_token', + 'value' => 0, + 'type' => 'input', + 'description' => 'Token pelanggan Layanan OpenDESA', + 'kategori' => 'pelanggan', + 'option' => '{}', + ]); + } } public function render() diff --git a/app/Http/Requests/ArtikelRequest.php b/app/Http/Requests/ArtikelRequest.php index 177d05e9c..dcd809bd6 100644 --- a/app/Http/Requests/ArtikelRequest.php +++ b/app/Http/Requests/ArtikelRequest.php @@ -55,6 +55,7 @@ public function rules() return [ 'judul' => 'required|string|max:191', 'isi' => 'required', + 'kategori_id' => 'required', 'status' => 'required', 'gambar' => 'nullable|image|mimes:jpg,jpeg,png|max:1024|valid_file', ]; diff --git a/app/Models/Artikel.php b/app/Models/Artikel.php index 0167c051c..0b2541053 100644 --- a/app/Models/Artikel.php +++ b/app/Models/Artikel.php @@ -31,10 +31,12 @@ namespace App\Models; +use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Storage; use Cviebrock\EloquentSluggable\Sluggable; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\BelongsTo; class Artikel extends Model { @@ -47,6 +49,7 @@ class Artikel extends Model 'id_kategori', 'judul', 'gambar', + 'kategori_id', 'isi', 'status', ]; @@ -65,7 +68,7 @@ public function sluggable(): array public function getGambarAttribute() { - return $this->attributes['gambar'] ? Storage::url('artikel/'.$this->attributes['gambar']) : null; + return $this->attributes['gambar'] ? Storage::url('artikel/' . $this->attributes['gambar']) : null; } public function getIsiAttribute() @@ -89,4 +92,9 @@ public function comments() { return $this->hasMany(Comment::class, 'das_artikel_id')->orderBy('created_at', 'desc'); } + + public function getLinkAttribute(): string + { + return Str::replaceFirst(url('/'), '', route('berita.detail', ['slug' => $this->slug])); + } } diff --git a/app/Models/Kategori.php b/app/Models/Kategori.php new file mode 100644 index 000000000..2988fe6b4 --- /dev/null +++ b/app/Models/Kategori.php @@ -0,0 +1,40 @@ + [ + 'source' => 'nama', + ], + ]; + } + + public function artikels(): HasMany + { + return $this->hasMany(Artikel::class, 'kategori_id'); + } + + public function getLinkAttribute(): string + { + return Str::replaceFirst(url('/'), '', route('berita.kategori', ['slug' => $this->slug])); + } +} diff --git a/app/Models/NavMenu.php b/app/Models/NavMenu.php new file mode 100644 index 000000000..b52eab2c1 --- /dev/null +++ b/app/Models/NavMenu.php @@ -0,0 +1,39 @@ + 'boolean' + ]; + + public function child(): HasMany + { + return $this->hasMany(NavMenu::class, 'parent_id', 'id'); + } + + public function children(): HasMany + { + return $this->hasMany(NavMenu::class, 'parent_id', 'id')->with(['children' => function ($q) { + return $q->selectRaw("id, parent_id , name as text, url as href, target, type, is_show,'fa fa-list' as icon"); + }]); + } +} diff --git a/app/Services/ApiService.php b/app/Services/ApiService.php index d42411ed1..ac6232806 100644 --- a/app/Services/ApiService.php +++ b/app/Services/ApiService.php @@ -17,18 +17,8 @@ class ApiService public function __construct() { - $this->setting = json_decode(json_encode(SettingAplikasi::pluck('value', 'key')->toArray())); - - if (isset($this->setting->layanan_opendesa_token) == false) { - DB::table('das_setting')->insert([ - 'key' => 'layanan_opendesa_token', - 'value' => 0, - 'type' => 'input', - 'description' => 'Token pelanggan Layanan OpenDESA', - 'kategori' => 'pelanggan', - 'option' => '{}', - ]); - } + // Ambil settings sebagai objek + $this->setting = (object) SettingAplikasi::pluck('value', 'key')->toArray(); $this->server = config('app.server_layanan'); } diff --git a/catatan_rilis.md b/catatan_rilis.md index 0a4b86507..da5f231e6 100644 --- a/catatan_rilis.md +++ b/catatan_rilis.md @@ -4,9 +4,11 @@ Terima kasih pada @uddinmtm telah ikut berkontribusi. #### FITUR -1. [#632](https://github.com/OpenSID/OpenDK/issues/632) Tambahkan fitur penanganan komentar dan balasan komentar pada halaman detail artikel. -2. [#1024](https://github.com/OpenSID/OpenDK/issues/1024) Tambahkan fitur modul galeri pada website OpenDK. -3. [#1026](https://github.com/OpenSID/OpenDK/issues/1026) Tambahkan menu kategori artikel. +1. [#632](https://github.com/OpenSID/OpenDK/issues/632) Penambahan fitur penanganan komentar dan balasan komentar pada halaman detail artikel. +2. [#1024](https://github.com/OpenSID/OpenDK/issues/1024) Penambahan fitur modul galeri pada website OpenDK. +3. [#1026](https://github.com/OpenSID/OpenDK/issues/1026) Penambahan menu kategori artikel. +4. [#1025](https://github.com/OpenSID/OpenDK/issues/1025) Penambahan menu dinamis pada halaman admin & penyesuaian halaman public. + #### BUG diff --git a/database/migrations/2017_10_31_165347_create_nav_menus_table.php b/database/migrations/2017_10_31_165347_create_nav_menus_table.php new file mode 100644 index 000000000..647326b34 --- /dev/null +++ b/database/migrations/2017_10_31_165347_create_nav_menus_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('name'); + $table->string('url')->comment('bisa berisi link atau url'); + $table->enum('target', ['_self', '_blank', '_top'])->default('_self'); + $table->integer('parent_id')->nullable(); + $table->integer('order')->default(0); + $table->boolean('is_show')->default(true)->comment('Status ditampilkan'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('nav_menus'); + } +}; diff --git a/database/migrations/2021_10_15_100729_create_kategoris_table.php b/database/migrations/2021_10_15_100729_create_kategoris_table.php new file mode 100644 index 000000000..c58751790 --- /dev/null +++ b/database/migrations/2021_10_15_100729_create_kategoris_table.php @@ -0,0 +1,33 @@ +id(); + $table->string('nama'); + $table->string('slug')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('kategoris'); + } +}; diff --git a/database/migrations/2024_10_03_203704_add_field_kategori_id_in_table_artikel.php b/database/migrations/2024_10_03_203704_add_field_kategori_id_in_table_artikel.php new file mode 100644 index 000000000..dea9ccb82 --- /dev/null +++ b/database/migrations/2024_10_03_203704_add_field_kategori_id_in_table_artikel.php @@ -0,0 +1,33 @@ +foreignIdFor(Kategori::class)->nullable()->after('judul')->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('das_artikel', function (Blueprint $table) { + // + }); + } +}; diff --git a/database/migrations/2024_10_04_101813_add_field_type_in_table_nav_menus.php b/database/migrations/2024_10_04_101813_add_field_type_in_table_nav_menus.php new file mode 100644 index 000000000..fe1d35e28 --- /dev/null +++ b/database/migrations/2024_10_04_101813_add_field_type_in_table_nav_menus.php @@ -0,0 +1,32 @@ +enum('type', ['link', 'halaman', 'kategori', 'modul'])->default('modul')->after('target'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('nav_menus', function (Blueprint $table) { + // + }); + } +}; diff --git a/database/migrations/2024_10_22_120555_add_menu_dinamis.php b/database/migrations/2024_10_22_120555_add_menu_dinamis.php new file mode 100644 index 000000000..97a70fc47 --- /dev/null +++ b/database/migrations/2024_10_22_120555_add_menu_dinamis.php @@ -0,0 +1,270 @@ + 1, + 'name' => 'Beranda', + 'url' => '/', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 1, + 'is_show' => 1 + ], + [ + 'id' => 2, + 'name' => 'Publikasi', + 'url' => '#', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 2, + 'is_show' => 1 + ], + [ + 'id' => 3, + 'name' => 'Galeri', + 'url' => '/publikasi/galeri', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 2, + 'order' => 1, + 'is_show' => 1 + ], + [ + 'id' => 4, + 'name' => 'Berita Desa', + 'url' => '/berita-desa', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 3, + 'is_show' => 1 + ], + [ + 'id' => 5, + 'name' => 'Profil', + 'url' => '#', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 4, + 'is_show' => 1 + ], + [ + 'id' => 6, + 'name' => 'Sejarah', + 'url' => '/profil/sejarah', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 5, + 'order' => 1, + 'is_show' => 1 + ], + [ + 'id' => 7, + 'name' => 'Letak Geografis', + 'url' => '/profil/letak-geografis', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 5, + 'order' => 2, + 'is_show' => 1 + ], + [ + 'id' => 8, + 'name' => 'Struktur Pemerintahan', + 'url' => '/profil/struktur-pemerintahan', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 5, + 'order' => 3, + 'is_show' => 1 + ], + [ + 'id' => 9, + 'name' => 'Visi & Misi', + 'url' => '/profil/visi-misi', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 5, + 'order' => 4, + 'is_show' => 1 + ], + [ + 'id' => 10, + 'name' => 'Kategori Berita', + 'url' => '#', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 5, + 'is_show' => 1 + ], + [ + 'id' => 11, + 'name' => 'Desa', + 'url' => '#', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 6, + 'is_show' => 1 + ], + [ + 'id' => 12, + 'name' => 'Potensi', + 'url' => '#', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 7, + 'is_show' => 1 + ], + [ + 'id' => 13, + 'name' => 'Statistik', + 'url' => '#', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 8, + 'is_show' => 1 + ], + [ + 'id' => 14, + 'name' => 'Penduduk', + 'url' => '/statistik/kependudukan', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 13, + 'order' => 1, + 'is_show' => 1 + ], + [ + 'id' => 15, + 'name' => 'Pendidikan', + 'url' => '/statistik/pendidikan', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 13, + 'order' => 2, + 'is_show' => 1 + ], + [ + 'id' => 16, + 'name' => 'Kesehatan', + 'url' => '/statistik/kesehatan', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 13, + 'order' => 3, + 'is_show' => 1 + ], + [ + 'id' => 17, + 'name' => 'Program dan Bantuan', + 'url' => '/statistik/program-dan-bantuan', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 13, + 'order' => 4, + 'is_show' => 1 + ], + [ + 'id' => 18, + 'name' => 'Anggaran dan Realisasi', + 'url' => '/statistik/anggaran-dan-realisasi', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 13, + 'order' => 5, + 'is_show' => 1 + ], + [ + 'id' => 19, + 'name' => 'Anggaran Desa', + 'url' => '/statistik/anggaran-desa', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 13, + 'order' => 6, + 'is_show' => 1 + ], + [ + 'id' => 20, + 'name' => 'Unduhan', + 'url' => '/statistik/anggaran-desa', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => NULL, + 'order' => 9, + 'is_show' => 1 + ], + [ + 'id' => 21, + 'name' => 'Prosedur', + 'url' => '/unduhan/prosedur', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 20, + 'order' => 1, + 'is_show' => 1 + ], + [ + 'id' => 22, + 'name' => 'Regulasi', + 'url' => '/unduhan/regulasi', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 20, + 'order' => 2, + 'is_show' => 1 + ], + [ + 'id' => 23, + 'name' => 'Dokumen', + 'url' => '/unduhan/form-dokumen', + 'target' => '_self', + 'type' => 'modul', + 'parent_id' => 20, + 'order' => 3, + 'is_show' => 1 + ], + [ + 'id' => 24, + 'name' => 'FAQ', + 'url' => 'https://demodk.opendesa.id/faq', + 'target' => '_blank', + 'type' => 'link', + 'parent_id' => NULL, + 'order' => 10, + 'is_show' => 1 + ], + ]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 1277e402c..e5dc0e3dd 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -47,6 +47,7 @@ public function run() DB::statement('SET FOREIGN_KEY_CHECKS=0;'); $this->call(RoleSpatieSeeder::class); + $this->call(RefKategori::class); $this->call(RefPekerjaanTableSeeder::class); $this->call(RefAgamaTableSeeder::class); $this->call(RefKawinTableSeeder::class); diff --git a/database/seeders/RefKategori.php b/database/seeders/RefKategori.php new file mode 100644 index 000000000..f0ea320a6 --- /dev/null +++ b/database/seeders/RefKategori.php @@ -0,0 +1,66 @@ + 'Kebijakan Publik', 'slug' => Str::slug('Kebijakan Publik')], + ['nama' => 'Hukum dan Regulasi', 'slug' => Str::slug('Hukum dan Regulasi')], + ['nama' => 'Pemerintahan Daerah', 'slug' => Str::slug('Pemerintahan Daerah')], + ['nama' => 'Politik dan Demokrasi', 'slug' => Str::slug('Politik dan Demokrasi')], + ['nama' => 'Pelayanan Publik', 'slug' => Str::slug('Pelayanan Publik')], + ['nama' => 'Keuangan dan Anggaran', 'slug' => Str::slug('Keuangan dan Anggaran')], + ['nama' => 'Reformasi Birokrasi', 'slug' => Str::slug('Reformasi Birokrasi')], + ['nama' => 'Pembangunan dan Infrastruktur', 'slug' => Str::slug('Pembangunan dan Infrastruktur')], + ['nama' => 'Keamanan dan Pertahanan', 'slug' => Str::slug('Keamanan dan Pertahanan')], + ['nama' => 'Lingkungan dan Energi', 'slug' => Str::slug('Lingkungan dan Energi')], + ['nama' => 'Hubungan Internasional', 'slug' => Str::slug('Hubungan Internasional')], + ['nama' => 'Pendidikan dan Kebudayaan', 'slug' => Str::slug('Pendidikan dan Kebudayaan')], + ['nama' => 'Kesejahteraan Sosial', 'slug' => Str::slug('Kesejahteraan Sosial')], + ['nama' => 'Tenaga Kerja dan Ketenagakerjaan', 'slug' => Str::slug('Tenaga Kerja dan Ketenagakerjaan')], + ['nama' => 'Kesehatan Masyarakat', 'slug' => Str::slug('Kesehatan Masyarakat')], + ]); + } +} diff --git a/public/bower_components/menu-editor/bootstrap-iconpicker.min.js b/public/bower_components/menu-editor/bootstrap-iconpicker.min.js new file mode 100644 index 000000000..8a3107e9f --- /dev/null +++ b/public/bower_components/menu-editor/bootstrap-iconpicker.min.js @@ -0,0 +1,11 @@ +/*!======================================================================== +* File: bootstrap-iconpicker.min.js v1.10.0 by @victor-valencia +* https://victor-valencia.github.com/bootstrap-iconpicker +* ======================================================================== +* Copyright 2013-2018 Victor Valencia Rico. +* Licensed under MIT license. +* https://github.com/victor-valencia/bootstrap-iconpicker/blob/master/LICENSE +* ======================================================================== +*/ + +!function($){"use strict";var Iconpicker=function(element,options){if("undefined"==typeof $.fn.popover||"undefined"==typeof $.fn.popover.Constructor.VERSION)throw new TypeError("Bootstrap iconpicker require Bootstrap popover");this.$element=$(element),this.options=$.extend({},Iconpicker.DEFAULTS,this.$element.data()),this.options=$.extend({},this.options,options)};Iconpicker.VERSION="1.10.0",Iconpicker.ICONSET_EMPTY={iconClass:"",iconClassFix:"",icons:[]},Iconpicker.ICONSET={_custom:null,elusiveicon:$.iconset_elusiveicon||Iconpicker.ICONSET_EMPTY,flagicon:$.iconset_flagicon||Iconpicker.ICONSET_EMPTY,fontawesome4:$.iconset_fontawesome_4||Iconpicker.ICONSET_EMPTY,fontawesome5:$.iconset_fontawesome_5||Iconpicker.ICONSET_EMPTY,glyphicon:$.iconset_glyphicon||Iconpicker.ICONSET_EMPTY,ionicon:$.iconset_ionicon||Iconpicker.ICONSET_EMPTY,mapicon:$.iconset_mapicon||Iconpicker.ICONSET_EMPTY,materialdesign:$.iconset_materialdesign||Iconpicker.ICONSET_EMPTY,octicon:$.iconset_octicon||Iconpicker.ICONSET_EMPTY,typicon:$.iconset_typicon||Iconpicker.ICONSET_EMPTY,weathericon:$.iconset_weathericon||Iconpicker.ICONSET_EMPTY},Iconpicker.DEFAULTS={align:"center",arrowClass:"btn-primary",arrowNextIconClass:"fas fa-arrow-right",arrowPrevIconClass:"fas fa-arrow-left",cols:4,icon:"",iconset:"fontawesome5",iconsetVersion:"lastest",header:!0,labelHeader:"{0} / {1}",footer:!0,labelFooter:"{0} - {1} of {2}",placement:"bottom",rows:4,search:!0,searchText:"Search icon",selectedClass:"btn-warning",unselectedClass:"btn-secondary"},Iconpicker.prototype.bindEvents=function(){var op=this.options,el=this;op.table.find(".btn-previous, .btn-next").off("click").on("click",function(e){if(e.preventDefault(),!$(this).hasClass("disabled")){var inc=parseInt($(this).val(),10);el.changeList(op.page+inc)}}),op.table.find(".btn-icon").off("click").on("click",function(e){e.preventDefault(),el.select($(this).val()),op.inline===!1?el.$element.popover("3.x"===$.fn.bsVersion()?"destroy":"dispose"):op.table.find("i[class$='"+$(this).val()+"']").parent().addClass(op.selectedClass)}),op.table.find(".search-control").off("keyup").on("keyup",function(){el.changeList(1)})},Iconpicker.prototype.changeList=function(page){this.filterIcons(),this.updateLabels(page),this.updateIcons(page),this.options.page=page,this.bindEvents()},Iconpicker.prototype.filterIcons=function(){var op=this.options,search=op.table.find(".search-control").val(),icons=[];if("lastest"!=op.iconsetVersion&&"undefined"!=typeof Iconpicker.ICONSET[op.iconset].allVersions?$.each(Iconpicker.ICONSET[op.iconset].allVersions,function(i,v){op.iconsetVersion==v.version&&(icons=v.icons)}):icons=Iconpicker.ICONSET[op.iconset].icons,""===search)op.icons=icons;else{var result=[];$.each(icons,function(i,v){v.toLowerCase().indexOf(search)>-1&&result.push(v)}),op.icons=result}},Iconpicker.prototype.removeAddClass=function(target,remove,add){return this.options.table.find(target).removeClass(remove).addClass(add),add},Iconpicker.prototype.reset=function(){this.updatePicker(),this.changeList(1)},Iconpicker.prototype.select=function(icon){var op=this.options,el=this.$element;op.selected=$.inArray(icon.replace(op.iconClassFix,""),op.icons),-1===op.selected&&(op.selected=0,icon=op.iconClassFix+op.icons[op.selected]),""!==icon&&op.selected>=0&&(op.icon=icon,op.inline===!1&&(el.find("input").val(icon),el.find("i").attr("class","").addClass(op.iconClass).addClass(icon)),icon===op.iconClassFix?el.trigger({type:"change",icon:"empty"}):(el.trigger({type:"change",icon:icon}),el.find("input").val(icon)),op.table.find("button."+op.selectedClass).removeClass(op.selectedClass))},Iconpicker.prototype.switchPage=function(icon){var op=this.options;if(op.selected=$.inArray(icon.replace(op.iconClassFix,""),op.icons),op.selected>=0){var page=Math.ceil((op.selected+1)/this.totalIconsPerPage());this.changeList(page)}""===icon?op.table.find("i."+op.iconClassFix).parent().addClass(op.selectedClass):op.table.find("i."+icon).parent().addClass(op.selectedClass)},Iconpicker.prototype.totalPages=function(){return Math.ceil(this.totalIcons()/this.totalIconsPerPage())},Iconpicker.prototype.totalIcons=function(){return this.options.icons.length},Iconpicker.prototype.totalIconsPerPage=function(){return 0===this.options.rows?this.options.icons.length:this.options.cols*this.options.rows},Iconpicker.prototype.updateArrows=function(page){var op=this.options,total_pages=this.totalPages();1===page?op.table.find(".btn-previous").addClass("disabled"):op.table.find(".btn-previous").removeClass("disabled"),page===total_pages||0===total_pages?op.table.find(".btn-next").addClass("disabled"):op.table.find(".btn-next").removeClass("disabled")},Iconpicker.prototype.updateIcons=function(page){var op=this.options,tbody=op.table.find("tbody").empty(),offset=(page-1)*this.totalIconsPerPage(),length=op.rows;0===op.rows&&(length=op.icons.length);for(var i=0;length>i;i++){for(var tr=$(""),j=0;j').hide();if(pos').show(),op.icon===v&&btn.addClass(op.selectedClass).addClass("btn-icon-selected")}tr.append($("").append(btn))}tbody.append(tr)}},Iconpicker.prototype.updateIconsCount=function(){var op=this.options;if(op.footer===!0){var icons_count=["",' ',' '," ",""];op.table.find("tfoot").empty().append(icons_count.join(""))}},Iconpicker.prototype.updateLabels=function(page){var op=this.options,total_icons=this.totalIcons(),total_pages=this.totalPages();op.table.find(".page-count").html(op.labelHeader.replace("{0}",0===total_pages?0:page).replace("{1}",total_pages));var offset=(page-1)*this.totalIconsPerPage(),total=page*this.totalIconsPerPage();op.table.find(".icons-count").html(op.labelFooter.replace("{0}",total_icons?offset+1:0).replace("{1}",total_icons>total?total:total_icons).replace("{2}",total_icons)),this.updateArrows(page)},Iconpicker.prototype.updatePagesCount=function(){var op=this.options;if(op.header===!0){for(var tr=$(""),i=0;i');if(0===i||i===op.cols-1){var arrow=['"];td.append(arrow.join("")),tr.append(td)}else 0===tr.find(".page-count").length&&(td.attr("colspan",op.cols-2).append(''),tr.append(td))}op.table.find("thead").empty().append(tr)}},Iconpicker.prototype.updatePicker=function(){var op=this.options;if(op.cols<4)throw"Iconpicker => The number of columns must be greater than or equal to 4. [option.cols = "+op.cols+"]";if(op.rows<0)throw"Iconpicker => The number of rows must be greater than or equal to 0. [option.rows = "+op.rows+"]";this.updatePagesCount(),this.updateSearch(),this.updateIconsCount()},Iconpicker.prototype.updateSearch=function(){var op=this.options,search=["",' ',' '," ",""];search=$(search.join("")),op.search===!0?search.show():search.hide(),op.table.find("thead").append(search)},Iconpicker.prototype.setAlign=function(value){this.$element.removeClass(this.options.align).addClass(value),this.options.align=value},Iconpicker.prototype.setArrowClass=function(value){this.options.arrowClass=this.removeAddClass(".btn-arrow",this.options.arrowClass,value)},Iconpicker.prototype.setArrowNextIconClass=function(value){this.options.arrowNextIconClass=this.removeAddClass(".btn-next > span",this.options.arrowNextIconClass,value)},Iconpicker.prototype.setArrowPrevIconClass=function(value){this.options.arrowPrevIconClass=this.removeAddClass(".btn-previous > span",this.options.arrowPrevIconClass,value)},Iconpicker.prototype.setCols=function(value){this.options.cols=value,this.reset()},Iconpicker.prototype.setFooter=function(value){var footer=this.options.table.find("tfoot");value===!0?footer.show():footer.hide(),this.options.footer=value},Iconpicker.prototype.setHeader=function(value){var header=this.options.table.find("thead");value===!0?header.show():header.hide(),this.options.header=value},Iconpicker.prototype.setIcon=function(value){this.select(value)},Iconpicker.prototype.setIconset=function(value){var op=this.options;$.isPlainObject(value)?(Iconpicker.ICONSET._custom=$.extend(Iconpicker.ICONSET_EMPTY,value),op.iconset="_custom"):Iconpicker.ICONSET.hasOwnProperty(value)?op.iconset=value:op.iconset=Iconpicker.DEFAULTS.iconset,op=$.extend(op,Iconpicker.ICONSET[op.iconset]),this.reset(),this.select(op.icon)},Iconpicker.prototype.setLabelHeader=function(value){this.options.labelHeader=value,this.updateLabels(this.options.page)},Iconpicker.prototype.setLabelFooter=function(value){this.options.labelFooter=value,this.updateLabels(this.options.page)},Iconpicker.prototype.setPlacement=function(value){this.options.placement=value},Iconpicker.prototype.setRows=function(value){this.options.rows=value,this.reset()},Iconpicker.prototype.setSearch=function(value){var search=this.options.table.find(".search-control");value===!0?search.show():search.hide(),search.val(""),this.changeList(1),this.options.search=value},Iconpicker.prototype.setSearchText=function(value){this.options.table.find(".search-control").attr("placeholder",value),this.options.searchText=value},Iconpicker.prototype.setSelectedClass=function(value){this.options.selectedClass=this.removeAddClass(".btn-icon-selected",this.options.selectedClass,value)},Iconpicker.prototype.setUnselectedClass=function(value){this.options.unselectedClass=this.removeAddClass(".btn-icon",this.options.unselectedClass,value)};var old=$.fn.iconpicker;$.fn.iconpicker=function(option,params){return this.each(function(){var $this=$(this),data=$this.data("bs.iconpicker"),options="object"==typeof option&&option;if(data||$this.data("bs.iconpicker",data=new Iconpicker(this,options)),"string"==typeof option){if("undefined"==typeof data[option])throw'Iconpicker => The "'+option+'" method does not exists.';data[option](params)}else{var op=data.options;op=$.extend(op,{inline:!1,page:1,selected:-1,table:$('
')});var name="undefined"!=typeof $this.attr("name")?'name="'+$this.attr("name")+'"':"";"BUTTON"===$this.prop("tagName")?($this.empty().append("").append('").append('').addClass("iconpicker "+("3.x"===$.fn.bsVersion()?"":"dropdown-toggle")),data.setIconset(op.iconset),$this.on("click",function(e){e.preventDefault(),$this.popover({animation:!1,trigger:"manual",html:!0,content:op.table,container:"body",placement:op.placement}).on("inserted.bs.popover",function(){var el=$this.data("bs.popover"),tip="3.x"===$.fn.bsVersion()?el.tip():$(el.getTipElement());tip.addClass("iconpicker-popover")}).on("shown.bs.popover",function(){data.switchPage(op.icon),data.bindEvents()}),$this.popover("show")})):(op.inline=!0,data.setIconset(op.iconset),$this.empty().append('").append(op.table).addClass("iconpicker").addClass(op.align),data.switchPage(op.icon),data.bindEvents())}})},$.fn.iconpicker.Constructor=Iconpicker,$.fn.iconpicker.noConflict=function(){return $.fn.iconpicker=old,this},$.fn.bsVersion=function(){return $.fn.popover.Constructor.VERSION.substr(0,2)+"x"},$(document).on("click","body",function(e){$(".iconpicker").each(function(){$(this).is(e.target)||0!==$(this).has(e.target).length||0!==$(".popover").has(e.target).length||$(this).popover("3.x"===$.fn.bsVersion()?"destroy":"dispose")})}),$('button[role="iconpicker"],div[role="iconpicker"]').iconpicker()}(jQuery); \ No newline at end of file diff --git a/public/bower_components/menu-editor/jquery-menu-editor-copy.jsxx b/public/bower_components/menu-editor/jquery-menu-editor-copy.jsxx new file mode 100644 index 000000000..1764bf11a --- /dev/null +++ b/public/bower_components/menu-editor/jquery-menu-editor-copy.jsxx @@ -0,0 +1,571 @@ +function MenuEditor(e, s) { + var t = $("#" + e).data("level", "0"), + l = { + labelEdit: '', + labelRemove: '', + textConfirmDelete: "Item ini akan dihapus, apakah anda yakin ?", + iconPicker: { + cols: 4, + rows: 4, + footer: !1, + iconset: "fontawesome5" + }, + maxLevel: -1, + listOptions: { + hintCss: { + border: "1px dashed #13981D" + }, + opener: { + as: "html", + close: '', + open: '', + openerCss: { + "margin-right": "10px", + float: "none" + }, + openerClass: "btn btn-success btn-xs" + }, + placeholderCss: { + "background-color": "gray" + }, + ignoreClass: "clickable", + listsClass: "pl-0", + listsCss: { + "padding-top": "10px" + }, + complete: function (e) { + return MenuEditor.updateButtons(t), t.updateLevels(0), !0 + }, + isAllowed: function (e, s, t) { + return v(e, t) + } + } + }; + $.extend(!0, l, s); + var n = null, + o = !0, + i = null, + r = null, + a = l.iconPicker, + c = (s = l.listOptions, $("#" + e + "_icon").iconpicker(a)); + + function d() { + i[0].reset(), (c = c.iconpicker(a)).iconpicker("setIcon", "empty"), r.attr("disabled", !0), n = null + } + + function p(e) { + return $("").addClass(e.classCss).addClass("clickable").attr("href", "#").html(e.text) + } + + function u() { + var e = $("
").addClass("btn-group pull-right"), + s = p({ + classCss: "btn btn-primary btn-xs btnEdit", // 'btn-sm' diubah menjadi 'btn-xs' untuk Bootstrap 3 + text: l.labelEdit + }), + t = p({ + classCss: "btn btn-danger btn-xs btnRemove", + text: l.labelRemove + }), + n = p({ + classCss: "btn btn-default btn-xs btnUp btnMove", + text: '' + }), + o = p({ + classCss: "btn btn-default btn-xs btnDown btnMove", + text: '' + }), + i = p({ + classCss: "btn btn-default btn-xs btnOut btnMove", + text: '' + }), + r = p({ + classCss: "btn btn-default btn-xs btnIn btnMove", + text: '' + }); + return e.append(n).append(o).append(r).append(i).append(s).append(t), e; +} + + + function f(e, s) { + var l = void 0 === s ? 0 : s, + n = 0 === l ? t : $("