@php $shipment = $shipment ?? null; $isEdit = !empty($shipment); @endphp
{!! Form::label('shipment_type', __('tms::lang.shipment_type').':*') !!} {!! Form::select('shipment_type', $shipment_types, $shipment->shipment_type ?? 'manual', ['class'=>'form-control','required']) !!}
{!! Form::label('status', __('tms::lang.status').':*') !!} {!! Form::select('status', $statuses, $shipment->status ?? 'draft', ['class'=>'form-control','required']) !!}
{!! Form::label('contact_id', __('tms::lang.customer').':') !!} {!! Form::select('contact_id', $customers, $shipment->contact_id ?? ($transaction->contact_id ?? null), ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('carrier_id', __('tms::lang.carrier').':') !!} {!! Form::select('carrier_id', $carriers, $shipment->carrier_id ?? null, ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('vehicle_id', __('tms::lang.vehicle').':') !!} {!! Form::select('vehicle_id', $vehicles, $shipment->vehicle_id ?? null, ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('driver_id', __('tms::lang.driver').':') !!} {!! Form::select('driver_id', $drivers, $shipment->driver_id ?? null, ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('origin_location_id', __('tms::lang.origin').':') !!} {!! Form::select('origin_location_id', $locations, $shipment->origin_location_id ?? ($transaction->location_id ?? null), ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%']) !!}
{!! Form::label('scheduled_at', __('tms::lang.scheduled_at').':') !!} {!! Form::text('scheduled_at', optional($shipment->scheduled_at ?? null)->format('Y-m-d H:i'), ['class'=>'form-control datetimepicker']) !!}
{!! Form::label('freight_cost', __('tms::lang.freight_cost').':') !!} {!! Form::text('freight_cost', $shipment->freight_cost ?? ($transaction->shipping_charges ?? 0), ['class'=>'form-control input_number']) !!}
{!! Form::label('origin_address', __('tms::lang.origin').':') !!} {!! Form::textarea('origin_address', $shipment->origin_address ?? null, ['class'=>'form-control','rows'=>2]) !!}
{!! Form::label('destination_address', __('tms::lang.destination').':') !!} {!! Form::textarea('destination_address', $shipment->destination_address ?? ($transaction->shipping_address ?? null), ['class'=>'form-control','rows'=>2]) !!}
{!! Form::label('destination_latitude', __('tms::lang.latitude').':') !!} {!! Form::text('destination_latitude', $shipment->destination_latitude ?? null, ['class'=>'form-control','id'=>'destination_latitude','placeholder'=>'35.6892']) !!}
{!! Form::label('destination_longitude', __('tms::lang.longitude').':') !!}
{!! Form::text('destination_longitude', $shipment->destination_longitude ?? null, ['class'=>'form-control','id'=>'destination_longitude','placeholder'=>'51.3890']) !!}

@lang('tms::lang.coords_help')

{!! Form::label('weight', __('tms::lang.weight').':') !!} {!! Form::text('weight', $shipment->weight ?? null, ['class'=>'form-control input_number']) !!}
{!! Form::label('volume', __('tms::lang.volume').':') !!} {!! Form::text('volume', $shipment->volume ?? null, ['class'=>'form-control input_number']) !!}
{!! Form::label('transaction_id', __('tms::lang.linked_transaction').':') !!} {!! Form::select('transaction_id', $transactions ?? [], $shipment->transaction_id ?? ($transaction->id ?? null), ['class'=>'form-control select2','placeholder'=>__('tms::lang.select'),'style'=>'width:100%','id'=>'shipment_transaction_id']) !!}

@lang('tms::lang.linked_transaction_help')

{!! Form::label('cargo_description', __('tms::lang.cargo_description').':') !!} {!! Form::textarea('cargo_description', $shipment->cargo_description ?? ($transaction->shipping_details ?? null), ['class'=>'form-control','rows'=>2]) !!}
{!! Form::label('notes', __('tms::lang.notes').':') !!} {!! Form::textarea('notes', $shipment->notes ?? null, ['class'=>'form-control','rows'=>2]) !!}