{{-- アラート --}}
@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-body">
  <!-- {{-- バリデーションエラー表示 --}}
  @if ($errors->any())
    <div class="alert alert-danger">
      <ul class="mb-0">
        @foreach ($errors->all() as $error)
          <li>{{ $error }}</li>
        @endforeach
      </ul>
    </div>
  @endif -->

  {{-- ▼ 入力フィールド群 --}}
  <div class="row">

    {{-- 駐車場所ID（※ 編集時のみ表示） --}}
    @if($isEdit)
    <div class="col-3 form-group">
        <label>{{ __('駐車場所ID') }}</label>
    </div>
    <div class="col-9 form-group">
        <div class="input-group">
            <input type="text"
                name="price_parkplaceid"
                value="{{ old('price_parkplaceid', $record->price_parkplaceid ?? '') }}"
                class="form-control form-control-lg"
                readonly
                placeholder="{{ __('validation.attributes.price_parkplaceid') }}">
        </div>
    </div>
    @endif

    {{-- 商品名 --}}
    <div class="col-3 form-group">
    <label class="required">{{ __('商品名') }}</label>
    </div>
    <div class="col-9 form-group">
    <div class="input-group">
        <input type="text"
            name="prine_name"
            value="{{ old('prine_name', $record->prine_name ?? '') }}"
            class="form-control form-control-lg"
            placeholder="{{ __('validation.attributes.prine_name') }}">
    </div>
    </div>

    {{-- 期間 --}}
    <div class="col-3 form-group">
    <label class="required">{{ __('期間') }}</label>
    </div>
    <div class="col-9 form-group">
    <div class="input-group">
        <select name="price_month" class="form-control form-control-lg">
        <option value="">{{ __('期間') }}</option>
        @foreach(\App\Models\Price::PRICE_MONTH as $key => $item)
            <option value="{{ $key }}" @if($key == old('price_month', $record->price_month ?? '')) selected @endif>
            {{ $item }}
            </option>
        @endforeach
        </select>
    </div>
    </div>

    {{-- 駐輪場名 --}}
    <div class="col-3 form-group">
    <label class="required">{{ __('駐輪場名') }}</label>
    </div>
    <div class="col-9 form-group">
    <div class="input-group">
        <select name="park_id" class="form-control form-control-lg">
        <option value="">{{ __('駐輪場名') }}</option>
        @foreach($parks as $key => $item)
            <option value="{{ $key }}" @if($key == old('park_id', $record->park_id ?? '')) selected @endif>
            {{ $item }}
            </option>
        @endforeach
        </select>
    </div>
    </div>

    {{-- 車種区分名 --}}
    <div class="col-3 form-group">
    <label class="required">{{ __('車種区分名') }}</label>
    </div>
    <div class="col-9 form-group">
    <div class="input-group">
        <select name="psection_id" class="form-control form-control-lg">
        <option value="">{{ __('車種区分名') }}</option>
        @foreach($psections as $key => $item)
            <option value="{{ $key }}" @if($key == old('psection_id', $record->psection_id ?? '')) selected @endif>
            {{ $item }}
            </option>
        @endforeach
        </select>
    </div>
    </div>

    {{-- 駐輪分類名 --}}
    <div class="col-3 form-group">
    <label class="required">{{ __('駐輪分類名') }}</label>
    </div>
    <div class="col-9 form-group">
    <div class="input-group">
        <select name="price_ptypeid" class="form-control form-control-lg">
        <option value="">{{ __('駐輪分類名') }}</option>
        @foreach($ptypes as $key => $item)
            <option value="{{ $key }}" @if($key == old('price_ptypeid', $record->price_ptypeid ?? '')) selected @endif>
            {{ $item }}
            </option>
        @endforeach
        </select>
    </div>
    </div>

    {{-- 利用者分類 --}}
    <div class="col-3 form-group">
        <label class="required">{{ __('利用者分類') }}</label>
    </div>
    <div class="col-9 form-group">
        <div class="input-group">
            <select name="user_categoryid" class="form-control form-control-lg">
                <option value="">{{ __('validation.attributes.user_categoryid') }}</option>
                @foreach($userTypes as $key => $item)
                <option value="{{ $key }}" @if($key == old('user_categoryid', $record->user_categoryid ?? '')) selected @endif>
                {{ $item }}
                </option>
            @endforeach
            </select>
        </div>
    </div>

    {{-- 駐車車室ID --}}
    <div class="col-3 form-group">
        <label>{{ __('駐車車室ID') }}</label>
    </div>
    <div class="col-9 form-group">
        <div class="input-group">
            <select name="pplace_id" class="form-control form-control-lg">
                <option value="">{{ __('validation.attributes.pplace_id') }}</option>
                @foreach($pplaces as $key => $item)
                    <option value="{{ $key }}" @if($key == old('pplace_id', $record->pplace_id ?? '')) selected @endif>
                        {{ $item }}
                    </option>
                @endforeach
            </select>
        </div>
    </div>

    {{-- 駐輪料金（税込） --}}
    <div class="col-3 form-group">
        <label class="required">{{ __('駐輪料金（税込）') }}</label>
    </div>
    <div class="col-9 form-group">
        <div class="input-group">
            <input type="number"
            step="0.01"
            name="price"
            value="{{ old('price', $record->price ?? '') }}"
            class="form-control form-control-lg"
            placeholder="{{ __('validation.attributes.price') }}">
        </div>
    </div>



  </div> {{-- /.row --}}

  {{-- ▼ 下部ボタン --}}
  <div class="row mt-4">
    <div class="form-group col-md-10 d-flex align-items-center gap-2 justify-content-start">

      {{-- 登録ボタン --}}
      @if ($isEdit ?? false)
        <button type="button" id="register_edit" class="btn btn-lg btn-success mr-2">
          {{ __('登録') }}
        </button>
      @else
        <button type="button" id="register" class="btn btn-lg btn-success mr-2 register">
          {{ __('登録') }}
        </button>
      @endif

      {{-- 削除ボタン（編集時のみ表示） --}}
      @if ($isEdit ?? false)
        <button type="button" id="delete_edit" class="btn btn-lg btn-danger">
          {{ __('削除') }}
        </button>
      @endif

    </div>
  </div>

</div> {{-- /.card-body --}}
