@if($invoice->type != 'Down Payment')
@if(!$invoice->invoiceable)
{{-- Phase --}}
{{ Form::label('phase_id', __('Phase'), ['class' => 'col-form-label']) }}
{!! Form::select('phase_id', @$invoiceItem->id ? [$invoiceItem->invoiceable_id => $invoiceItem->invoiceable->name ] : [], @$invoiceItem->invoiceable_id ? : null, [
'class' => 'form-select', 'data-kt-select2' => 'true',
'data-remote' => route('resource-select', ['ContractPhase', 'of_contract' => $invoice->contract->uuid, 'allowable_only' => true, 'must_have_remaining_amount' => true]),
'data-placeholder' => 'Select Phase',
'data-allow-clear' => 'true',
'data-contract' => $invoice->contract->uuid,
'disabled' => @$invoiceItem->name && 1
]) !!}
@else
{{-- Expense --}}
{{ Form::label('expense_id', __('Invoiceable'), ['class' => 'col-form-label']) }}
{!! Form::select('expense_id', @$invoiceItem->invoiceable ? [$invoiceItem->invoiceable->id => $invoiceItem->invoiceable->name ] : [], @$invoiceItem->invoiceable->id ? : null, [
'class' => 'form-select', 'data-kt-select2' => 'true',
'data-remote' => route('resource-select', ['Expense', 'currency' => $invoice->currency, 'must_have_remaining_amount' => true]),
'data-placeholder' => 'Select Expense',
'data-allow-clear' => 'true',
'disabled' => 1
]) !!}
@endif
{{-- remaining amount --}}
{{ Form::label('remaining_amount', __('Remaining Amount'), ['class' => 'col-form-label']) }}
{!! Form::number('remaining_amount', $invoiceItem->invoiceable ? @$invoiceItem->invoiceable->getRemainingAmount() : null, ['class' => 'form-control', 'placeholder' => __('0.00'), 'disabled' => true]) !!}
@endif
{{-- Name --}}
{{ Form::label('name', __('Item Name'), ['class' => 'col-form-label']) }}
{!! Form::text('name', @$invoiceItem->name, ['class' => 'form-control', $disabled, 'placeholder' => __('Item Name')]) !!}
{{-- price --}}
{{ Form::label('price', __('Price'), ['class' => 'col-form-label']) }}
{!! Form::number('price', @$invoiceItem->unit_price, ['class' => 'form-control', $disabled, 'placeholder' => __('Price')]) !!}
{{-- quantity --}}
{{ Form::label('quantity', __('Quantity'), ['class' => 'col-form-label']) }}
{!! Form::number('quantity', @$invoiceItem->quantity, ['class' => 'form-control', $disabled, 'placeholder' => __('Quantity')]) !!}