@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.6</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>
                    <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('form46.daily.index') }}">Index Form4.6</a></li>
                        <li class="breadcrumb-item active">Create Form Daily 4.6</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-6</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 penuaian atau 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 di mana hasil dituai/ lokasi rawatan dijalankan.</li>
                    <li><strong>d. Jumlah Hasil (kg @ unit):</strong>
                        <ul>
                            <li>i. Tuai</li>
                            <li>ii. Jual</li>
                        </ul>
                    </li>
                    <li><strong>e. Harga Jualan (kg @ Unit):</strong> Harga yang dipersetujui antara pembekal dan pembeli.</li>
                    <li><strong>f. Jumlah Harga (RM):</strong> Jumlah keseluruhan hasil yang dijual dalam KG/ Unit.</li>
                    <li><strong>g. No. Invois:</strong> Nombor yang terdapat pada resit jualan.</li>
                    <li><strong>h. Nama Pembeli:</strong> Orang yang membeli hasil sama ada individu atau syarikat.</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('form46.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="jumlah_hasil_tuai">(d)Jumlah Hasil (kg@unit) (i)Tuai </label>
                            <input type="text" name="jumlah_hasil_tuai" id="jumlah_hasil_tuai" class="form-control"
                                required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="jumlah_hasil_jual">(e)Jumlah Hasil (kg@unit) (ii)Jual</label>
                            <input type="text" name="jumlah_hasil_jual" id="jumlah_hasil_jual" class="form-control"
                                required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="harga_jualan">(f)Harga Jualan/kg @ unit (RM)</label>
                            <input type="text" name="harga_jualan" id="harga_jualan" class="form-control" required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="jumlah_harga">(g)Jumlah Harga (RM)</label>
                            <input type="text" name="jumlah_harga" id="jumlah_harga" class="form-control" required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="no_invois">(h)No. Invois </label>
                            <input type="text" name="no_invois" id="no_invois" class="form-control" required>
                        </div>
                        <div class="form-group mb-4">
                            <label for="nama_pembeli">(i)Nama Pembeli</label>
                            <input type="text" name="nama_pembeli" id="nama_pembeli" class="form-control" required>
                        </div>

                        <div class="form-group mb-4">
                            <label for="nama_operator">(j)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
