@extends('layouts.app')
@section('title', '新規')

@section('content')
<div class="content-header">
  <div class="container-fluid">
    <div class="row mb-2">
      <div class="col-sm-6">
        <h1 class="m-0 text-dark">新規登録</h1>
      </div>
      <div class="col-sm-6">
        <ol class="breadcrumb float-sm-right text-sm">
          <li class="breadcrumb-item"><a href="{{ route('home') }}">ホーム</a></li>
          <li class="breadcrumb-item"><a href="{{ route('jurisdiction_parkings') }}">管轄駐輪場</a></li>
          <li class="breadcrumb-item active">新規登録</li>
        </ol>
      </div>
    </div>
  </div>
</div>

<section class="content">
  <div class="container-fluid">
    <form action="{{ route('jurisdiction_parkings_add') }}" method="POST">
      @csrf
      <div class="card p-4">
        <div class="row mb-3">
          <label class="col-md-2 col-form-label">管轄名<span class="text-danger">*</span></label>
          <div class="col-md-10">
            <input type="text" name="jurisdiction_parking_name" class="form-control" value="{{ old('jurisdiction_parking_name') }}" placeholder="管轄名を入力">
          </div>
        </div>

        <div class="row mb-3">
          <label class="col-md-2 col-form-label">オペレーターID</label>
          <div class="col-md-10">
            <select name="operator_id" class="form-control">
              <option value="">選択してください</option>
              @foreach($operators as $id => $name)
                <option value="{{ $id }}" {{ old('operator_id') == $id ? 'selected' : '' }}>{{ $name }}</option>
              @endforeach
            </select>
          </div>
        </div>

        <div class="row mb-3">
          <label class="col-md-2 col-form-label">駐輪場ID</label>
          <div class="col-md-10">
            <select name="park_id" class="form-control">
              <option value="">選択してください</option>
              @foreach($parks as $id => $name)
                <option value="{{ $id }}" {{ old('park_id') == $id ? 'selected' : '' }}>{{ $name }}</option>
              @endforeach
            </select>
          </div>
        </div>

        {{-- 下部登録ボタン --}}
        <div class="mb-3">
          <button type="submit" class="btn btn-success btn-lg mt-3" onclick="return confirm('登録してよろしいですか？')">登録</button>
        </div>

      </div>
    </form>
  </div>
</section>
@endsection