Merge pull request #33 from arieeefajar/fix/assessment-history-officer
fix(assessment-history-officer): set treshold value
This commit is contained in:
commit
b93c5acdef
|
@ -97,12 +97,12 @@ public function store(Request $request)
|
|||
}
|
||||
|
||||
$landName = Land::find($request->land)->owner;
|
||||
// dd($cf_e, $cf_h, $cf_he, $cf_he_array, $cf_combined, $hasil);
|
||||
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$evaluation = new Evaluation;
|
||||
$evaluation->land_id = $request->land;
|
||||
$evaluation->threshold_value = $hasil;
|
||||
$evaluation->cf_value = $cf_combined;
|
||||
$evaluation->user_id = auth()->user()->id;
|
||||
$evaluation->save();
|
||||
|
@ -123,47 +123,5 @@ public function store(Request $request)
|
|||
toast($th->getMessage(), 'error')->position('top-right')->autoclose(3000);
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
// $cfValue = [];
|
||||
// foreach ($cf_e as $id => $value) {
|
||||
// if (isset($rules[$id])) {
|
||||
// $rule = $rules[$id];
|
||||
// $cfValue[$id] = $rule->mb * $value;
|
||||
// } else {
|
||||
// toast("Rule untuk indikator ID {$id} tidak ditemukan.", 'error')->position('top-right')->autoclose(3000);
|
||||
// return redirect()->back();
|
||||
// }
|
||||
// }
|
||||
|
||||
// $cfCombine = array_shift($cfValue);
|
||||
|
||||
// foreach ($cfValue as $cf) {
|
||||
// $cfCombine = $cfCombine + $cf * (1 - $cfCombine);
|
||||
// }
|
||||
|
||||
// DB::beginTransaction();
|
||||
// try {
|
||||
// $evaluation = new Evaluation;
|
||||
// $evaluation->land_id = $request->land;
|
||||
// $evaluation->cf_value = $cfCombine;
|
||||
// $evaluation->user_id = auth()->user()->id;
|
||||
// $evaluation->save();
|
||||
|
||||
// foreach ($indicators as $id => $value) {
|
||||
// $evaluationDetail = new EvaluationDetail();
|
||||
// $evaluationDetail->evaluation_id = $evaluation->id;
|
||||
// $evaluationDetail->indicator_id = $id;
|
||||
// $evaluationDetail->md_value = $value;
|
||||
// $evaluationDetail->save();
|
||||
// }
|
||||
// DB::commit();
|
||||
// $presentase = round($cfCombine * 100, 2);
|
||||
// toast('Data berhasil disimpan', 'success')->position('top-right')->autoclose(3000);
|
||||
// return redirect()->back()->with('presentase', $presentase);
|
||||
// } catch (\Throwable $th) {
|
||||
// DB::rollBack();
|
||||
// toast('Terjadi kesalahan', 'error')->position('top-right')->autoclose(3000);
|
||||
// return redirect()->back();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public function up(): void
|
|||
Schema::create('evaluation', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('land_id');
|
||||
$table->string('threshold_value');
|
||||
$table->double('cf_value', 15, 10);
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->timestamps();
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
<th class="sort" data-sort="customer_name">
|
||||
Lahan
|
||||
</th>
|
||||
<th class="sort" data-sort="threshold">Rekomendasi</th>
|
||||
<th class="sort" data-sort="status">
|
||||
Nilai Presentase
|
||||
</th>
|
||||
|
@ -76,6 +77,8 @@
|
|||
class="fw-medium link-primary">#VZ2101</a>
|
||||
</td>
|
||||
<td class="customer_name">{{ $evaluation->land->owner }}</td>
|
||||
<td class="threshold text-capitalize">{{ $evaluation->threshold_value }}
|
||||
</td>
|
||||
<td class="status">
|
||||
<span>{{ number_format($evaluation->cf_value, 2) * 100 }}%</span>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue