@extends('layouts.app')
@section('content')
<?php

?>
<div class="pcoded-content">
    <div class="pcoded-inner-content">

        <div class="main-body">
            <div class="page-wrapper">
                <!-- Page-header start -->
                <div class="page-header card page-body">
                    <div class="row align-items-end">
                        <div class="col-lg-8">
                            <div class="page-header-title">
                                <i class="icofont icofont icofont icofont-file-document bg-c-pink"></i>
                                <div class="d-inline">
                                    <h4>Sub-County</h4>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4">
                            <div class="page-header-breadcrumb">
                                <ul class="breadcrumb-title">
                                    <li class="breadcrumb-item">
                                        <a href="index.html">
                                            <i class="icofont icofont-home"></i>
                                        </a>
                                    </li>
                                    <li class="breadcrumb-item"><a href="#!">Location</a>
                                    </li>
                                    <li class="breadcrumb-item"><a href="#!">Sub-County</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                        <hr>
                        <div class="row">
                            <div class="col-sm-12">
                                @if (session('success_message'))
                                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                                        {{ session('success_message') }}
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                    </div>
                                @endif

                                @if (session('error_message'))
                                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                                        {{ session('error_message') }}
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                    </div>
                                @endif

                                @if ($errors->any())
                                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                                        <ul class="mb-0">
                                            @foreach ($errors->all() as $error)
                                                <li>{{ $error }}</li>
                                            @endforeach
                                        </ul>
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                    </div>
                                @endif

                                <form method="POST" action="<?= url('/location/sub-county/store') ?>">
                                    @csrf
                                    <div class="form-group row">
                                        <label class="col-sm-2 col-form-label">Name</label>
                                        <div class="col-sm-10">
                                            <input type="text" name="name" class="form-control" placeholder="Sub-County Name">
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-sm-2 col-form-label">Code</label>
                                        <div class="col-sm-4">
                                            <input type="text" name="code" class="form-control" placeholder="Sub-County Code">
                                        </div>
                                        <label class="col-sm-2 col-form-label">District</label>
                                        <div class="col-sm-4">
                                           <select name="districts_id" class="form-control" required="required">
                                               <option value=""> Select One</option>
                                               @foreach($districts as $district)
                                                   <option value="{{ $district->id }}">{{ $district->name }}</option>
                                               @endforeach
                                           </select>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-sm-2 col-form-label">Notes</label>
                                        <div class="col-sm-10">
                                            <textarea rows="5" cols="5" class="form-control" placeholder="Details"></textarea>

                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label class="col-sm-10 col-form-label"></label>
                                        <button type="submit" class="col-sm-2 btn btn-primary">Submit</button>
                                    </div>
                                </form>
                            </div>
                        </div>

                </div>
                <!-- Page-header end -->
            </div>
        </div>
        <div id="styleSelector">

        </div>
    </div>
</div>
@endsection
