@extends('layouts.app')

@section('title')
  Dashboard
@endsection

@section('admin-content')
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>Edit Region</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="{{ route('dashboard.index') }}">Dashboard</a></li>
                        </li>
                    </ol>
                </div>
            </div>
        </div>
    </section>
    <section class="content">
        <div class="container-fluid">
            <div class="card card-primary card-outline">
                <div class="card-body">
					<form method="POST" action="{{ route('admin.region.update', $region->id) }}">
                        @csrf
                        @method('PUT')
                        @include('backend.layouts.partials.messages')
                        <div class="mb-3">
                            <label class="form-label">Pilih Kepala Region</label>
                            <select class="form-control" name="head_id">
                                <option value="">Pilih Kepala Region</option>
                                @foreach ($users as $user)
                                    <option value="{{ $user->id }}" {{ $region->head_id == $user->id ? 'selected' : '' }}>{{ $user->name }} | {{ $user->email }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">Code Region</label>
                            <input type="text" class="form-control" name="code" value="{{ $region->code }}">
                        </div>
                        <div class="mb-3">
                            <label class="form-label">Nama Region</label>
                            <input type="text" class="form-control" name="name" value="{{ $region->name }}">
                        </div>
                        <button type="submit" class="btn btn-primary">Save</button>
					</form>
                </div>
            </div>
        </div>
    </section>
@endsection
