@php $v = $vehicle ?? null; @endphp
<div class="row">
    <div class="col-md-6">
        <div class="form-group">
            {!! Form::label('erp_customer_id', __('vrc::lang.customer') . ':*') !!}
            {!! Form::select('erp_customer_id', $customers, $v->erp_customer_id ?? null, ['class' => 'form-control vrc-select2', 'required', 'placeholder' => __('messages.please_select')]) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('make_id', __('vrc::lang.make') . ':') !!}
            {!! Form::select('make_id', $makes, $v->make_id ?? null, ['class' => 'form-control vrc-select2 vrc-make-select', 'placeholder' => __('messages.please_select'), 'data-models-url' => route('vrc.vehicle-models')]) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('model_id', __('vrc::lang.model') . ':') !!}
            {!! Form::select('model_id', $models, $v->model_id ?? null, ['class' => 'form-control vrc-select2 vrc-model-select', 'placeholder' => __('messages.please_select')]) !!}
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('plate_number', __('vrc::lang.plate_number') . ':') !!}
            {!! Form::text('plate_number', $v->plate_number ?? null, ['class' => 'form-control']) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('vin', __('vrc::lang.vin') . ':') !!}
            {!! Form::text('vin', $v->vin ?? null, ['class' => 'form-control']) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('year', __('vrc::lang.year') . ':') !!}
            {!! Form::number('year', $v->year ?? null, ['class' => 'form-control', 'min' => 1900, 'max' => 2100]) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('color', __('vrc::lang.color') . ':') !!}
            {!! Form::text('color', $v->color ?? null, ['class' => 'form-control']) !!}
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('engine_number', __('vrc::lang.engine_number') . ':') !!}
            {!! Form::text('engine_number', $v->engine_number ?? null, ['class' => 'form-control']) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('transmission', __('vrc::lang.transmission') . ':') !!}
            {!! Form::select('transmission', $transmissions, $v->transmission ?? null, ['class' => 'form-control', 'placeholder' => __('messages.please_select')]) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('fuel_type', __('vrc::lang.fuel_type') . ':') !!}
            {!! Form::select('fuel_type', $fuel_types, $v->fuel_type ?? null, ['class' => 'form-control', 'placeholder' => __('messages.please_select')]) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('odometer', __('vrc::lang.odometer') . ':') !!}
            <div class="input-group">
                {!! Form::number('odometer', $v->odometer ?? null, ['class' => 'form-control', 'min' => 0]) !!}
                <span class="input-group-btn" style="width:1%;">
                    {!! Form::select('odometer_unit', ['km' => 'km', 'mi' => 'mi'], $v->odometer_unit ?? 'km', ['class' => 'form-control']) !!}
                </span>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('registration_expiry', __('vrc::lang.registration_expiry') . ':') !!}
            {!! Form::date('registration_expiry', isset($v->registration_expiry) ? optional($v->registration_expiry)->format('Y-m-d') : null, ['class' => 'form-control']) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('insurance_policy_no', __('vrc::lang.insurance_policy_no') . ':') !!}
            {!! Form::text('insurance_policy_no', $v->insurance_policy_no ?? null, ['class' => 'form-control']) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('insurance_expiry', __('vrc::lang.insurance_expiry') . ':') !!}
            {!! Form::date('insurance_expiry', isset($v->insurance_expiry) ? optional($v->insurance_expiry)->format('Y-m-d') : null, ['class' => 'form-control']) !!}
        </div>
    </div>
    <div class="col-md-3">
        <div class="form-group">
            {!! Form::label('vehicle_type', __('vrc::lang.vehicle_type') . ':') !!}
            {!! Form::text('vehicle_type', $v->vehicle_type ?? null, ['class' => 'form-control']) !!}
        </div>
    </div>
</div>

<div class="form-group">
    {!! Form::label('notes', __('vrc::lang.notes') . ':') !!}
    {!! Form::textarea('notes', $v->notes ?? null, ['class' => 'form-control', 'rows' => 2]) !!}
</div>

<div class="checkbox">
    <label>
        {!! Form::checkbox('is_active', 1, isset($v) ? (bool) $v->is_active : true) !!}
        @lang('vrc::lang.active')
    </label>
</div>
