From e886afef4fed5621078eda596156f2e44fab2cca Mon Sep 17 00:00:00 2001 From: Ilham Wara Nugroho Date: Tue, 28 Apr 2026 11:53:05 +0700 Subject: [PATCH] update --- .../LembarPengesahanController.php | 158 ++++++++++++++++ app/Models/LembarPengesahan.php | 14 ++ ...040811_create_lembar_pengesahans_table.php | 37 ++++ .../views/auth/dashboard-adaptation.blade.php | 8 +- .../views/auth/dashboard-mitigation.blade.php | 8 +- .../form/index-adaptasi-edit.blade.php | 37 ++-- .../form/index-mitigasi-edit.blade.php | 149 +++++++++++++--- .../views/modules/pengesahan/form.blade.php | 168 ++++++++++++++++++ .../views/modules/pengesahan/index.blade.php | 93 ++++++++++ routes/modules/modules.php | 11 +- 10 files changed, 621 insertions(+), 62 deletions(-) create mode 100644 app/Http/Controllers/LembarPengesahanController.php create mode 100644 app/Models/LembarPengesahan.php create mode 100644 database/migrations/2026_04_22_040811_create_lembar_pengesahans_table.php create mode 100644 resources/views/modules/pengesahan/form.blade.php create mode 100644 resources/views/modules/pengesahan/index.blade.php diff --git a/app/Http/Controllers/LembarPengesahanController.php b/app/Http/Controllers/LembarPengesahanController.php new file mode 100644 index 0000000..5b6b5f6 --- /dev/null +++ b/app/Http/Controllers/LembarPengesahanController.php @@ -0,0 +1,158 @@ +adaptationService = $adaptationService; + $this->mitigationService = $mitigationService; + } + + /** + * Display a listing of the resource. + */ + public function index() + { + $data['route'] = $this->route; + $data['title'] = $this->title; + + return view($this->template.'.index',$data); + } + + public function grid() + { + $data = LembarPengesahaan::where('tahun',date('Y'))->get(); + $_data = []; + + foreach ($data as $key => $row) { + + $btn = 'Edit'; + $btn .= '
'; + $btn .= csrf_field(); + $btn .= method_field('DELETE'); + $btn .= ''; + $btn .= '
'; + + if ($row->row_status == 1) { + $status = 'Aktif'; + } else { + $status = 'Tidak Aktif'; + } + + $_data[] = [ + 'no' => $key+1, + 'name' => $row->name, + 'scope' => $row->scope, + 'status' => $status, + 'action' => @$btn, + ]; + + } + + return response()->json($_data); + } + + /** + * Show the form for creating a new resource. + */ + public function create() + { + $year = (int) request()->input('adaptationYear', date('Y')); + $adaptasi = $this->adaptationService->getDashboardData($year); + $mitigasi = $this->mitigationService->getDashboardData($year); + + + $data['route'] = $this->route; + $data['title'] = $this->title; + $data['kegiatanAdaptasi'] = $adaptasi['tableData']; + $data['kegiatanMitigasi'] = $mitigasi['tableData']; + + return view($this->template.'.form',$data); + } + + public function update($id = null) + { + $keyId = decode_id($id); + $data['title'] = $this->title; + $data['route'] = $this->route; + $data['keyId'] = $id; + $data['item'] = LembarPengesahaan::where('id',$keyId)->first(); + + return view($this->template.'.form',$data); + } + + /** + * Store a newly created resource in storage. + */ + public function store(Request $request) + { + $request->validate([ + 'agency_id' => 'required', + 'file' => 'required', + 'type' => 'required', + ]); + + try { + if(@$request->secure_id){ + $ag = LembarPengesahaan::find(decode_id(@$request->secure_id)); + $ag->agency_id = $request->agency_id; + $ag->type = $request->type; + $ag->file = $request->file; + $ag->save(); + }else{ + $ag = new LembarPengesahan; + $ag->agency_id = $request->agency_id; + $ag->type = $request->type; + $ag->file = $request->file; + $ag->status = 1; + $ag->save(); + } + + return redirect()->route($this->route.'.index')->with('success', 'Lembar Pengesahan berhasil ditambahkan.'); + } catch (\Exception $e) { + return back()->withErrors(['error' => 'Lembar Pengesahan gagal disimpan. Silakan coba lagi. Error: ' . $e->getMessage()]); + } + } + + /** + * Display the specified resource. + */ + public function show(string $id) + { + // + } + + /** + * Show the form for editing the specified resource. + */ + public function edit(string $id) + { + $data['ar'] = LembarPengesahaan::find($id); + $data['route'] = $this->route; + $data['title'] = $this->title; + return view($this->template.'.form', $data); + } + + /** + * Update the specified resource in storage. + */ + + /** + * Remove the specified resource from storage. + */ + public function destroy(string $id) + { + // + } +} diff --git a/app/Models/LembarPengesahan.php b/app/Models/LembarPengesahan.php new file mode 100644 index 0000000..2ab593c --- /dev/null +++ b/app/Models/LembarPengesahan.php @@ -0,0 +1,14 @@ +id('LembarPengesahanId'); + $table->integer('user_id'); + $table->string('agency_id'); + $table->year('tahun'); + $table->string('type'); //Adaptasi, Mitigasi, Inventory + $table->json('sektor')->nullable(); + $table->json('form_id')->nullable(); + $table->string('file')->nullable(); + $table->text('keterangan')->nullable(); + $table->integer('status')->default(0); + $table->timestampsTz(); + $table->softdeletesTz(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('lembar_pengesahans'); + } +}; diff --git a/resources/views/auth/dashboard-adaptation.blade.php b/resources/views/auth/dashboard-adaptation.blade.php index c39e318..8b7f15f 100644 --- a/resources/views/auth/dashboard-adaptation.blade.php +++ b/resources/views/auth/dashboard-adaptation.blade.php @@ -72,11 +72,11 @@ {{ $a->sektor }} {{ $a->sub_sektor }} - - + + - - + + diff --git a/resources/views/auth/dashboard-mitigation.blade.php b/resources/views/auth/dashboard-mitigation.blade.php index 4ce1f49..70957c8 100644 --- a/resources/views/auth/dashboard-mitigation.blade.php +++ b/resources/views/auth/dashboard-mitigation.blade.php @@ -83,11 +83,11 @@ {{ $m->revisi ?? '--' }} - - + + - - + + diff --git a/resources/views/modules/form/index-adaptasi-edit.blade.php b/resources/views/modules/form/index-adaptasi-edit.blade.php index a500c21..b5659bf 100644 --- a/resources/views/modules/form/index-adaptasi-edit.blade.php +++ b/resources/views/modules/form/index-adaptasi-edit.blade.php @@ -14,7 +14,7 @@

-
+ @csrf
@@ -95,7 +95,7 @@
-
@@ -157,7 +157,7 @@
-
@@ -181,7 +181,7 @@
-
@@ -200,6 +200,7 @@ @section('js') -@endsection -rror(xhr); - alert('Terjadi kesalahan saat menyimpan data.'); - } - }); - }); - }); - -@endsection - }); - }); - -@endsection +@endsection \ No newline at end of file diff --git a/resources/views/modules/form/index-mitigasi-edit.blade.php b/resources/views/modules/form/index-mitigasi-edit.blade.php index a1eb31b..eff4b3b 100644 --- a/resources/views/modules/form/index-mitigasi-edit.blade.php +++ b/resources/views/modules/form/index-mitigasi-edit.blade.php @@ -20,7 +20,7 @@

- + @csrf
@@ -110,7 +110,7 @@
-
@@ -394,7 +394,7 @@
-
@@ -484,7 +484,7 @@
-
@@ -523,22 +523,116 @@ @if (!empty($sumberDataList)) @foreach ($sumberDataList as $index => $sumber) - +
+
Sumber Data {{ $index + 1 }}
+
+
+
+
+
Sumber Data
+
+
+
+ + +
+ +
+ + +
+ +
+ + +

+ Tautan URL langsung menuju file (jika dapat diunduh) +

+
+
+
+
+ + + {{-- + /> --}} @endforeach @else - +
+
+
Sumber Data 1
+
+
+
+
+
Sumber Data
+
+
+
+ + +
+ +
+ + +
+ +
+ + +

+ Tautan URL langsung menuju file (jika dapat diunduh) +

+
+
+
+
+ +
+ {{-- --}} @endif