<x-user.layout title="{{ auth()->user()->lastname.' '.auth()->user()->firstname }} | Apply Loan">

    <div class="nk-block">
        <div class="row g-gs">
            @if(auth()->user()->status != ACTIVE_USER)
                <div class="col-md-12 card card-inner">
                    <div class="alert alert-warning ff-base fw-medium">
                        <em class="icon ni ni-alert-circle"></em>
                        {{ __(config('settings.limited_user_message')) }}
                    </div>
                </div>
            @else
                <div class="col-12">
                    <div class="card h-100">
                        <div class="card-inner card-title-group card-title border-bottom d-flex justify-content-between">
                            <div><h6 class="title">Loan/Mortage</h6></div>
                            <div><a href="{{ route('user.loans') }}" class="btn btn-primary btn-sm" >Loan Applications</a></div>
                        </div>

                        <div class="card-inner">
                            <form method="POST" class="form-validate is-alter" novalidate="novalidate" id="submitForm" action="/user/loan/apply">
                                @csrf
                                <div class="col-8 mx-auto">
                                    <div class="form-group">
                                        <div class="text-info">
                                        <em class="icon ni ni-info"></em>
                                            Ensure you fill the form correctly. This step in important for the processing of your loan application.
                                        </div>
                                    </div>

                                    @if(session()->has('success'))
                                        <div class="alert alert-success alert-icon alert-dismissible">
                                            <em class="icon ni ni-check-circle"></em> <strong>Hurray!</strong>! {{ session()->get('success') }}. <a href="{{ route('user.loans') }}">loan application details</a> <button class="close" data-dismiss="alert"></button>
                                        </div>
                                    @elseif($errors->any())
                                        <div class="alert alert-danger alert-icon alert-dismissible">
                                            <em class="icon ni ni-cross-circle"></em> <strong>Oops!</strong>! {!! $errors->first() !!} <button class="close" data-dismiss="alert"></button>
                                        </div>
                                    @endif
                                    <div class="row g-gs">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label class="form-label" for="receiver"> Receiver (Customer Care Loan Department)</label>
                                                <div class="form-control-wrap">
                                                    <input type="text" class="form-control" name="receiver" value="Customer care" disabled>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label class="form-label" for="amount">Loan Amount</label>
                                                <div class="form-control-wrap">
                                                    <div class="form-text-hint">
                                                        <span class="overline-title">{{ $short }}</span>
                                                    </div>
                                                    <input type="number" step="0.01" class="form-control" name="amount" value="{{ old('amount') }}"  placeholder="Loan request amount" required>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <label class="form-label" for="purpose">Naration/Purpose</label>
                                                <textarea name="purpose" class="form-control" required>{{ old('purpose') }}</textarea>
                                            </div>
                                        </div>
                                        <ul class="align-center flex-wrap flex-sm-nowrap gx-4 gy-2 col-md-12">
                                            <li>
                                                <button class="btn btn-primary buttonClick">
                                                    <span>SUBMIT</span>
                                                    <span class="spinner-border spinner-border-sm hide button-spinner" style="display: none;" role="status" aria-hidden="true"></span>
                                                </button>
                                            </li>
                                        </ul>
                                    </div>

                                </div>

                            </form>
                        </div>
                    </div><!-- .card -->
                </div>
            @endif
        </div>
    </div>

</x-user.layout>

