diff --git a/app/Http/Controllers/SampahController.php b/app/Http/Controllers/SampahController.php
index 307941d..5fcad32 100644
--- a/app/Http/Controllers/SampahController.php
+++ b/app/Http/Controllers/SampahController.php
@@ -63,6 +63,10 @@ class SampahController extends Controller
foreach ($data->get() as $key => $row) {
+ $action = '';
+ $action .= 'Edit';
+
+
$sekolah = '';
$sekolah .= @$row->sekolah->nama_sekolah.'
';
$sekolah .= ''.@$row->sekolah->profile->tingkat->name.' ';
@@ -72,6 +76,7 @@ class SampahController extends Controller
$_data[] = [
'no' => $key+1,
+ 'action' => $action,
'id' => encode_id($row->SampahTekelolaId),
'tahun' => $row->tahun,
'sekolah' => $sekolah,
@@ -96,20 +101,30 @@ class SampahController extends Controller
public function store(Request $request)
{
try {
- $data = SampahTerkelola::updateOrCreate([
- 'tahun' => date('Y'),
- 'bulan' => $request->bulan,
- 'ms_sekolah_id' => session('sekolah_id'),
- ],[
- 'tahun' => date('Y'),
- 'ms_sekolah_id' => session('sekolah_id'),
- 'bulan' => $request->bulan,
- 'mitra' => $request->mitra,
- 'organik' => $request->organik,
- 'sampah_anorganik' => $request->anorganik,
- 'b3' => $request->b3,
- 'minyak_jelantah' => $request->minyak_jelantah,
- ]);
+ if(@$request->secure_id){
+ $data = SampahTerkelola::find(decode_id($request->secure_id));
+ $data->mitra = $request->mitra;
+ $data->organik = $request->organik;
+ $data->sampah_anorganik = $request->anorganik;
+ $data->b3 = $request->b3;
+ $data->minyak_jelantah = $request->minyak_jelantah;
+ $data->save();
+ }else{
+ $data = SampahTerkelola::updateOrCreate([
+ 'tahun' => date('Y'),
+ 'bulan' => $request->bulan,
+ 'ms_sekolah_id' => session('sekolah_id'),
+ ],[
+ 'tahun' => date('Y'),
+ 'ms_sekolah_id' => session('sekolah_id'),
+ 'bulan' => $request->bulan,
+ 'mitra' => $request->mitra,
+ 'organik' => $request->organik,
+ 'sampah_anorganik' => $request->anorganik,
+ 'b3' => $request->b3,
+ 'minyak_jelantah' => $request->minyak_jelantah,
+ ]);
+ }
return redirect()->back()->with([
'message' => 'Berhasil update data',
@@ -146,7 +161,10 @@ class SampahController extends Controller
*/
public function update(Request $request, string $id)
{
- //
+ $data['title'] = $this->title;
+ $data['route'] = $this->route;
+ $data['item'] = SampahTerkelola::find(decode_id($id));
+ return view($this->template.'.form', $data);
}
/**
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
index 7d998be..dbe3ba6 100644
--- a/resources/views/auth/login.blade.php
+++ b/resources/views/auth/login.blade.php
@@ -13,7 +13,7 @@
PROGRAM ADIWIYATA {{ date('Y')-1 }}/{{ date('Y') }}
Akses portal digital resmi penilaian Adiwiyata. Bergabunglah dengan 481+ sekolah yang berkomitmen menjaga kelestarian lingkungan hidup dan edukasi iklim. diff --git a/resources/views/modules/sampah/form.blade.php b/resources/views/modules/sampah/form.blade.php index 3344111..58580f9 100644 --- a/resources/views/modules/sampah/form.blade.php +++ b/resources/views/modules/sampah/form.blade.php @@ -6,7 +6,145 @@ @section('content')
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est natus recusandae maiores distinctio modi illum placeat eveniet molestiae. Ab excepturi suscipit quisquam quas consectetur adipisci cumque quam reprehenderit quibusdam distinctio.
+