@php $isEdit = !empty($relation); $action = $isEdit ? action([\App\Http\Controllers\HoldingController::class, 'updateRelation'], [$relation->id]) : action([\App\Http\Controllers\HoldingController::class, 'storeRelation']); @endphp {!! Form::open(['url' => $action, 'method' => $isEdit ? 'put' : 'post', 'id' => 'holding_relation_form']) !!}

{{ $isEdit ? __('lang_v1.holding_edit_relation') : __('lang_v1.holding_add_entity_relationship') }}

{!! Form::label('owner_entity_id', __('lang_v1.holding_owner_entity') . ':*') !!} {!! Form::select('owner_entity_id', $entities, $relation->owner_entity_id ?? null, ['class' => 'form-control select2', 'required', 'placeholder' => __('lang_v1.holding_owner_entity')]) !!}
{!! Form::label('related_entity_id', __('lang_v1.holding_related_entity') . ':*') !!} {!! Form::select('related_entity_id', $entities, $relation->related_entity_id ?? null, ['class' => 'form-control select2', 'required', 'placeholder' => __('lang_v1.holding_related_entity')]) !!}
{!! Form::label('relation_type', __('lang_v1.type') . ':*') !!} {!! Form::select('relation_type', $relationTypes, $relation->relation_type ?? 'subsidiary', ['class' => 'form-control select2', 'required']) !!}
{!! Form::label('contract_ref', __('lang_v1.holding_contract_ref') . ':') !!} {!! Form::text('contract_ref', $relation->contract_ref ?? null, ['class' => 'form-control']) !!}
{!! Form::label('contract_start_date', __('lang_v1.holding_start_date') . ':') !!} {!! Form::text('contract_start_date', !empty($relation->contract_start_date) ? format_date($relation->contract_start_date) : null, ['class' => 'form-control holding-date-picker', 'readonly', 'autocomplete' => 'off']) !!}
{!! Form::label('contract_end_date', __('lang_v1.holding_end_date') . ':') !!} {!! Form::text('contract_end_date', !empty($relation->contract_end_date) ? format_date($relation->contract_end_date) : null, ['class' => 'form-control holding-date-picker', 'readonly', 'autocomplete' => 'off']) !!}
{!! Form::close() !!}