@extends('layouts.app')

@section('title')
  Dashboard
@endsection

@section('admin-content')
    <script src="https://cdn.jsdelivr.net/npm/autonumeric@4.6.0/dist/autoNumeric.min.js"></script>
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>Tambahkan Expense Up Country Baru</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
                        </li>
                    </ol>
                </div>
            </div>
        </div>
    </section>
    <section class="content">
        <div class="container-fluid">
            <div class="card card-primary card-outline">
                <div class="card-body">
					<form method="POST" action="{{ route('forms.up-country.store') }}" enctype="multipart/form-data">
                        @csrf
                        @include('backend.layouts.partials.messages')
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="mb-3">
                                    <label class="form-label">Pilih Rayon</label>
                                    <select class="form-control form-control-md" name="rayon_id" required>
                                        <option value="">Pilih Rayon</option>
                                        @foreach ($rayons as $rayon)
                                            <option value="{{ $rayon->id }}">{{ $rayon->name }}</option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Tanggal</label>
                                    <input type="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Tujuan</label>
                                    <input type="text" class="form-control" name="tujuan" required value="{{ old('tujuan') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Jarak</label>
                                    <input type="number" class="form-control" name="jarak" required value="{{ old('jarak') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Allowance</label>
                                    <input type="string" class="form-control" name="allowance" id="allowance" required value="{{ old('allowance') }}">
                                </div>
                                 <div class="mb-3">
                                    <label class="form-label">Transport Dalam Kota</label>
                                    <input type="string" class="form-control" name="transport_dalkot" id="transport_dalkot" required value="{{ old('transport_dalkot') }}">
                                </div>
                            </div>

                            <div class="col-lg-6">
                                <div class="mb-3">
                                    <label class="form-label">Transport Antar Kota</label>
                                    <input type="string" class="form-control" name="transport_ankot" id="transport_ankot" required value="{{ old('transport_ankot') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Hotel</label>
                                    <input type="string" class="form-control" name="hotel" id="hotel" required value="{{ old('hotel') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Bukti 1</label>
                                    <input type="file" class="form-control" name="bukti1" value="{{ old('bukti1') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Bukti 2</label>
                                    <input type="file" class="form-control" name="bukti2" value="{{ old('bukti2') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Bukti 3</label>
                                    <input type="file" class="form-control" name="bukti3" value="{{ old('bukti3') }}">
                                </div>
                            </div>

                            <button type="submit" class="btn btn-primary ml-2">Submit</button>
                        </div>
					</form>
                </div>
            </div>
        </div>
    </section>

    <script>
        new AutoNumeric('#allowance', {
            digitGroupSeparator: '.', // Pemisah ribuan
            decimalCharacter: ',',    // Karakter desimal (tidak digunakan karena tanpa desimal)
            currencySymbol: 'Rp.',    // Simbol mata uang
            decimalPlaces: 0,         // Tidak ada angka desimal
            unformatOnSubmit: true    // Nilai asli tanpa format saat dikirimkan
        });

        new AutoNumeric('#transport_dalkot', {
            digitGroupSeparator: '.', // Pemisah ribuan
            decimalCharacter: ',',    // Karakter desimal (tidak digunakan karena tanpa desimal)
            currencySymbol: 'Rp.',    // Simbol mata uang
            decimalPlaces: 0,         // Tidak ada angka desimal
            unformatOnSubmit: true    // Nilai asli tanpa format saat dikirimkan
        });

        new AutoNumeric('#transport_ankot', {
            digitGroupSeparator: '.', // Pemisah ribuan
            decimalCharacter: ',',    // Karakter desimal (tidak digunakan karena tanpa desimal)
            currencySymbol: 'Rp.',    // Simbol mata uang
            decimalPlaces: 0,         // Tidak ada angka desimal
            unformatOnSubmit: true    // Nilai asli tanpa format saat dikirimkan
        });

        new AutoNumeric('#hotel', {
            digitGroupSeparator: '.', // Pemisah ribuan
            decimalCharacter: ',',    // Karakter desimal (tidak digunakan karena tanpa desimal)
            currencySymbol: 'Rp.',    // Simbol mata uang
            decimalPlaces: 0,         // Tidak ada angka desimal
            unformatOnSubmit: true    // Nilai asli tanpa format saat dikirimkan
        });
    </script>
@endsection
