@extends('server-side.layouts.server-app')
@section('pageTitle', 'Detail Hasil Diagnosa | KlinikSapi.Go')
@section('mainContent')
    <div class="content d-flex flex-column flex-column-fluid" id="kt_content">
        <div class="toolbar" id="kt_toolbar">
            <div id="kt_toolbar_container" class="container-fluid d-flex flex-stack">
                <div data-kt-swapper="true" data-kt-swapper-mode="prepend"
                    data-kt-swapper-parent="{default: '#kt_content_container', 'lg': '#kt_toolbar_container'}"
                    class="page-title d-flex align-items-center flex-wrap me-3 mb-5 mb-lg-0">
                    <h1 class="d-flex align-items-center text-dark fw-bolder fs-3 my-1">Manajemen Laporan
                        <span class="h-20px border-gray-200 border-start ms-3 mx-2"></span>
                        <small class="text-muted fs-7 fw-bold my-1 ms-1">Data Diagnosa / Detail Hasil Diagnosa</small>
                    </h1>
                </div>
            </div>
        </div>
        <div class="post d-flex flex-column-fluid" id="kt_post">
            <div id="kt_content_container" class="container-xxl">
                <div class="card mb-5 mb-xl-8 px-10 px-lg-15 py-15">
                    <div class="mb-2">
                        <h1 class="mb-3">Detail Diagnosa Gejala</h1>
                        <div class="text-primary fw-bold fs-3"><strong>> Kode Diagnosa: {{ $diagnosa->diagnosaId }}</strong></div>
                    </div>
                    <div class="table-responsive">
                        <table id="kt_datatable_example_5" class="table table-row-dashed table-row-gray-300 gs-0 gy-4">
                            <thead>
                            <tr class="fw-bolder text-muted">
                                <th>#No</th>
                                <th>Kode Gejala</th>
                                <th>Nama Gejala</th>
                                <th>Nilai Keyakinan</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach ($detail as $data)
                                <tr>
                                    <td>
                                        <span class="text-muted fw-bold text-muted d-block fs-7">
                                            {{ $numtab++ }}
                                        </span>
                                    </td>
                                    <td>
                                        <span class="text-dark fw-bolder text-hover-primary d-block fs-6 text-capitalize">{{ $data->gejala->gejalaId }}</span>
                                    </td>
                                    <td>
                                        <span class="text-dark fw-bolder text-hover-primary d-block fs-6 text-capitalize">{{ $data->gejala->gejala }}</span>
                                    </td>
                                    <td>
                                        <span class="text-dark fw-bolder text-hover-primary d-block fs-6 text-capitalize">{{ $data->nilaiKeyakinan }}</span>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                    <div class="mt-5 mb-2">
                        <h1 class="mb-3">Hasil Diagnosa Penyakit</h1>
                        <div class="text-primary fw-bold fs-3"><strong>> {{ $diagnosa->penyakitId }} . {{ $diagnosa->penyakit->penyakit }}</strong></div>
                    </div>
                    <p class="fs-5">Berdasarkan perhitungan metode Dempster-Shafer, penyakit yang paling mungkin adalah <strong class="text-primary">{{ $diagnosa->penyakit->penyakit }}</strong> dengan nilai keyakinan sebesar <strong class="text-primary">{{ $diagnosa->probabilitas }}</strong> atau bila dipersentasekan menjadi <strong class="text-primary">{{ $diagnosa->probabilitas == 1.00 ? '100%' : number_format($diagnosa->probabilitas * 100) . '%' }}</strong>. Solusi pencegahan dapat dilakukan <strong class="text-lowercase">{{ \App\Models\Penyakit::find($diagnosa->penyakit->penyakitId)->solusi }}</strong>.</p>
                    <div class="float-start mt-5">
                        <a href="{{ route('diagnosa.index') }}" class="btn btn-light me-3">Kembali</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
