@extends('admin.template')

@section('content')
    <div class="content-wrapper">
        <div class="row">
            <div class="col-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title">Tambah Data TPS</h4>
                        <p class="card-description">Form tambah data TPS</p>

                        @if ($errors->any())
                            <div class="alert alert-danger">
                                <ul>
                                    @foreach ($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                        @endif


                        <form action="{{ route('admin.tps.store') }}" method="POST" enctype="multipart/form-data">
                            @csrf

                            <!-- NAMA TPS -->
                            <div class="form-group">
                                <label>Nama TPS</label>
                                <input type="text" name="nama_tps" class="form-control" placeholder="Nama TPS" required>
                            </div>

                            <div class="form-group">
                                <label>Alamat</label>
                                <input type="text" name="alamat_tps" class="form-control" placeholder="Alamat TPS"
                                    required>
                            </div>

                            <!-- KATEGORI TPS -->
                            <div class="form-group">
                                <label>Kategori TPS</label>
                                <select name="kategori_tps_id" class="form-control" required>
                                    <option value="">Pilih Kategori</option>
                                    @foreach ($kategori as $item)
                                        <option value="{{ $item->id_kategori_tps }}">
                                            {{ $item->nama_kategori }}
                                        </option>
                                    @endforeach
                                </select>
                            </div>

                            <!-- TAHUN -->
                            <div class="form-group">
                                <label>Tahun Pembuatan</label>
                                <input type="number" name="tahun_pembuatan" class="form-control"
                                    placeholder="Tahun Pembuatan" required>
                            </div>

                            <!-- KAPASITAS -->
                            <div class="form-group">
                                <label>Kapasitas</label>
                                <input type="text" name="kapasitas_tps" class="form-control" placeholder="Kapasitas TPS"
                                    required>
                            </div>

                            <!-- STATUS -->
                            <div class="form-group">
                                <label>Status</label>
                                <select name="status_tps" class="form-control" required>
                                    <option value="Aktif">Aktif</option>
                                    <option value="Non-Aktif">Tidak Aktif</option>
                                    <option value="Pembangunan">Pembangunan</option>
                                </select>
                            </div>

                            <div class="form-group">
                                <label>Latitude</label>
                                <input type="text" name="latitude" class="form-control"
                                    placeholder="Contoh: -7.588125 atau 7°35'17.25&quot;S" required>
                            </div>

                            <div class="form-group">
                                <label>Longitude</label>
                                <input type="text" name="longitude" class="form-control"
                                    placeholder="Contoh: 111.916936 atau 111°55'0.97&quot;E" required>
                            </div>

                            <!-- FOTO -->
                            <div class="form-group">
                                <label>Foto TPS</label>

                                <input type="file" name="foto_tps" id="foto_tps" class="file-upload-default">

                                <div class="input-group col-xs-12">
                                    <input type="text" class="form-control file-upload-info" disabled
                                        placeholder="Upload Foto">
                                    <span class="input-group-append">
                                        <button class="file-upload-browse btn btn-primary" type="button">
                                            Upload
                                        </button>
                                    </span>
                                </div>
                            </div>

                            <button type="submit" class="btn btn-primary mr-2">Simpan</button>
                            <a href="{{ route('admin.tps.index') }}" class="btn btn-light">Batal</a>
                        </form>

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