@extends('layouts.app')

@section('content')
<div class="container-xxl flex-grow-1 container-p-y">

    <div class="card">
        <div class="card-header">
            <div class="row align-items-center">
                <div class="col-md-6">
                    <h5 class="mb-0">Add Expense Category</h5>
                </div>

                <div class="col-md-6 text-end">
                    <a href="{{ route('expense-categories.index') }}" class="btn btn-secondary">
                        Back
                    </a>
                </div>
            </div>
            <hr>
        </div>

        <div class="card-body">
            <form action="{{ route('expense-categories.store') }}" method="POST">
                @csrf

                <div class="mb-3">
                    <label class="form-label">Category Title</label>
                    <input type="text"
                           name="title"
                           value="{{ old('title') }}"
                           class="form-control @error('title') is-invalid @enderror"
                           placeholder="Enter category title">

                    @error('title')
                        <div class="invalid-feedback">
                            {{ $message }}
                        </div>
                    @enderror
                </div>

                <button type="submit" class="btn btn-primary">
                    Save
                </button>

                <a href="{{ route('expense-categories.index') }}" class="btn btn-secondary">
                    Cancel
                </a>
            </form>
        </div>
    </div>

</div>
@endsection