@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 Entertainment & Presentation</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.entertainment.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">Tanggal</label>
                                    <input type="date" class="form-control" name="tanggal" required value="{{ old('tanggal') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Jenis</label>
                                    <select class="form-control form-control-md" name="jenis" required>
                                        <option value="">Pilih Jenis</option>
                                        <option value="entertainment" {{ old('jenis') == 'entertainment' ? 'selected' : '' }}>Entertainment</option>
                                        <option value="presentation" {{ old('jenis') == 'presentation' ? 'selected' : '' }}>Presentation</option>
                                        <option value="sponsorship" {{ old('jenis') == 'sponsorship' ? 'selected' : '' }}>Sponsorship</option>
                                    </select>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Nama Penerima</label>
                                    <input type="text" class="form-control" name="name" required value="{{ old('name') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Alamat</label>
                                    <input type="text" class="form-control" name="alamat" id="alamat" required value="{{ old('alamat') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Keterangan</label>
                                    <textarea class="form-control" name="keterangan" required>{{ old('keterangan') }}</textarea>
                                </div>
                            </div>

                            <div class="col-lg-6">
                                <div class="mb-3">
                                    <label class="form-label">NPWP / NIK</label>
                                    <input type="text" class="form-control" name="nik_or_npwp" id="nik_or_npwp" required value="{{ old('nik_or_npwp') }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Total</label>
                                    <input type="string" class="form-control" name="total" id="total" required value="{{ old('total') }}">
                                </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('#total', {
            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
