@extends('layouts.main')

@section('title', $title = 'Data Pasien')

@section('content')
<div class="container pt-5">
    <div class="row gy-4 shadow mb-4 bg-body-tertiary rounded">
        <h3 class="mb-4">Data Pasien</h3>
    </div>
    <div class="row gy-4">
        <div class="pt-3 card">
            <div class="row">
                <div class="col-sm-12 pb-3 pt-3">
                    <a href="{{ route ('pasien.create') }}" class="font-sm btn btn-success">Tambah</a>
                </div>
            </div>
            <div class="pb-3 table-responsive text-nowrap">
                <table class="table table-hover table-stripped border-right border-bottom border-left table-bordered" id="dataTable">
                    <thead>
                        <tr>
                            <th style="width: 20px">No</th>
                            <th>Nama</th>
                            <th>Jenis Kelamin</th>
                            <th>Aktivitas</th>
                            <th>Kadar Gula Darah</th>
                            <th>Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($pasiens as $key => $pasien)
                        <tr>
                            <td>{{ $key+1 }}</td>
                            <td>{{ $pasien->nama }}</td>
                            <td>{{ $pasien->jenisKelamin->jenis_kelamin }}</td>
                            <td>{{ $pasien->aktivitas->nama }}</td>
                            <td>{{ $pasien->kadarGula->kadar_gula }}</td>
                            <td>
                                <a href="{{ route ('pasien.show', $pasien->id) }}" class="btn btn-info btn-xs"><i class='bx bx-show'></i>
                                    Detail
                                </a>
                                <a href="{{ route ('pasien.edit', $pasien->id) }}" class="btn btn-warning btn-xs text-white"><i class='bx bx-edit-alt'></i>
                                    Edit
                                </a>
                                <a id="delete" href="{{ route ('pasien.destroy', $pasien->id) }}" class="btn btn-danger btn-xs" onclick="notificationBeforeDelete(event, this)"><i class='bx bx-trash'></i>
                                    Delete
                                </a>
                                <a href="{{ route ('perhitungan.index', $pasien->id) }}" class="btn btn-success btn-xs" ><i class='bx bx-reset'></i>
                                    Proses
                                </a>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>

        </div>
    </div>
</div>
@endsection

