@extends('layouts.main')

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

@section('content')
<div class="container pt-5">
    <div class="row gy-4 shadow mb-4 bg-body-tertiary rounded">
        <h3 class="mb-4">Data Kriteria</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 ('kriteria.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>Kode</th>
                            <th>Nama</th>
                            <th>Tipe Kriteria</th>
                            <th>Bobot</th>
                            <th>Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($kriterias as $key => $kriteria)
                        <tr>
                            <td>{{ $key+1 }}</td>
                            <td>{{ $kriteria->kode }}</td>
                            <td>{{ $kriteria->nama }}</td>
                            <td>{{ $kriteria->tipeKriteria->nama }}</td>
                            <td>{{ str_replace('.', ',', $kriteria->bobot) }}</td>
                            <td>
                                <a href="{{ route ('kriteria.edit', $kriteria->id) }}" class="btn btn-warning btn-xs text-white"><i class='bx bx-edit-alt'></i>
                                    Edit
                                </a>
                                <a id="delete" href="{{ route ('kriteria.destroy', $kriteria->id) }}" class="btn btn-danger btn-xs" onclick="notificationBeforeDelete(event, this)"><i class='bx bx-trash'></i>
                                    Delete
                                </a>
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>

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

