@if ($invoice->id)
{!! Form::model($invoice, ['route' => ['admin.invoices.update', $invoice], 'method' => 'PUT']) !!}
@else
{!! Form::model($invoice, ['route' => ['admin.invoices.store'], 'method' => 'POST']) !!}
@endif
{!! Form::hidden('invoice_type', $invoice->type ? : 'Regular', ['id' => 'id-invoice-type']) !!}
{{-- Client --}}
{{ Form::label('company_id', __('Client'), ['class' => 'col-form-label']) }}
{!! Form::select('company_id', $clients ?? [], @$invoice->bill_clientid, [
'id' => 'client_id-select',
'class' => 'form-select dependent-select required',
'data-kt-select2' => 'true',
'data-placeholder' => 'Select Client',
'data-remote' => route('resource-select', ['groupedCompany', 'dependent_2_col' => 'creating-inv-type']),
'data-dependent_2' => 'id-invoice-type',
'data-allow-clear' => 'true'
]) !!}
{{-- Contract --}}
{{ Form::label('contract_id', __('Contract'), ['class' => 'col-form-label']) }}
{!! Form::select('contract_id', $companies ?? [], @$invoice->contract_id, [
'class' => 'form-select required',
'data-kt-select2' => 'true',
'data-remote' => route('resource-select', ['Contract', 'dependent' => 'company_id', 'dependent_2_col' => 'creating-inv-type']),
'data-placeholder' => 'Select Contract',
'data-dependent_id' => 'client_id-select',
'data-dependent_2' => 'id-invoice-type',
'data-allow-clear' => 'true'
]) !!}
{{-- Expense --}}
{{ Form::label('expense_id', __('Expense'), ['class' => 'col-form-label']) }}
{!! Form::select('expense_id', [], null, [
'class' => 'form-select',
'data-kt-select2' => 'true',
'data-remote' => route('resource-select', ['Expense', 'must_have_remaining_amount' => true, 'filter_status' => '1', 'dependent' => 'company_id']),
'data-placeholder' => 'Select Expense',
'data-dependent_id' => 'client_id-select',
'data-dependent_2' => 'id-invoice-type',
'data-allow-clear' => 'true'
]) !!}
{{-- competition --}}
{{ Form::label('competition_id', __('Competition'), ['class' => 'col-form-label']) }}
{!! Form::select('competition_id', [], null, [
'class' => 'form-select',
'data-kt-select2' => 'true',
'data-remote' => route('resource-select', ['Competition']),
'data-placeholder' => 'Select Competition',
'id' => 'competition_id-select',
'data-allow-clear' => 'true'
]) !!}
{{-- select participant --}}
{{ Form::label('participant_id', __('Participant'), ['class' => 'col-form-label']) }}
{!! Form::select('participant_id', [], null, [
'class' => 'form-select',
'data-remote' => route('resource-select', ['CompetitionParticipant', 'must_have_remaining_amount' => true, 'filter_status' => 'Approved', 'filter_is_winner' => '1', 'dependent' => 'competition_id']),
'data-kt-select2' => 'true',
'data-placeholder' => 'Select Participant',
'data-dependent_id' => 'competition_id-select',
'data-allow-clear' => 'true'
]) !!}
{{-- invoice date --}}
{{ Form::label('invoice_date', __('Invoice Date'), ['class' => 'col-form-label']) }}
{!! Form::text('invoice_date', null, ['class' => 'form-control flatpickr', 'placeholder' => __('Invoice Date')]) !!}
{{-- due date --}}
{{ Form::label('due_date', __('Due Date'), ['class' => 'col-form-label']) }}
{!! Form::text('due_date', null, ['class' => 'form-control flatpickr', 'placeholder' => __('Due Date')]) !!}
{{-- amount --}}
{{-- description --}}
{{ Form::label('description', __('Description'), ['class' => 'col-form-label']) }}
{!! Form::text('description', null, ['class' => 'form-control', 'placeholder' => __('Description')]) !!}
{!! Form::close() !!}