<x-master-layout :assets="$assets ?? []">
    <div>
        <?php $id = $id ?? null;?>
        @if(isset($id))
            {!! Form::model($userbankaccount, ['route' => ['banks-deatils-save', $id], 'method' => 'patch', 'id' => 'main_form']) !!}
        @else
            {!! Form::open(['route' => ['banks-deatils-save'], 'method' => 'post','id' => 'main_form']) !!}
        @endif
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header d-flex justify-content-between">
                        <div class="header-title">
                            <h4 class="card-title">{{ $pageTitle }}</h4>
                        </div>
                    </div>

                    <div class="card-body">
                        <div class="new-user-info">
                            <div class="row">
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[bank_name]',$userbankaccount->bank_name ?? null , [ 'placeholder' => __('message.bank_name'),'class' =>'form-control']) }}
                                </div>
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[account_number]' ,$userbankaccount->account_number ?? null ,[ 'placeholder' => __('message.bank_account_number'),'class' =>'form-control']) }}
                                </div>
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[account_holder_name]' ,$userbankaccount->account_holder_name ?? null,[ 'placeholder' => __('message.bank_account_holder_name'),'class' =>'form-control']) }}
                                </div>
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[bank_code]',$userbankaccount->bank_code ?? null,[ 'placeholder' => __('message.bank_ifsc_code'),'class' =>'form-control']) }}
                                </div>
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[bank_address]',$userbankaccount->bank_address ?? null,[ 'placeholder' => __('message.bank_address'),'class' =>'form-control']) }}
                                </div>
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[routing_number]',$userbankaccount->routing_number ?? null,[ 'placeholder' => __('message.routing_number'),'class' =>'form-control']) }}
                                </div>
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[bank_iban]',$userbankaccount->bank_iban ?? null,[ 'placeholder' => __('message.bank_iban'),'class' =>'form-control']) }}
                                </div>
                                <div class="form-group col-md-6">
                                    {{ Form::text('user_bank_account[bank_swift]',$userbankaccount->bank_swift ?? null,[ 'placeholder' => __('message.bank_swift'),'class' =>'form-control']) }}
                                </div>
                            </div>
                            {{ Form::submit( __('message.save'), ['class'=>'btn btn-md btn-primary float-right']) }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
        {!! Form::close() !!}
    </div>
    @section('bottom_script')
        <script>
             $(document).ready(function () {
        
              formValidation("#main_form", {
                    'user_bank_account[bank_name]': { required: true },
                    'user_bank_account[account_number]': { required: true },
                    'user_bank_account[account_holder_name]': { required: true },
                    'user_bank_account[bank_code]': { required: true },
                    'user_bank_account[bank_address]': { required: true },
                    'user_bank_account[routing_number]': { required: true },
                    'user_bank_account[bank_iban]': { required: true },
                    'user_bank_account[bank_swift]': { required: true },
                }, {
                    'user_bank_account[bank_name]': { required: "{{__('message.please_enter_bank_name')}}"},
                    'user_bank_account[bank_name]': { required: "{{__('message.please_enter_account_number')}}"},
                    'user_bank_account[account_holder_name]': { required: "{{__('message.please_enter_account_holder_name')}}"},
                    'user_bank_account[bank_code]': { required: "{{__('message.please_enter_bank_code')}}"},
                    'user_bank_account[bank_address]': { required: "{{__('message.please_enter_bank_address')}}"},
                    'user_bank_account[routing_number]': { required: "{{__('message.please_enter_routing_number')}}"},
                    'user_bank_account[bank_iban]': { required: "{{__('message.please_enter_bank_iban')}}"},
                    'user_bank_account[bank_swift]': { required: "{{__('message.please_enter_bank_swift')}}"},
                });                                                                                                 

            });
        </script>
    @endsection
</x-master-layout>
