@extends('layouts.app')

@section('content')
    <div class="container-fluid p-4">
        <div class="card shadow-sm p-3">
            <h4 class="fw-bold" style="color: #063986;">Tambah Transaksi</h4>
            <form action="{{ route('admin.storetransaksi') }}" method="POST" enctype="multipart/form-data">
                @csrf

                <div class="mb-3">
                    <label for="id_booking" class="form-label">ID Booking</label>
                    <select name="id_booking" id="id_booking" class="form-control" required>
                        <option value="">Pilih Booking</option>
                        @foreach($bookings as $booking)
                            <option value="{{ $booking->id_booking }}">
                                {{ $booking->id_booking }} - {{ $booking->user->name }} ({{ $booking->room->room_number }})
                            </option>
                        @endforeach
                    </select>
                </div>

                <div class="mb-3">
                    <label for="jumlah_pembayaran" class="form-label">Jumlah Pembayaran (Rp)</label>
                    <input type="number" name="jumlah_pembayaran" id="jumlah_pembayaran" class="form-control" 
                           min="0" step="0.01" required>
                </div>

                <div class="mb-3">
                    <label for="metode_pembayaran" class="form-label">Metode Pembayaran</label>
                    <select name="metode_pembayaran" id="metode_pembayaran" class="form-control" required>
                        <option value="">Pilih Metode Pembayaran</option>
                        <option value="Transfer">Transfer</option>
                        <option value="E-Wallet">E-Wallet</option>
                        <option value="Tunai">Tunai</option>
                    </select>
                </div>

                <div class="mb-3">
                    <label for="status_transaksi" class="form-label">Status Transaksi</label>
                    <select name="status_transaksi" id="status_transaksi" class="form-control" required>
                        <option value="Belum Lunas">Belum Lunas</option>
                        <option value="Lunas">Lunas</option>
                        <option value="Refund">Refund</option>
                    </select>
                </div>

                <div class="mb-3">
                    <label for="bukti_pembayaran" class="form-label">Bukti Pembayaran</label>
                    <input type="file" class="form-control" id="bukti_pembayaran" name="bukti_pembayaran">
                </div>

                <div class="mb-3">
                    <label for="tanggal_pembayaran" class="form-label">Tanggal Pembayaran</label>
                    <input type="datetime-local" name="tanggal_pembayaran" id="tanggal_pembayaran" 
                           class="form-control" required>
                </div>

                <div class="d-flex justify-content-between">
                    <a href="{{ route('admin.transaksi') }}" class="btn btn-secondary">Batal</a>
                    <button type="submit" class="btn text-white" 
                            style="background: linear-gradient(135deg, #8AC0DF, #48499B);">
                        Simpan
                    </button>
                </div>
            </form>
        </div>
    </div>
@endsection
