<x-user.layout title=" Make local transfer from your account">

    <div class="nk-block">
        <div class="row g-gs">
            <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">Local Transfer</h6></div>
                        <div><a href="{{ route('user.transfer.international') }}" class="btn btn-primary btn-sm" ><em class="icon ni ni-tranx-fill"></em>&nbsp;Int' Transfer</a></div>
                    </div>


                    <div class="card-inner">
                        @if(auth()->user()->status != ACTIVE_USER)

                            <div class="alert alert-warning ff-base fw-medium">
                                <em class="icon ni ni-alert-circle"></em>
                                {{ __(config('settings.limited_user_message')) }}
                            </div>

                        @else
                            <form method="POST" class="form-validate is-alter" novalidate="novalidate" id="transferFormData">
                                @csrf
                                <div class="form-group">
                                    <div class="text-info">
                                    <em class="icon ni ni-info"></em>
                                        Please ensure to fill this form correctly.
                                    </div>
                                </div>
                                @if($errors->any())
                                    <div class="alert alert-icon alert-danger" role="alert">
                                        <em class="icon ni ni-alert-circle"></em>
                                        <strong>Oops!</strong>. {{ $errors->first() }}
                                    </div>
                                @endif
                                <div class="row g-gs">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="bank_name">Receiver's Bank Name</label>
                                            <div class="form-control-wrap">
                                                <input type="text" class="form-control" id="bank_name" name="bank_name" value="{{ old('bank_name') }}" required autofocus>
                                                @error('bank_name')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="receiver_name">Receiver Name</label>
                                            <div class="form-control-wrap">
                                                <input type="text" class="form-control" id="receiver_name" name="receiver_name" value="{{ old('receiver_name') }}" required>
                                                @error('receiver_name')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>

                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="receiver_account">Receiver's Account Number</label>
                                            <div class="form-control-wrap">
                                                <input
                                                    type="number"
                                                    class="form-control"
                                                    id="receiver_account"
                                                    name="receiver_account"
                                                    value="{{ old('receiver_account') }}"
                                                    required
                                                    minlength="10"
                                                >
                                                @error('receiver_account')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>

                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="option">Transfer Option</label>
                                            <div class="form-control-wrap">
                                                <select class="form-control form-select" id="transfer_type" name="transfer_type" required>
                                                    <option value="Local-transfer" selected>Local Transfer</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="sender_account">Sender's Account Number</label>
                                            <div class="form-control-wrap">
                                                <input type="text" class="form-control" id="sender_account" value="{{ auth()->user()->account->account_number }}" disabled>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="routing_number">Routing Transit Number (RTN)</label>
                                            <div class="form-control-wrap">
                                                <input
                                                    type="number"
                                                    class="form-control"
                                                    id="routing_number"
                                                    name="routing_number"
                                                    value="{{ old('routing_number') }}"
                                                    required
                                                    minlength="9"
                                                    maxlength="9"
                                                >
                                                @error('routing_number')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="amount">Amount to Transfer</label>
                                            <div class="form-control-wrap">
                                                <input
                                                    type="number"
                                                    class="form-control"
                                                    id="amount"
                                                    name="amount"
                                                    step="0.01"
                                                    value="{{ old('amount') }}"
                                                    required
                                                >
                                                @error('amount')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="swift_code">Swift Code</label>
                                            <div class="form-control-wrap">
                                                <input type="text" class="form-control" id="swift_code" name="swift_code" value="{{ old('swift_code') }}" required>
                                                @error('swift_code')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="iban_code">Iban Code</label>
                                            <div class="form-control-wrap">
                                                <input type="text" class="form-control" id="iban_code" name="iban_code" value="{{ old('iban_code') }}" required>
                                                @error('iban_code')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="form-label" for="remark">Remark</label>
                                            <div class="form-control-wrap">
                                                <input type="text" class="form-control" id="remark" name="remark" value="{{ old('remark') }}" required>
                                                @error('remark')
                                                    <span class="text-danger ff-italic" role="alert">
                                                        <strong>{{ $message }}</strong>
                                                    </span>
                                                @enderror
                                            </div>
                                        </div>
                                    </div>
                                    <div class="nk-pps-field form-action text-center">
                                        <div class="nk-pps-action">
                                            <button class="btn btn-block btn-primary clicked-button">
                                                <span>TRANSFER FUND</span>
                                                <span class="spinner-border spinner-border-sm hide clicked-button-spinner" style="display: none;" role="status" aria-hidden="true"></span>
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        @endif
                    </div>
                </div><!-- .card -->
            </div>
        </div>
    </div>
@include('user.modals.transfer_modals')
@section('page-level-js')
<script src="/assets/user/transfer.js?ver={{ rand(1,999999) }}>"></script>
@endsection
</x-user.layout>
