fix(assessment-form): fix session presentase set minus value
This commit is contained in:
parent
b15e0486f2
commit
9f32685fff
|
@ -70,7 +70,8 @@ public function store(Request $request)
|
||||||
];
|
];
|
||||||
})->collapse();
|
})->collapse();
|
||||||
|
|
||||||
$cf_he_array = $cf_he->toArray();
|
// $cf_he_array = $cf_he->toArray();
|
||||||
|
$cf_he_array = collect($cf_he)->sortKeys()->values()->toArray();
|
||||||
|
|
||||||
$cf_combined = array_shift($cf_he_array);
|
$cf_combined = array_shift($cf_he_array);
|
||||||
|
|
||||||
|
@ -96,8 +97,6 @@ public function store(Request $request)
|
||||||
$hasil = 'tidak cocok';
|
$hasil = 'tidak cocok';
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($cf_e, $cf_h, $cf_he, $cf_combined, $hasil);
|
|
||||||
|
|
||||||
$landName = Land::find($request->land)->owner;
|
$landName = Land::find($request->land)->owner;
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
@ -118,6 +117,11 @@ public function store(Request $request)
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
$presentase = round($cf_combined * 100, 2);
|
$presentase = round($cf_combined * 100, 2);
|
||||||
|
|
||||||
|
if ($presentase < 0) {
|
||||||
|
$presentase = "minus";
|
||||||
|
}
|
||||||
|
|
||||||
toast("Data berhasil disimpan.", "success")->position('top-right')->autoclose(3000);
|
toast("Data berhasil disimpan.", "success")->position('top-right')->autoclose(3000);
|
||||||
return redirect()->back()->with(['land' => $landName, 'presentase' => $presentase, 'hasil' => $hasil]);
|
return redirect()->back()->with(['land' => $landName, 'presentase' => $presentase, 'hasil' => $hasil]);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
Certainty
|
Certainty
|
||||||
Factor.</p>
|
Factor.</p>
|
||||||
<h1 class="mb-0 mt-2"><span class="counter-value"
|
<h1 class="mb-0 mt-2"><span class="counter-value"
|
||||||
data-target="{{ session('presentase') }}">0</span>%
|
data-target="{{ session('presentase') != 'minus' ? session('presentase') : '0' }}">0</span>%
|
||||||
</h1>
|
</h1>
|
||||||
@endif
|
@endif
|
||||||
@if (session('hasil') && session('land'))
|
@if (session('hasil') && session('land'))
|
||||||
|
|
Loading…
Reference in New Issue