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

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

{!! Form::label('name', __('accounting-reports::lang.expense_name') . ':*') !!}
{!! Form::select('name', $expense_names, $direct_expense->name, ['class' => 'form-control select2', 'required', 'placeholder' => __('messages.please_select'), 'style' => 'width:100%', 'id' => 'expense_name_select']) !!}

@lang('accounting-reports::lang.select_or_create_expense_name') @lang('accounting-reports::lang.manage_expense_names')

{!! Form::label('description', __('accounting-reports::lang.description') . ':') !!} {!! Form::textarea('description', $direct_expense->description, ['class' => 'form-control', 'rows' => '3', 'placeholder' => __('accounting-reports::lang.description')]) !!}
{!! Form::label('amount', __('accounting-reports::lang.amount') . ':*') !!}
{!! Form::text('amount', @num_format($direct_expense->amount), ['class' => 'form-control input_number', 'id' => 'amount', 'required']) !!}
{!! Form::label('expense_date', __('accounting-reports::lang.expense_date') . ':*') !!}
{!! Form::text('expense_date', @format_date($direct_expense->expense_date), ['class' => 'form-control date-picker', 'required']) !!}
{!! Form::label('location_id', __('purchase.business_location') . ':') !!} {!! Form::select('location_id', $locations, $direct_expense->location_id, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select'), 'style' => 'width:100%']) !!}
{!! Form::label('account_id', __('account.account') . ':') !!} {!! Form::select('account_id', $accounts, $direct_expense->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', $direct_expense->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']) !!} @if($direct_expense->document)

@lang('lang_v1.view_uploaded_document')

@endif

@lang('lang_v1.max_file_size_10mb')


@lang('purchase.add_payment')

{!! Form::label('payment_amount', __('sale.amount') . ':') !!}
{!! Form::text('payment_amount', @num_format($direct_expense->payment_amount ?? 0), ['class' => 'form-control input_number payment-amount', 'placeholder' => __('sale.amount')]) !!}
{!! Form::label('paid_on', __('lang_v1.paid_on') . ':') !!}
{!! Form::text('paid_on', $direct_expense->paid_on ? @format_datetime($direct_expense->paid_on) : @format_datetime('now'), ['class' => 'form-control paid_on']) !!}
{!! Form::label('payment_method', __('lang_v1.payment_method') . ':') !!}
{!! Form::select('payment_method', $payment_types, $direct_expense->payment_method ?? 'cash', ['class' => 'form-control select2', 'style' => 'width:100%']) !!}
@if(!empty($payment_accounts))
{!! Form::label('payment_account_id', __('lang_v1.payment_account') . ':') !!}
{!! Form::select('payment_account_id', $payment_accounts, $direct_expense->payment_account_id, ['class' => 'form-control select2 account-dropdown', 'placeholder' => __('messages.please_select'), 'style' => 'width:100%', 'id' => 'payment_account_id']) !!}
@endif
{!! Form::label('payment_note', __('sale.payment_note') . ':') !!} {!! Form::textarea('payment_note', $direct_expense->payment_note, ['class' => 'form-control', 'rows' => '2', 'placeholder' => __('sale.payment_note')]) !!}
@lang('purchase.payment_due'): {{@num_format(0)}}
{!! Form::close() !!}