@extends('layouts.app')

@section('content')
    <!--begin::App Content Header-->
    <div class="app-content-header"> <!--begin::Container-->
        <div class="container-fluid">
            <!--begin::Row-->
            <div class="row">
                <div class="col-sm-6">
                    <h3 class="mb-0">Create Form Daily 4.7</h3>
                    <button type="button" class="btn btn-info btn-sm" data-bs-toggle="modal" data-bs-target="#infoModal">
                        <i class="fas fa-info-circle"></i>
                    </button>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-end">
                        <li class="breadcrumb-item"><a href="{{ route('admin.dashboard') }}">Home</a></li>
                        <li class="breadcrumb-item"><a href="{{ route('form47.daily.index') }}">Index Form4.7</a></li>
                        <li class="breadcrumb-item active">Create Form Daily 4.7</li>
                    </ol>
                </div>
            </div>
            <!--end::Row-->
        </div> <!--end::Container-->
    </div>
    <!--end::App Content Header-->

    <!-- Modal -->
<div class="modal fade" id="infoModal" tabindex="-1" aria-labelledby="infoModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="infoModalLabel">Panduan Mengisi Rekod myGAP 4-7</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <ul>
                    <li><strong>a. Tarikh:</strong> Tarikh rawatan pasca tuai dijalankan.</li>
                    <li><strong>b. Jenis Tanaman:</strong> Jenis tanaman yang dituai atau dirawat.</li>
                    <li><strong>c. Blok (ha)/ Lokasi:</strong> Blok dimana hasil dituai/ lokasi rawatan dijalankan.</li>
                    <li><strong>d. Justifikasi Rawatan:</strong> Tujuan rawatan dijalankan.</li>
                    <li><strong>e. Jenis Rawatan:</strong> Jenis rawatan pasca tuai yang dijalankan.</li>
                    <li><strong>f. Bahan Aktif dan Kadar:</strong> Jenis bahan aktif dan kadar yang digunakan untuk menjalankan rawatan.</li>
                    <li><strong>g. Tempoh Rawatan:</strong> Tempoh masa rawatan diambil.</li>
                    <li><strong>h. Nama Operator:</strong> Nama pekerja yang menjalankan kerja-kerja rawatan.</li>
                </ul>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>
<!-- End Modal -->


    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <form action="{{ route('form47.daily.store') }}" method="POST">
                    @csrf
                    <div class="card-body">
                        <div class="form-group mb-4">
                            <label for="id_farm_section">(a)Farm Section</label>
                            <select class="form-select" name="id_farm_section" id="id_farm_section" class="form-control" required>
                                <option value="">Select Farm Section</option>
                                <!-- Populate options from the database -->
                                @foreach ($sections as $section)
                                    <option value="{{ $section->id }}">{{ $section->name }}</option>
                                @endforeach
                            </select>
                        </div>

                        <div class="form-group mb-4">
                            <label for="jenis_tanaman">(b)Jenis Tanaman</label>
                            <input type="text" name="jenis_tanaman" id="jenis_tanaman" class="form-control" required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="Blok_Lokasi">(c)Blok (ha)/ Lokasi</label>
                            <input type="text" name="Blok_Lokasi" id="Blok_Lokasi" class="form-control" required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="justifikasi_rawatan">(d)Justifikasi Rawatan </label>
                            <input type="text" name="justifikasi_rawatan" id="justifikasi_rawatan" class="form-control"
                                required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="jenis_rawatan">(e)Jenis Rawatan</label>
                            <input type="text" name="jenis_rawatan" id="jenis_rawatan" class="form-control" required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="bahan_aktif_kadar"(f)>Bahan Aktif dan Kadar</label>
                            <input type="text" name="bahan_aktif_kadar" id="bahan_aktif_kadar" class="form-control"
                                required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="tempoh_rawatan">(g)Tempoh Rawatan</label>
                            <input type="text" name="tempoh_rawatan" id="tempoh_rawatan" class="form-control" required>
                        </div>
                        <div class="form-group mb-4">
                            <label for="nama_operator">(h)Nama Operator</label>
                            <input type="text" name="nama_operator" id="nama_operator" class="form-control"
                                value="{{ Auth::user()->username }}" readonly>
                        </div>

                    </div>

                    <div class="card-footer">
                        <button type="submit" class="btn btn-primary">Submit</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
@endsection
