@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>Lihat Expense Vehicle Running Cost</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" 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">No Expense</label>
                                    <input type="text" class="form-control" name="expense_number" value="{{ $form->expense_number }}" readonly>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Tanggal</label>
                                    <input type="datetime-local" class="form-control" name="tanggal" readonly value="{{ $form->tanggal }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Liter Bensin</label>
                                    <input type="text" class="form-control" name="liter" readonly value="{{ $form->liter }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Total Harga Bensin</label>
                                    <input type="string" class="form-control" name="total" id="total" readonly value="{{ $form->total }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Bukti Total Harga Bensin</label><br>
                                    <a href="{{ $form->bukti_total }}" target="_blank">Lihat Bukti</a>
                                </div>
                            </div>

                            <div class="col-lg-6">
                                <div class="mb-3">
                                    <label class="form-label">Jarak (km)</label>
                                    <input type="number" class="form-control" name="jarak" id="jarak" readonly value="{{ $form->jarak }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Tipe Bensin</label>
                                    <select class="form-control" name="tipe_bensin" disabled>
                                        <option value="pertamax" {{ $form->tipe_bensin == 'pertamax' ? 'selected' : '' }}>Pertamax</option>
                                        <option value="pertalite" {{ $form->tipe_bensin == 'pertalite' ? 'selected' : '' }}>Pertalite</option>
                                    </select>
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Nomor Polisi</label>
                                    <input type="text" class="form-control" name="nopol" id="nopol" readonly value="{{ $form->nopol }}">
                                </div>
                                <div class="mb-3">
                                    <label class="form-label">Keterangan</label>
                                    <textarea class="form-control" name="keterangan" id="keterangan" readonly>{{ $form->keterangan }}</textarea>
                                </div>
                            </div>

                            <div class="col-lg-12">
                                <a href="{{ route('forms.vehicle') }}" class="btn btn-secondary">Kembali</a>
                            </div>
                        </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
