@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>

                                <div class="mb-3">
                                    <label for="" class="form-label">pH Tanah</label>
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="1" id="pH-field"
                                            placeholder="Masukan nilai pH Tanah" aria-label="Masukan nilai pH Tanah"
                                            required>
                                        <span class="input-group-text" id="pH-addon">pH</span>
                                        <div class="invalid-feedback">
                                            Masukan nilai pH
                                        </div>
                                    </div>
                                </div>
                                <div class="mb-3">
                                    <label for="" class="form-label">Ketinggian Tempat</label>
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="2"
                                            id="ketinggian_tempat-field" placeholder="Masukan nilai Ketinggian Tempat"
                                            aria-label="Masukan nilai Ketinggian Tempat" required>
                                        <span class="input-group-text" id="ketinggian_tempat-addon">m</span>
                                        <div class="invalid-feedback">
                                            Masukan nilai Ketinggian Tempat
                                        </div>
                                    </div>
                                </div>
                                <div class="mb-3">
                                    <label for="" class="form-label">Ketersediaan Air</label>
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="3"
                                            id="ketersediaan_air-field" placeholder="Masukan nilai Ketersediaan Air"
                                            aria-label="Masukan nilai Ketersediaan Air" required>
                                        <span class="input-group-text" id="ketersediaan_air-addon">%</span>
                                        <div class="invalid-feedback">
                                            Masukan nilai Ketersediaan Air
                                        </div>
                                    </div>
                                </div>
                                <div class="mb-3">
                                    <label for="" class="form-label">Curah Hujan</label>
                                    <div class="input-group">
                                        <input type="text" class="form-control" name="4" id="curah_hujan-field"
                                            placeholder="Masukan nilai Curah Hujan" aria-label="Masukan nilai Curah Hujan"
                                            required>
                                        <span class="input-group-text" id="curah_hujan-addon">mm</span>
                                        <div class="invalid-feedback">
                                            Masukan nilai Curah Hujan
                                        </div>
                                    </div>
                                </div>
                            </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">
                                {{-- @dd(request()) --}}
                                {{-- <div class="flex-grow-1 ms-3">
                                    <h2 class="mb-0"><span class="counter-value" data-target="197">0</span></h2>
                                </div> --}}
                                @isset(request()->session->result)
                                    <h1 class="mb-0"><span class="counter-value"
                                            data-target="{{ request()->session->result }}">0</span>%
                                    </h1>
                                @endisset
                            </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/assesment-form/index.js"></script>
    @endpush
@endsection
