@extends('layouts.master')
@section('title', 'Collect Admission Fee')

@section('page-header')
<header class="header bg-ui-general">
    <div class="header-info">
        <h1 class="header-title">
            <strong>Collect Admission Fee</strong>
        </h1>
        <small>Collect admission fee for {{ $customer->name }}</small>
    </div>
    <div class="header-action">
        <nav class="nav">
            <a class="nav-link" href="{{ route('customer.index') }}">
                <i class="fa fa-arrow-left"></i> Back to Customers
            </a>
        </nav>
    </div>
</header>
@endsection

@section('content')
<div class="col-md-12 offset-md-2">
    <form action="{{ route('customer.admissionFee.store', $customer->id) }}" method="POST" class="card shadow-sm">
        @csrf
        <div class="card-header">
            <h4 class="card-title mb-0">Admission Fee Details</h4>
        </div>
        <div class="card-body">
            <p class="text-muted">Fill out the details below to collect admission fee for
                <strong>{{ $customer->name }}</strong>.</p>

            <div class="row">
                <div class="col-md-6 mb-3">
                    <label>Amount <span class="text-danger">*</span></label>
                    <input type="number" name="admission_fee" step="0.01"
                        class="form-control @error('admission_fee') is-invalid @enderror" placeholder="Enter Amount"
                        value="{{ old('admission_fee') }}" required>
                    @error('admission_fee')
                    <div class="invalid-feedback">{{ $message }}</div>
                    @enderror
                </div>

                <div class="col-md-6 mb-3">
                    <label>Bank Account</label>
                    <select name="bank_account_id" class="form-control" required>
                        @foreach(App\BankAccount::all() as $account)
                        <option value="{{ $account->id }}">{{ $account->name }}</option>
                        @endforeach
                    </select>
                    @error('bank_account_id')
                    <div class="invalid-feedback">{{ $message }}</div>
                    @enderror
                    
                </div>
            </div>

            <div class="row">
                <div class="col-md-6 mb-3">
                    <label>Payment Date <span class="text-danger">*</span></label>
                    <input type="date" name="payment_date"
                        class="form-control @error('payment_date') is-invalid @enderror"
                        value="{{ old('payment_date', date('Y-m-d')) }}" required>
                    @error('payment_date')
                    <div class="invalid-feedback">{{ $message }}</div>
                    @enderror
                </div>
            </div>

        </div>

        <div class="card-footer text-right">
            <button type="submit" class="btn btn-success">
                <i class="fa fa-check-circle"></i> Collect Fee
            </button>
        </div>
    </form>
</div>
@endsection
