@php
$clearance = $clearance ?? null;
$defaultClearanceType = ($transaction->type ?? null) === 'sell' ? 'export' : 'import';
@endphp
{!! Form::label('clearance_type', __('tms::lang.customs_type').':*') !!}
{!! Form::select('clearance_type', $types, $clearance->clearance_type ?? $defaultClearanceType, ['class'=>'form-control','required','id'=>'clearance_type']) !!}
{!! Form::label('status', __('tms::lang.status').':*') !!}
{!! Form::select('status', $statuses, $clearance->status ?? 'draft', ['class'=>'form-control','required']) !!}
{!! Form::label('broker_id', __('tms::lang.broker').':') !!}
{!! Form::select('broker_id', $brokers, $clearance->broker_id ?? null, ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('shipment_id', __('tms::lang.shipment').':') !!}
{!! Form::select('shipment_id', $shipments, $clearance->shipment_id ?? ($shipment->id ?? null), ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('contact_id', __('tms::lang.contact').':') !!}
{!! Form::select('contact_id', $customers + $suppliers, $clearance->contact_id ?? ($transaction->contact_id ?? ($shipment->contact_id ?? null)), ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('customs_office', __('tms::lang.customs_office').':') !!}
{!! Form::text('customs_office', $clearance->customs_office ?? null, ['class'=>'form-control']) !!}
{!! Form::label('declaration_no', __('tms::lang.declaration_no').':') !!}
{!! Form::text('declaration_no', $clearance->declaration_no ?? null, ['class'=>'form-control']) !!}
{!! Form::label('bill_of_lading', __('tms::lang.bill_of_lading').':') !!}
{!! Form::text('bill_of_lading', $clearance->bill_of_lading ?? null, ['class'=>'form-control']) !!}
{!! Form::label('country_of_origin', __('tms::lang.country_of_origin').':') !!}
{!! Form::text('country_of_origin', $clearance->country_of_origin ?? null, ['class'=>'form-control']) !!}
{!! Form::label('other_charges', __('tms::lang.other_charges').':') !!}
{!! Form::text('other_charges', $clearance->other_charges ?? 0, ['class'=>'form-control input_number','id'=>'customs_other_charges']) !!}
@if(!empty($transaction))
{!! Form::hidden('transaction_id', $transaction->id) !!}
@elseif(!empty($clearance->transaction_id))
{!! Form::hidden('transaction_id', $clearance->transaction_id) !!}
@endif
{!! Form::label('notes', __('tms::lang.notes').':') !!}
{!! Form::textarea('notes', $clearance->notes ?? null, ['class'=>'form-control','rows'=>2]) !!}