@extends('server-side.layouts.server-app')
@section('pageTitle', 'Detail Basis Pengetahuan | 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 Data
                        <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">Basis Pengetahuan / Data Pengetahuan / Detail Basis Pengetahuan</small>
                    </h1>
                </div>
            </div>
        </div>
        <div class="post d-flex flex-column-fluid" id="kt_post">
            <div id="kt_content_container" class="container-xxl">
                @if (Session::has('message'))
                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                        <i class="bi bi-check-circle me-1"></i> {{ Session::get('message') }}.
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                    </div>
                @endif
                <div class="card mb-5 mb-xl-8 px-10 px-lg-15 py-15">
                    <div class="mb-2">
                        <h1 class="mb-3">Detail Basis Pengetahuan</h1>
                        <div class="text-primary fw-bold fs-3"><strong>> {{ $detail[0]->penyakitId }} . {{ $detail[0]->penyakit->penyakit }}</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 class="min-w-100px">Kode Gejala</th>
                                <th class="min-w-250px">Nama Gejala</th>
                                <th class="min-w-50px">Nilai Pakar</th>
                                <th class="min-w-100px text-end">Pengaturan</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->nilaiPakar }}</span>
                                    </td>
                                    <td>
                                        <div class="d-flex justify-content-end flex-shrink-0">
                                            <form action="{{ route('rule.destroy', $data->id) }}" method="post" class="d-inline">
                                                @csrf
                                                @method('DELETE')
                                                <input type="hidden" value="{{ $detail[0]->penyakitId }}" name="penyakitId">
                                                <button type="submit"
                                                        class="btn btn-icon btn-bg-light btn-active-color-primary btn-sm"
                                                        data-bs-toggle="tooltip" data-bs-placement="top"
                                                        data-bs-trigger="hover" title="Hapus Gejala Terkait"
                                                        onclick="return confirm('Konfirmasi penghapusan data gejala terkait!')">
                                                        <span class="svg-icon svg-icon-3">
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="24"
                                                                    height="24" viewBox="0 0 24 24" fill="none">
                                                                <path
                                                                    d="M5 9C5 8.44772 5.44772 8 6 8H18C18.5523 8 19 8.44772 19 9V18C19 19.6569 17.6569 21 16 21H8C6.34315 21 5 19.6569 5 18V9Z"
                                                                    fill="black"/>
                                                                <path opacity="0.5"
                                                                        d="M5 5C5 4.44772 5.44772 4 6 4H18C18.5523 4 19 4.44772 19 5V5C19 5.55228 18.5523 6 18 6H6C5.44772 6 5 5.55228 5 5V5Z"
                                                                        fill="black"/>
                                                                <path opacity="0.5"
                                                                        d="M9 4C9 3.44772 9.44772 3 10 3H14C14.5523 3 15 3.44772 15 4V4H9V4Z"
                                                                        fill="black"/>
                                                            </svg>
                                                        </span>
                                                </button>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                    <div class="float-start">
                        <a href="{{ route('rule.index') }}" class="btn btn-light me-3">Kembali</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
