{{-- アラート --}}
@if(Session::has('success'))
    <div class="alert alert-success alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        {{ Session::get('success') }}
    </div>
@endif

@if($errors->any())
    <div class="alert alert-danger alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <h4><i class="icon fa fa-ban"></i> {{ __('入力内容に不備があります:') }}</h4>
        <ul>
            @foreach($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif

<div class="card">
  <div class="card-body">
    {{-- 管轄印刷エリアID（編集時のみ表示） --}}
    <div class="row mb-3">
      @if($isEdit)
        <label class="col-md-2 col-form-label">{{ __('validation.attributes.print_area_id') }}</label>
        <div class="col-md-10">
          <input type="text" class="form-control form-control-lg" value="{{ $record->print_area_id ?? '' }}" readonly>
        </div>
      @endif
    </div>

    {{-- 管轄印刷エリア名 --}}
    <div class="row mb-3">
      <label class="col-md-2 col-form-label">
        {{ __('validation.attributes.print_area_name') }}
        <span class="text-danger">*</span>
      </label>
      <div class="col-md-10">
        <input type="text" name="print_area_name" class="form-control form-control-lg"
              value="{{ old('print_area_name', $record->print_area_name ?? '') }}"
              placeholder="{{ __('validation.attributes.print_area_name') }}">
      </div>
    </div>

    {{-- 駐輪場 --}}
    <div class="row mb-3">
      <label class="col-md-2 col-form-label">
        {{ __('validation.attributes.park_name') }}
        <span class="text-danger">*</span>
      </label>
      <div class="col-md-10">
        <select name="park_id" class="form-control form-control-lg">
          <option value="">{{ __('validation.attributes.park_name') }}</option>
          @foreach($parks as $key => $val)
            <option value="{{ $key }}" @if(($record->park_id ?? '') == $key) selected @endif>{{ $val }}</option>
          @endforeach
        </select>
      </div>
    </div>

    {{-- ▼ 下部ボタン --}}
    <div class="col-3"></div>
    <div class="form-group col-9 d-flex align-items-center gap-2 mt-4">
      {{-- 登録ボタン --}}
      @if($isEdit)
        <button type="submit" id="register_edit" class="btn btn-lg btn-success mr-2">
          {{ __('登録') }}
        </button>
      @else
        <button type="submit" id="register" class="btn btn-lg btn-success mr-2 register">
          {{ __('登録') }}
        </button>
      @endif
      
      {{-- 削除ボタン（編集時のみ表示） --}}
      @if($isEdit && !empty($record->print_area_id))
        <button type="button" id="delete_edit" class="btn btn-lg btn-danger">
          {{ __('削除') }}
        </button>
      @endif
    </div>
  </div>        
</div>
