@extends('layouts.app')
@section('title', '[東京都|〇〇駐輪場] 駐輪場管理者マスタ')

@section('content')
  @php
    $mid = $record->manager_id ?? ($manager_id ?? null);
  @endphp

  <div class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-lg-6">
          <h1 class="m-0 text-dark">編集</h1>
        </div>
        <div class="col-lg-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="javascript:void(0);">[東京都|〇〇駐輪場]</a></li> -->
            <li class="breadcrumb-item"><a href="{{ route('managers') }}">駐輪場管理者マスタ</a></li>
            <li class="breadcrumb-item active">編集</li>
          </ol>
        </div>
      </div>
    </div>
  </div>

  <section class="content">
    <div class="container-fluid">

      @if ($errors->any())
        <div class="alert alert-danger">
          <ul class="mb-0">@foreach ($errors->all() as $e)<li>{{ $e }}</li>@endforeach</ul>
        </div>
      @endif
      @if(Session::has('success'))
        <div class="alert alert-success alert-dismissible">{{ Session::get('success') }}</div>
      @elseif(Session::has('error'))
        <div class="alert alert-danger alert-dismissible">{!! Session::get('error') !!}</div>
      @endif

      <div class="row">
        <div class="col-lg-12">
          <div class="card p-3">

            {{-- 更新用フォーム --}}
            <form method="post" action="{{ route('managers_edit', ['id' => $mid]) }}">
              @csrf
              @include('admin.managers._form', ['isEdit' => 1, 'isInfo' => 0])

            </form>

            {{-- 削除用フォーム（独立・POST /managers/delete） --}}
            <form action="{{ route('managers_delete') }}" method="post" id="delete_form" class="d-none">
              @csrf
              <input type="hidden" name="pk[]" value="{{ $mid }}">
            </form>

          </div>
        </div>
      </div>

    </div>
  </section>
@endsection
