From fcece68142f04562614d26686f43cd0385425f1a Mon Sep 17 00:00:00 2001 From: Yogi Perdana Date: Sun, 18 Aug 2024 12:24:17 +0700 Subject: [PATCH 1/6] Perbaikan error tidak bisa mengirim keluhan di sikema --- .../Controllers/SistemKomplain/SistemKomplainController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/SistemKomplain/SistemKomplainController.php b/app/Http/Controllers/SistemKomplain/SistemKomplainController.php index f05c251f0..e0a827cec 100644 --- a/app/Http/Controllers/SistemKomplain/SistemKomplainController.php +++ b/app/Http/Controllers/SistemKomplain/SistemKomplainController.php @@ -31,15 +31,15 @@ namespace App\Http\Controllers\SistemKomplain; -use App\Http\Controllers\Controller; -use App\Models\JawabKomplain; use App\Models\Komplain; use App\Models\Penduduk; use Illuminate\Http\Request; +use App\Models\JawabKomplain; use Illuminate\Http\Response; use Illuminate\Support\Facades\Validator; +use App\Http\Controllers\FrontEndController; -class SistemKomplainController extends Controller +class SistemKomplainController extends FrontEndController { public function index() { From 46e99f79db7132ad80698b34adbe428cdefc947f Mon Sep 17 00:00:00 2001 From: Yogi Perdana Date: Sun, 18 Aug 2024 17:07:14 +0700 Subject: [PATCH 2/6] Pengaturan identitas pelapor perkeluhan --- app/Enums/Anonim.php | 43 ++++++++++++++++++ .../Data/AdminKomplainController.php | 31 ++++++++++++- app/Models/Komplain.php | 2 +- ...24_08_18_155051_update_komplain_anonim.php | 41 +++++++++++++++++ resources/views/forms/aksi.blade.php | 6 +++ resources/views/forms/anonim-modal.blade.php | 44 +++++++++++++++++++ .../admin_komplain/index.blade.php | 7 +++ .../sistem_komplain/komplain/index.blade.php | 2 +- .../sistem_komplain/komplain/show.blade.php | 2 +- routes/web.php | 1 + 10 files changed, 175 insertions(+), 4 deletions(-) create mode 100644 app/Enums/Anonim.php create mode 100644 database/migrations/2024_08_18_155051_update_komplain_anonim.php create mode 100644 resources/views/forms/anonim-modal.blade.php diff --git a/app/Enums/Anonim.php b/app/Enums/Anonim.php new file mode 100644 index 000000000..91affe1c7 --- /dev/null +++ b/app/Enums/Anonim.php @@ -0,0 +1,43 @@ +addColumn('aksi', function ($row) { + $data['anonim'] = route('admin-komplain.anonim', $row->id); $data['agree_url'] = route('admin-komplain.setuju', $row->id); $data['show_url'] = route('admin-komplain.show', $row->id); $data['delete_url'] = route('admin-komplain.destroy', $row->id); @@ -90,7 +91,18 @@ public function getDataKomplain() return $status; }) - ->rawColumns(['aksi', 'status'])->make(); + ->editColumn('anonim', function ($row) { + $anonim = ''; + if ($row->anonim == 0) { + $anonim = 'Ditampilkan'; + } + if ($row->anonim == 1) { + $anonim = 'Disembunyikan'; + } + + return $anonim; + }) + ->rawColumns(['aksi', 'status', 'anonim'])->make(); } public function disetujui(Request $request, $id) @@ -110,6 +122,23 @@ public function disetujui(Request $request, $id) return redirect()->route('admin-komplain.index')->with('success', 'Status Keluhan berhasil disimpan!'); } + public function anonim(Request $request, $id) + { + request()->validate([ + 'anonim' => 'required', + ]); + + try { + Komplain::findOrFail($id)->update($request->all()); + } catch (\Exception $e) { + report($e); + + return back()->withInput()->with('error', 'Identitas Pelapor Keluhan gagal diperbarui!'); + } + + return redirect()->route('admin-komplain.index')->with('success', 'Identitas Pelapor Keluhan berhasil diperbarui!'); + } + public function show($id) { $komplain = Komplain::findOrFail($id); diff --git a/app/Models/Komplain.php b/app/Models/Komplain.php index a91e79794..96f7e0d9e 100644 --- a/app/Models/Komplain.php +++ b/app/Models/Komplain.php @@ -44,12 +44,12 @@ class Komplain extends Model 'judul', 'slug', 'laporan', - 'anonim', 'status', 'lampiran1', 'lampiran2', 'lampiran3', 'lampiran4', + 'anonim', ]; protected $with = ['penduduk']; diff --git a/database/migrations/2024_08_18_155051_update_komplain_anonim.php b/database/migrations/2024_08_18_155051_update_komplain_anonim.php new file mode 100644 index 000000000..2e25edeb8 --- /dev/null +++ b/database/migrations/2024_08_18_155051_update_komplain_anonim.php @@ -0,0 +1,41 @@ +dropColumn('anonim'); + }); + + Schema::table('das_komplain', function (Blueprint $table) { + $table->tinyInteger('anonim')->default(Anonim::Sembunyikan); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('das_komplain', function (Blueprint $table) { + $table->dropColumn('anonim'); + }); + + Schema::table('das_komplain', function (Blueprint $table) { + $table->tinyInteger('anonim')->nullable()->default(NULL); + }); + } +}; diff --git a/resources/views/forms/aksi.blade.php b/resources/views/forms/aksi.blade.php index c0e568713..f1974aad5 100644 --- a/resources/views/forms/aksi.blade.php +++ b/resources/views/forms/aksi.blade.php @@ -66,6 +66,12 @@ @endif + @if (isset($anonim)) + + + + @endif @if (isset($show_web)) diff --git a/resources/views/forms/anonim-modal.blade.php b/resources/views/forms/anonim-modal.blade.php new file mode 100644 index 000000000..17c52a8b8 --- /dev/null +++ b/resources/views/forms/anonim-modal.blade.php @@ -0,0 +1,44 @@ + + diff --git a/resources/views/sistem_komplain/admin_komplain/index.blade.php b/resources/views/sistem_komplain/admin_komplain/index.blade.php index 23c5dbe79..a79a38662 100644 --- a/resources/views/sistem_komplain/admin_komplain/index.blade.php +++ b/resources/views/sistem_komplain/admin_komplain/index.blade.php @@ -27,6 +27,7 @@ Pelapor Kategori Status + Identitas Pelapor @@ -69,6 +70,11 @@ class: 'text-center', name: 'status', class: 'status' }, + { + data: 'anonim', + name: 'anonim', + class: 'anonim' + }, ], order: [ [1, 'asc'] @@ -79,4 +85,5 @@ class: 'status' @include('forms.datatable-vertical') @include('forms.delete-modal') @include('forms.agree-modal') + @include('forms.anonim-modal') @endpush diff --git a/resources/views/sistem_komplain/komplain/index.blade.php b/resources/views/sistem_komplain/komplain/index.blade.php index 252c07cf6..ed04b8241 100644 --- a/resources/views/sistem_komplain/komplain/index.blade.php +++ b/resources/views/sistem_komplain/komplain/index.blade.php @@ -18,7 +18,7 @@ {{ $item->judul }} {{ $item->kategori_komplain->nama }} - {{ $item->nama }} melaporkan - {{ diff_for_humans($item->created_at) }} + {{ (auth()->guest() && $item->anonim) ? 'Anonim' : $item->nama }} melaporkan - {{ diff_for_humans($item->created_at) }}

{!! get_words($item->laporan, 35) !!} ... diff --git a/resources/views/sistem_komplain/komplain/show.blade.php b/resources/views/sistem_komplain/komplain/show.blade.php index a5a125aa2..ea044f389 100644 --- a/resources/views/sistem_komplain/komplain/show.blade.php +++ b/resources/views/sistem_komplain/komplain/show.blade.php @@ -73,7 +73,7 @@ TRACKING ID #{{ $komplain->komplain_id }} - PELAPOR : {{ $komplain->nama }} + PELAPOR : {{ (auth()->guest() && $komplain->anonim) ? 'ANONIM' : $komplain->nama }}
diff --git a/routes/web.php b/routes/web.php index 7fa1cdf9c..0dac7a0c5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -552,6 +552,7 @@ Route::put('update/{id}', ['as' => 'admin-komplain.update', 'uses' => 'AdminKomplainController@update']); Route::delete('destroy/{id}', ['as' => 'admin-komplain.destroy', 'uses' => 'AdminKomplainController@destroy']); Route::put('setuju/{id}', ['as' => 'admin-komplain.setuju', 'uses' => 'AdminKomplainController@disetujui']); + Route::put('anonim/{id}', ['as' => 'admin-komplain.anonim', 'uses' => 'AdminKomplainController@anonim']); Route::get('statistik', ['as' => 'admin-komplain.statistik', 'uses' => 'AdminKomplainController@statistik']); Route::get('show/{id}', ['as' => 'admin-komplain.show', 'uses' => 'AdminKomplainController@show']); Route::delete('deletekomentar/{id}', ['as' => 'admin-komplain.deletekomentar', 'uses' => 'AdminKomplainController@deletekomentar']); From 2443e531120decf5272b9afbd285996ce57f25a9 Mon Sep 17 00:00:00 2001 From: Yogi Perdana Date: Sun, 18 Aug 2024 17:10:14 +0700 Subject: [PATCH 3/6] Sesuaikan --- app/Http/Controllers/Data/AdminKomplainController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Data/AdminKomplainController.php b/app/Http/Controllers/Data/AdminKomplainController.php index 087ae2c26..feeb9a4c2 100644 --- a/app/Http/Controllers/Data/AdminKomplainController.php +++ b/app/Http/Controllers/Data/AdminKomplainController.php @@ -31,6 +31,7 @@ namespace App\Http\Controllers\Data; +use App\Enums\Anonim; use App\Http\Controllers\Controller; use App\Models\DataDesa; use App\Models\JawabKomplain; @@ -93,10 +94,10 @@ public function getDataKomplain() }) ->editColumn('anonim', function ($row) { $anonim = ''; - if ($row->anonim == 0) { + if ($row->anonim == Anonim::Tampilkan) { $anonim = 'Ditampilkan'; } - if ($row->anonim == 1) { + if ($row->anonim == Anonim::Sembunyikan) { $anonim = 'Disembunyikan'; } From 22704ea158db06a776951932f00318b4283af5bc Mon Sep 17 00:00:00 2001 From: yogiperdana Date: Sun, 18 Aug 2024 10:10:57 +0000 Subject: [PATCH 4/6] Blade Prettier Code --- resources/views/forms/anonim-modal.blade.php | 6 +++--- resources/views/sistem_komplain/komplain/index.blade.php | 2 +- resources/views/sistem_komplain/komplain/show.blade.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/views/forms/anonim-modal.blade.php b/resources/views/forms/anonim-modal.blade.php index 17c52a8b8..437a84662 100644 --- a/resources/views/forms/anonim-modal.blade.php +++ b/resources/views/forms/anonim-modal.blade.php @@ -33,12 +33,12 @@ $('#anonim-modal').on('show.bs.modal', function(e) { // Ambil teks dari kolom 'anonim' var anonimValue = _trSelected.find('td.anonim').text().trim(); - + // Konversi teks ke nilai yang sesuai var selectValue = (anonimValue === 'Disembunyikan') ? '1' : '0'; - + // Set nilai select - $(this).find('select').val(selectValue); + $(this).find('select').val(selectValue); }); }); diff --git a/resources/views/sistem_komplain/komplain/index.blade.php b/resources/views/sistem_komplain/komplain/index.blade.php index ed04b8241..778a19fc7 100644 --- a/resources/views/sistem_komplain/komplain/index.blade.php +++ b/resources/views/sistem_komplain/komplain/index.blade.php @@ -18,7 +18,7 @@ {{ $item->judul }} {{ $item->kategori_komplain->nama }} - {{ (auth()->guest() && $item->anonim) ? 'Anonim' : $item->nama }} melaporkan - {{ diff_for_humans($item->created_at) }} + {{ auth()->guest() && $item->anonim ? 'Anonim' : $item->nama }} melaporkan - {{ diff_for_humans($item->created_at) }}

{!! get_words($item->laporan, 35) !!} ... diff --git a/resources/views/sistem_komplain/komplain/show.blade.php b/resources/views/sistem_komplain/komplain/show.blade.php index ea044f389..75b771fa0 100644 --- a/resources/views/sistem_komplain/komplain/show.blade.php +++ b/resources/views/sistem_komplain/komplain/show.blade.php @@ -73,7 +73,7 @@ TRACKING ID #{{ $komplain->komplain_id }} - PELAPOR : {{ (auth()->guest() && $komplain->anonim) ? 'ANONIM' : $komplain->nama }} + PELAPOR : {{ auth()->guest() && $komplain->anonim ? 'ANONIM' : $komplain->nama }}
From 057bebb1e878c56fca4a066a9b9217f59e5cda73 Mon Sep 17 00:00:00 2001 From: vickyrolanda Date: Mon, 26 Aug 2024 23:51:18 +0000 Subject: [PATCH 5/6] Blade Prettier Code --- .../views/setting/navigation/form.blade.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/resources/views/setting/navigation/form.blade.php b/resources/views/setting/navigation/form.blade.php index df02f99ea..d6192e241 100644 --- a/resources/views/setting/navigation/form.blade.php +++ b/resources/views/setting/navigation/form.blade.php @@ -11,29 +11,29 @@