{{-- アラート --}}
@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">

    {{-- ▼ 近傍駅ID（自動採番：編集時のみ表示） --}}
    @if($isEdit)
    <div class="form-group row">
        <label class="col-sm-2 col-form-label">近傍駅ID</label>
        <div class="col-sm-10">
            <input type="text"
                name="station_id"
                class="form-control form-control-lg bg-light"
                value="{{ old('station_id', $record->station_id ?? '') }}"
                maxlength="10"
                readonly>
        </div>
    </div>
    @endif

    {{-- ▼ 駐車場 --}}
    <div class="form-group row">
        <label class="col-sm-2 col-form-label required">駐車場</label>
        <div class="col-sm-10">
            <div class="input-group">
                <select name="park_id"
                        class="form-control form-control-lg"
                        required>
                    <option value="">{{ __('validation.attributes.park_id') }}</option>
                    @foreach($parks as $id => $name)
                        <option value="{{ $id }}"
                            {{ old('park_id', $record->park_id ?? '') == $id ? 'selected' : '' }}>
                            {{ $name }}
                        </option>
                    @endforeach
                </select>
            </div>
        </div>
    </div>


    {{-- ▼ 近傍駅 --}}
    <div class="form-group row">
        <label class="col-sm-2 col-form-label required">近傍駅</label>
        <div class="col-sm-10">
            <input type="text"
                name="station_neighbor_station"
                class="form-control form-control-lg"
                value="{{ old('station_neighbor_station', $record->station_neighbor_station ?? '') }}"
                maxlength="50"
                placeholder="{{ __('validation.attributes.station_neighbor_station') }}"
                required>
            <!-- @error('station_neighbor_station')
                <div class="text-danger small">{{ $message }}</div>
            @enderror -->
        </div>
    </div>

    {{-- ▼ 近傍駅ふりがな --}}
    <div class="form-group row">
        <label class="col-sm-2 col-form-label required">近傍駅ふりがな</label>
        <div class="col-sm-10">
            <input type="text"
                name="station_name_ruby"
                class="form-control form-control-lg"
                value="{{ old('station_name_ruby', $record->station_name_ruby ?? '') }}"
                maxlength="50"
                placeholder="{{ __('validation.attributes.station_name_ruby') }}"
                required>
            <!-- @error('station_name_ruby')
                <div class="text-danger small">{{ $message }}</div>
            @enderror -->
        </div>
    </div>

    {{-- ▼ 路線名 --}}
    <div class="form-group row">
        <label class="col-sm-2 col-form-label required">路線名</label>
        <div class="col-sm-10">
            <input type="text"
                name="station_route_name"
                class="form-control form-control-lg"
                value="{{ old('station_route_name', $record->station_route_name ?? '') }}"
                maxlength="50"
                placeholder="{{ __('validation.attributes.station_route_name') }}"
                required>
            <!-- @error('station_route_name')
                <div class="text-danger small">{{ $message }}</div>
            @enderror -->
        </div>
    </div>

    {{-- ▼ 緯度 --}}
    <div class="form-group row">
        <label class="col-sm-2 col-form-label required">近傍駅座標（緯度）</label>
        <div class="col-sm-10">
            <input type="number"
                name="station_latitude"
                class="form-control form-control-lg"
                value="{{ old('station_latitude', $record->station_latitude ?? '') }}"
                step="any"
                maxlength="20"
                placeholder="{{ __('validation.attributes.station_latitude') }}"
                required>
        </div>
    </div>

    {{-- ▼ 経度 --}}
    <div class="form-group row">
        <label class="col-sm-2 col-form-label required">近傍駅座標（経度）</label>
        <div class="col-sm-10">
            <input type="number"
                name="station_longitude"
                class="form-control form-control-lg"
                value="{{ old('station_longitude', $record->station_longitude ?? '') }}"
                step="any"
                maxlength="20"
                placeholder="{{ __('validation.attributes.station_longitude') }}"
                required>
        </div>
    </div>


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

            {{-- 登録ボタン --}}
            @if($isEdit)
                <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)
                <button type="button" id="delete_edit" class="btn btn-lg btn-danger">
                    {{ __('削除') }}
                </button>
            @endif

        </div>
    </div>

</div>
<!-- /.card-body -->
