@extends('layouts.app')
@push('title', 'Form Penilaian')
@section('content')
    <div class="page-content">
        <div class="container-fluid">
            <!-- start page title -->
            <div class="row">
                <div class="col-12">
                    <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                        <h4 class="mb-sm-0">Form Penilaian</h4>

                        <div class="page-title-right">
                            <ol class="breadcrumb m-0">
                                <li class="breadcrumb-item">
                                    <a href="javascript: void(0);">Menu</a>
                                </li>
                                <li class="breadcrumb-item active">Form Penilaian</li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>
            <!-- end page title -->

            <div class="row">
                <div class="col-xl-8 col-md-6">
                    <div class="card">
                        <div class="card-header">
                            <h4 class="card-title mb-0">Form Penilaian</h4>
                        </div>
                        <form action="{{ route('assesment_form.store') }}" class="needs-validation" method="POST"
                            novalidate id="add-form">
                            @csrf
                            <div class="card-body">

                                <div class="mb-3">
                                    <label for="" class="form-label">Lahan</label>
                                    <select name="land" class="form-control" id="lahan-field" required>
                                        <option value="" selected disabled>Pilih Lahan</option>
                                        @foreach ($lands as $land)
                                            <option value="{{ $land->id }}">{{ $land->name }}</option>
                                        @endforeach
                                    </select>
                                    <div class="invalid-feedback">
                                        Pilih Lahan
                                    </div>
                                </div>

                                @foreach ($indicators as $indicator)
                                    <div class="mb-3">
                                        <label for="" class="form-label">{{ $indicator->name }}</label>
                                        <select name="{{ $indicator->id }}" class="form-control"
                                            id="{{ $indicator->id }}-field" required>
                                            <option value="" selected disabled>Pilih Jawaban</option>
                                            <option value="0">Tidak</option>
                                            <option value="0.2">Tidak Tahu</option>
                                            <option value="0.4">Mungkin</option>
                                            <option value="0.6">Kemungkinan Besar</option>
                                            <option value="0.8">Hampir Pasti</option>
                                            <option value="1">Pasti</option>
                                        </select>
                                        <div class="invalid-feedback">
                                            Pilih Jawaban
                                        </div>
                                    </div>
                                @endforeach
                            </div>
                            <div class="card-footer d-flex justify-content-end">
                                <button type="submit" class="btn btn-success">Hitung</button>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="col-xl-4 col-md-6">
                    <div class="card">
                        <div class="card-header">
                            <h4 class="card-title mb-0">Hasil Penilaian</h4>
                        </div>
                        <form action="">
                            <div class="card-body text-center">
                                @if (session('presentase'))
                                    <h1 class="mb-0 mt-2"><span class="counter-value"
                                            data-target="{{ session('presentase') }}">0</span>%
                                    </h1>
                                    <p class="text-muted mb-0 mt-2">Presentase kelayakan tanah berdasarkan perhitungan
                                        Certainty
                                        Factor.</p>
                                @endif
                            </div>
                        </form>
                    </div>
                </div>
            </div>

        </div>
        <!-- container-fluid -->
    </div>

    @push('other-js')
        <!-- prismjs plugin -->
        <script src="assets/libs/prismjs/prism.js"></script>
        <script src="assets/libs/list.js/list.min.js"></script>
        <script src="assets/libs/list.pagination.js/list.pagination.min.js"></script>

        <!-- listjs init -->
        <script src="assets/js/pages/form-validation.init.js"></script>

        <script src="assets/js/pages/customJs/assessment/form.js"></script>
    @endpush
@endsection
