diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php
index 4e9815d..7cc60b1 100644
--- a/app/Helpers/custom.php
+++ b/app/Helpers/custom.php
@@ -4,6 +4,7 @@ use Illuminate\Support\Str;
use App\Models\Master\Menu;
use App\Models\Master\AccessMenu;
use App\Models\User;
+use App\Models\UnitKonversi;
use App\Models\GWP;
if (!function_exists('taskLabel')) {
@@ -402,3 +403,16 @@ if (!function_exists('activityYearRange')) {
}
}
}
+
+if (!function_exists('valueUnitKonversion')) {
+ function valueUnitKonversion($kategori,$from,$to)
+ {
+ $value = UnitKonversi::where('kategori_id',$kategori)
+ ->where('from_id',$from)
+ ->where('to_id',$to)
+ ->first();
+
+ return $value->value;
+ }
+}
+
diff --git a/app/Http/Controllers/FrontController.php b/app/Http/Controllers/FrontController.php
index cd2cde4..b075fde 100644
--- a/app/Http/Controllers/FrontController.php
+++ b/app/Http/Controllers/FrontController.php
@@ -12,7 +12,7 @@ class FrontController extends Controller
{
function index() {
$data['title'] = 'Beranda';
- return redirect('login');
- // return view('index',$data);
+ // return redirect('login');
+ return view('index',$data);
}
}
diff --git a/app/Http/Controllers/Pengaturan/UnitKonversiController.php b/app/Http/Controllers/Pengaturan/UnitKonversiController.php
index 6cfac9f..b9daa51 100644
--- a/app/Http/Controllers/Pengaturan/UnitKonversiController.php
+++ b/app/Http/Controllers/Pengaturan/UnitKonversiController.php
@@ -4,15 +4,94 @@ namespace App\Http\Controllers\Pengaturan;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
+use DB;
+use App\Models\Unit;
+use App\Models\UnitKonversi;
+use App\Models\Kategori;
class UnitKonversiController extends Controller
{
+ protected $title = 'Unit Konversi';
+ protected $template = 'modules.pengaturan.unit-conversion';
+ protected $route = 'modules.pengaturan.unit-conversion';
+
/**
* Display a listing of the resource.
*/
public function index()
{
- //
+ permission('is_read', $this->route, 'module',true);
+
+ $data['breadcrumbs'] = [
+ ['name' => 'Dashboard'],
+ ['name' => 'Pengaturan'],
+ ['name' => 'Unit Konversi','active' => true],
+ ];
+ $data['title'] = $this->title;
+ $data['route'] = $this->route;
+ $data['kategori'] = Kategori::all();
+ $data['unit'] = Unit::where('kategori_id',decode_id(@request()->kategori_id))->get();
+ return view($this->template.'.index',$data);
+ }
+
+ function valueKonversion($kategori,$from,$to) {
+ $value = valueUnitKonversion(decode_id($kategori),decode_id($from),decode_id($to));
+ // return ;
+
+ return response()->json(['value' => $value]);
+ }
+
+ public function grid(Request $request)
+ {
+ if(@$request->kategori_id){
+ $data = Unit::where('kategori_id',decode_id($request->kategori_id))->orderBy('UnitId','ASC')->get();
+ }else{
+ $data = [];
+ }
+ $_data = [];
+
+
+ foreach ($data as $key => $row) {
+
+
+ $action = '';
+ $status = '';
+ if($row->status == 0){
+ $status = ' Tidak Aktif ';
+ }else{
+ $status = ' Aktif ';
+ }
+ $unit = Unit::where('kode',$row->kode)->first();
+
+ $input = '
';
+
+ $action .= '';
+ if((permission('is_create', $this->route.'.*','module',false)) || (permission('is_update', $this->route.'.*','module',false))){
+ $action .= '
';
+ // $action .= '
';
+ if(session('group_id') == 1){
+ // $action .= '
';
+ }
+ }
+ $action .= '
';
+
+ $_data[] = [
+ 'no' => $key+1,
+ 'id' => encode_id($row->UnitId),
+ 'kategori' => @$row->kategori->nama,
+ 'nama' => @$row->nama,
+ 'kategoriID' => encode_id(@$row->kategori->KategoriId),
+ 'UnitId' => encode_id($unit->UnitId),
+ 'status' => @$status,
+ 'input' => @$input,
+ 'action' => @$action,
+ ];
+
+ }
+
+ // return response()->json($_data); // Return the data as a JSON response
+ return response()->json($_data);
+
}
/**
@@ -28,7 +107,39 @@ class UnitKonversiController extends Controller
*/
public function store(Request $request)
{
- //
+ $kategoriId = decode_id($request->kategori_id);
+ $toRaw = array_values($request->input('to'));
+ $codes = array_values(array_filter($toRaw, fn($v) => !is_numeric($v)));
+ $codeToId = !empty($codes) ? Unit::whereIn('kode', $codes)->pluck('UnitId','kode')->toArray() : [];
+ $toIds = array_map(fn($v) => is_numeric($v) ? (int)$v : ($codeToId[$v] ?? null), $toRaw);
+
+ DB::transaction(function() use ($request, $kategoriId, $toIds) {
+ foreach ($request->all() as $key => $vals) {
+ if (!str_starts_with($key, 'val_')) continue;
+
+ $fromId = (int) substr($key, 4);
+ if (!$fromId || !is_array($vals)) continue;
+
+ foreach ($toIds as $col => $toId) {
+ if (!$toId) continue;
+
+ $raw = $vals[$col] ?? null;
+ // skip empty if you want: if ($raw === null || $raw === '') continue;
+ $value = ($raw === null || $raw === '') ? 0 : (float)$raw;
+
+ UnitKonversi::updateOrCreate(
+ ['kategori_id' => $kategoriId, 'from_id' => $fromId, 'to_id' => $toId],
+ ['value' => $value, 'updated_at' => now()]
+ );
+ }
+ }
+ });
+
+ return redirect()->back()->with([
+ 'message' => 'Berhasil update data',
+ 'type' => 'success',
+ ]);
+
}
/**
@@ -50,9 +161,29 @@ class UnitKonversiController extends Controller
/**
* Update the specified resource in storage.
*/
- public function update(Request $request, string $id)
+ public function update($id = null)
{
- //
+ $data['breadcrumbs'] = [
+ ['name' => 'Dashboard'],
+ ['name' => 'Pengaturan'],
+ ['name' => 'Unit Konversi','active' => true],
+ ];
+ $keyId = decode_id($id);
+ $data['title'] = $this->title;
+ $data['route'] = $this->route;
+ $data['keyId'] = $id;
+ $data['item'] = UnitKonversi::where('UnitKonversiId',$keyId)->first();
+ $data['kategori'] = Kategori::all();
+ return view($this->template.'.form',$data);
+ }
+
+ public function delete($id)
+ {
+ $keyId = decode_id($id);
+
+ $data = UnitKonversi::where('UnitKonversiId',$keyId)->delete();
+
+ return response()->json(['success' => true,'message' => 'Berhasil update data','type' => 'success']);
}
/**
diff --git a/app/Models/UnitKonversi.php b/app/Models/UnitKonversi.php
new file mode 100644
index 0000000..21972b7
--- /dev/null
+++ b/app/Models/UnitKonversi.php
@@ -0,0 +1,15 @@
+id('UnitKonversiId');
+ $table->integer('kategori_id');
+ $table->integer('from_id');
+ $table->integer('to_id');
+ $table->float('value');
+ $table->timestampsTz();
+ $table->softdeletesTz();
+
+ $table->foreign('kategori_id')->references('KategoriId')->on('p_kategori')->cascadeOnDelete();
+ $table->foreign('from_id')->references('UnitId')->on('p_unit')->cascadeOnDelete();
+ $table->foreign('to_id')->references('UnitId')->on('p_unit')->cascadeOnDelete();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('p_unit_konversi');
+ }
+};
diff --git a/public/assets/images/Line 1.png b/public/assets/images/Line 1.png
new file mode 100755
index 0000000..f64c6bb
Binary files /dev/null and b/public/assets/images/Line 1.png differ
diff --git a/public/assets/images/Line 2.png b/public/assets/images/Line 2.png
new file mode 100755
index 0000000..60c5b26
Binary files /dev/null and b/public/assets/images/Line 2.png differ
diff --git a/public/assets/images/Line 3.png b/public/assets/images/Line 3.png
new file mode 100755
index 0000000..60c5b26
Binary files /dev/null and b/public/assets/images/Line 3.png differ
diff --git a/public/assets/images/bg-front.png b/public/assets/images/bg-front.png
new file mode 100644
index 0000000..d577aef
Binary files /dev/null and b/public/assets/images/bg-front.png differ
diff --git a/public/assets/images/bg1.png b/public/assets/images/bg1.png
new file mode 100644
index 0000000..c5f4bf0
Binary files /dev/null and b/public/assets/images/bg1.png differ
diff --git a/public/assets/images/bg2.png b/public/assets/images/bg2.png
new file mode 100644
index 0000000..0d5cb07
Binary files /dev/null and b/public/assets/images/bg2.png differ
diff --git a/public/assets/images/bg3.png b/public/assets/images/bg3.png
new file mode 100644
index 0000000..6c03ee0
Binary files /dev/null and b/public/assets/images/bg3.png differ
diff --git a/public/assets/images/bg4.png b/public/assets/images/bg4.png
new file mode 100644
index 0000000..7b2985f
Binary files /dev/null and b/public/assets/images/bg4.png differ
diff --git a/public/assets/images/dashboard.png b/public/assets/images/dashboard.png
new file mode 100644
index 0000000..d016f59
Binary files /dev/null and b/public/assets/images/dashboard.png differ
diff --git a/public/assets/images/logo.png b/public/assets/images/logo.png
new file mode 100644
index 0000000..c5e9187
Binary files /dev/null and b/public/assets/images/logo.png differ
diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php
index fc1b1d4..46882a9 100644
--- a/resources/views/index.blade.php
+++ b/resources/views/index.blade.php
@@ -1,4 +1,59 @@
-@extends('layouts.blank')
+@extends('layouts.front')
@section('content')
-Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ducimus molestiae iusto libero ut dolores deleniti, pariatur laborum provident magnam fugiat dignissimos corporis totam eos neque ex omnis itaque! Laboriosam, necessitatibus!
+
+
+
+
Sistem Informasi
+
Gas Rumah Kaca Daerah
+
Platform terintegrasi untuk memantau, melaporkan, dan mengevaluasi status emisi GRK serta kemajuan Rencana Aksi Mitigasi di wilayah Jakarta. Akses data inventarisasi terbaru dan peran serta publik.
+
+
+
+
+
+
Informasi Gas Rumah Kaca Daerah
+
Perhitungan emisi GRK mengikuti standar IPCC terbaru dan divalidasi oleh lembaga lingkungan terkait, serta didukung kerja sama dengan Kementerian LHK untuk memastikan akuntabilitas data.
+
+
+
+
Energi
+
We're a UK-based Laravel agency. We'll get your project moving so you can focus on what matters most. You'll have peac.
+
+
+
Industrial Processes and Product Use
+
As the largest on-shore Laravel development company in the United States, Active Logic is headquartered in.
+
+
+
Pertanian & Lahan
+
We’re the Laravel agency you couldn’t afford locally. But we’re based in Georgia, the country. So, you can.
+
+
+
Limbah
+
We're the experts in all things Laravel. If you need an app built or rescued, or you need your team built or leveled up, we'v
+
+
+
+
+
+
+
+
+
Semua yang Anda Butuhkan, Lengkap dan Terverifikasi.
+
+
+
+
+
+
+
@endsection
\ No newline at end of file
diff --git a/resources/views/layouts/front.blade.php b/resources/views/layouts/front.blade.php
new file mode 100644
index 0000000..7226dbb
--- /dev/null
+++ b/resources/views/layouts/front.blade.php
@@ -0,0 +1,82 @@
+
+
+
+
+ @yield('title',@$title) | SIGD
+
+
+
+
+
+
+
+
+
+ {{-- --}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @yield('css')
+
+
+
+
+
+
+
+
+ @yield('content')
+ {{-- --}}
+
+
+
+
+
+
+
+
+
+
+
+ @yield('js')
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/modules/pengaturan/ar/index.blade.php b/resources/views/modules/pengaturan/ar/index.blade.php
index 8d6780c..416a20a 100644
--- a/resources/views/modules/pengaturan/ar/index.blade.php
+++ b/resources/views/modules/pengaturan/ar/index.blade.php
@@ -28,7 +28,7 @@
data-page-size="10"
data-id-field="id"
id="grid-data">
-
+
#
Kode
diff --git a/resources/views/modules/pengaturan/ghg/index.blade.php b/resources/views/modules/pengaturan/ghg/index.blade.php
index 8d6780c..416a20a 100644
--- a/resources/views/modules/pengaturan/ghg/index.blade.php
+++ b/resources/views/modules/pengaturan/ghg/index.blade.php
@@ -28,7 +28,7 @@
data-page-size="10"
data-id-field="id"
id="grid-data">
-
+
#
Kode
diff --git a/resources/views/modules/pengaturan/gwp/form.blade.php b/resources/views/modules/pengaturan/gwp/form.blade.php
index 689599c..fe4fc26 100644
--- a/resources/views/modules/pengaturan/gwp/form.blade.php
+++ b/resources/views/modules/pengaturan/gwp/form.blade.php
@@ -24,7 +24,7 @@
data-page-size="10"
data-id-field="id"
id="grid-data">
-
+
Greenhouse gas
IPCC Assessment Report
@@ -43,7 +43,6 @@