{!! Form::open(['url' => action([\Modules\AccountingReports\Http\Controllers\LoanController::class, 'update'], [$loan->id]), 'method' => 'PUT', 'id' => 'loan_form', 'files' => true]) !!}

@lang('accounting-reports::lang.edit_loan')

{!! Form::label('loan_number', __('accounting-reports::lang.loan_number') . ':') !!} {!! Form::text('loan_number', $loan->loan_number, ['class' => 'form-control', 'readonly']) !!}
{!! Form::label('loan_name', __('accounting-reports::lang.loan_name') . ':*') !!} {!! Form::text('loan_name', $loan->loan_name, ['class' => 'form-control', 'required', 'placeholder' => __('accounting-reports::lang.loan_name')]) !!}
{!! Form::label('description', __('accounting-reports::lang.description') . ':') !!} {!! Form::textarea('description', $loan->description, ['class' => 'form-control', 'rows' => '3', 'placeholder' => __('accounting-reports::lang.description')]) !!}
{!! Form::label('loan_amount', __('accounting-reports::lang.loan_amount') . ':*') !!}
{!! Form::text('loan_amount', @num_format($loan->loan_amount), ['class' => 'form-control input_number', 'required']) !!}
{!! Form::label('loan_date', __('accounting-reports::lang.loan_date') . ':*') !!}
{!! Form::text('loan_date', @format_date($loan->loan_date), ['class' => 'form-control date-picker', 'required', 'readonly']) !!}
{!! Form::label('interest_rate', __('accounting-reports::lang.interest_rate') . ':') !!}
{!! Form::text('interest_rate', @num_format($loan->interest_rate), ['class' => 'form-control input_number', 'placeholder' => '0.00']) !!} %
{!! Form::label('interest_type', __('accounting-reports::lang.interest_type') . ':') !!} {!! Form::select('interest_type', ['flat' => __('accounting-reports::lang.flat'), 'reducing' => __('accounting-reports::lang.reducing')], $loan->interest_type, ['class' => 'form-control select2', 'style' => 'width:100%']) !!}
{!! Form::label('maturity_date', __('accounting-reports::lang.maturity_date') . ':') !!}
{!! Form::text('maturity_date', $loan->maturity_date ? @format_date($loan->maturity_date) : null, ['class' => 'form-control date-picker', 'readonly']) !!}
{!! Form::label('status', __('accounting-reports::lang.status') . ':') !!} {!! Form::select('status', ['active' => __('accounting-reports::lang.active'), 'closed' => __('lang_v1.closed'), 'defaulted' => __('accounting-reports::lang.defaulted')], $loan->status, ['class' => 'form-control select2', 'style' => 'width:100%']) !!}
{!! Form::label('location_id', __('purchase.business_location') . ':') !!} {!! Form::select('location_id', $locations, $loan->location_id, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select'), 'style' => 'width:100%']) !!}

@lang('accounting-reports::lang.lender_information')

{!! Form::label('lender_name', __('accounting-reports::lang.lender_name') . ':*') !!} {!! Form::text('lender_name', $loan->lender_name, ['class' => 'form-control', 'required', 'placeholder' => __('accounting-reports::lang.lender_name')]) !!}
{!! Form::label('lender_contact', __('accounting-reports::lang.lender_contact') . ':') !!} {!! Form::text('lender_contact', $loan->lender_contact, ['class' => 'form-control', 'placeholder' => __('accounting-reports::lang.lender_contact')]) !!}
{!! Form::label('lender_address', __('accounting-reports::lang.lender_address') . ':') !!} {!! Form::textarea('lender_address', $loan->lender_address, ['class' => 'form-control', 'rows' => '2', 'placeholder' => __('accounting-reports::lang.lender_address')]) !!}

@lang('accounting-reports::lang.account_information')

@lang('accounting-reports::lang.liability_account'): {{ $loan->liabilityAccount ? $loan->liabilityAccount->name : '-' }}
{!! Form::label('payment_account_id', __('accounting-reports::lang.payment_account') . ':') !!} {!! Form::select('payment_account_id', $payment_accounts, $loan->payment_account_id, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select'), 'style' => 'width:100%']) !!}
{!! Form::label('reference_no', __('accounting-reports::lang.reference_no') . ':') !!} {!! Form::text('reference_no', $loan->reference_no, ['class' => 'form-control', 'placeholder' => __('accounting-reports::lang.reference_no')]) !!}
{!! Form::label('document', __('purchase.attach_document') . ':') !!} {!! Form::file('document', ['class' => 'form-control', 'accept' => 'image/*,.pdf,.doc,.docx,.xls,.xlsx']) !!}

@lang('lang_v1.max_file_size_10mb')

@if($loan->document)

@lang('lang_v1.view_uploaded_document')

@endif
{!! Form::close() !!}