@php($asset = $asset ?? null)
<div class="row">
  <div class="col-md-4">
    <div class="form-group">
      {!! Form::label('code', __('bms::lang.asset_code') . ':') !!}
      {!! Form::text('code', $asset->code ?? null, ['class' => 'form-control', 'placeholder' => __('bms::lang.code_auto_hint')]) !!}
    </div>
  </div>
  <div class="col-md-8">
    <div class="form-group">
      {!! Form::label('name', __('bms::lang.name') . ':*') !!}
      {!! Form::text('name', $asset->name ?? null, ['class' => 'form-control', 'required', 'placeholder' => __('bms::lang.name')]) !!}
    </div>
  </div>
</div>
<div class="row">
  <div class="col-md-6">
    <div class="form-group">
      {!! Form::label('name_ar', __('bms::lang.name') . ' (AR):') !!}
      {!! Form::text('name_ar', $asset->name_ar ?? null, ['class' => 'form-control', 'dir' => 'rtl']) !!}
    </div>
  </div>
  <div class="col-md-3">
    <div class="form-group">
      {!! Form::label('category', __('bms::lang.category') . ':') !!}
      {!! Form::select('category', $categories, $asset->category ?? 'other', ['class' => 'form-control']) !!}
    </div>
  </div>
  <div class="col-md-3">
    <div class="form-group">
      {!! Form::label('quantity', __('bms::lang.quantity') . ':') !!}
      {!! Form::number('quantity', $asset->quantity ?? 1, ['class' => 'form-control', 'min' => 1]) !!}
    </div>
  </div>
</div>
<div class="row">
  <div class="col-md-3">
    <div class="form-group">
      {!! Form::label('condition', __('bms::lang.condition') . ':') !!}
      {!! Form::select('condition', $conditions, $asset->condition ?? 'good', ['class' => 'form-control']) !!}
    </div>
  </div>
  <div class="col-md-3">
    <div class="form-group">
      {!! Form::label('status', __('bms::lang.asset_status') . ':') !!}
      {!! Form::select('status', $statuses, $asset->status ?? 'available', ['class' => 'form-control']) !!}
    </div>
  </div>
  <div class="col-md-3">
    <div class="form-group">
      {!! Form::label('unit_value', __('bms::lang.unit_value') . ':') !!}
      {!! Form::number('unit_value', $asset->unit_value ?? null, ['class' => 'form-control', 'step' => '0.01', 'min' => 0]) !!}
    </div>
  </div>
  <div class="col-md-3">
    <div class="form-group">
      {!! Form::label('serial_no', __('bms::lang.serial_no') . ':') !!}
      {!! Form::text('serial_no', $asset->serial_no ?? null, ['class' => 'form-control']) !!}
    </div>
  </div>
</div>

@if (!empty($withPlacement))
<div class="row">
  <div class="col-md-6">
    <div class="form-group">
      {!! Form::label('location_id', __('bms::lang.current_location') . ':') !!}
      {!! Form::select('location_id', $locations, null, ['class' => 'form-control', 'placeholder' => __('bms::lang.warehouse_default')]) !!}
    </div>
  </div>
  <div class="col-md-6">
    <div class="form-group">
      {!! Form::label('hall_id', __('bms::lang.current_hall') . ':') !!}
      {!! Form::select('hall_id', $halls, null, ['class' => 'form-control', 'placeholder' => __('messages.please_select')]) !!}
    </div>
  </div>
</div>
@endif

<div class="row">
  <div class="col-md-6">
    <div class="form-group">
      {!! Form::label('purchased_at', __('bms::lang.purchased_at') . ':') !!}
      {!! Form::date('purchased_at', isset($asset->purchased_at) ? optional($asset->purchased_at)->format('Y-m-d') : null, ['class' => 'form-control']) !!}
    </div>
  </div>
</div>
<div class="form-group">
  {!! Form::label('notes', __('bms::lang.notes') . ':') !!}
  {!! Form::textarea('notes', $asset->notes ?? null, ['class' => 'form-control', 'rows' => 2]) !!}
</div>
