@extends('admin.layouts.app')
@section('title', 'Categories')
@section('content')
<div class="form-container">
    <form action="{{ route('admin.sub_category.store') }}" method="POST" enctype="multipart/form-data">
        @csrf
        <div class="form-group">
            <label for="name">Name</label>
            <input type="text" id="name" name="name" placeholder="SubCategory Name" class="form-control @error('name') is-invalid @enderror" value="{{ old('name') }}" >
            @error('name')
                <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                </span>
            @enderror
        </div>
        <div class="form-group">
            <label for="">Category Name</label>
            <select name="category_id" id="category_id" class="form-control @error('category_id') is-invalid @enderror" value="{{ old('category_id') }}">
                 <option value="">Selected</option>
                 @foreach($categories as $category)
                    <option value="{{ $category->id }}">{{ $category->name }}</option>
                 @endforeach
            </select>
            @error('category_id')
                <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                </span>
            @enderror
        </div>
        <button type="submit" class="btn btn-success"><i class="fas fa-plus-circle"></i> Submit</button>
    </form>
</div>
@endsection

