@extends('layouts.app')

@section('content')
    {{--<form method="POST" action="{{ route('categories.store') }}">--}}
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-10">
                <div class="card">
                    <div class="card-header" style="float: left">Categories</div>
                    <div class="card-body">
                        <form method="POST" action="{{ route('category.store') }}">
                            {{ csrf_field() }}
                            @foreach($categories as $category)
                                <div class="form-group row">
                                    <label for="category" class="col-md-4 col-form-label text-md-right">{{$category->id}}</label>
                                    <div class="col-md-6">
                                        <input id="category" type="text" class="form-control" name="{{$category->id}}" value="{{$category->title}}">

                                        @if ($errors->has('caption'))
                                            <span class="invalid-feedback">
                                        <strong>{{ $errors->first('caption') }}</strong>
                                    </span>
                                        @endif
                                    </div>
                                </div>
                            @endforeach
                            <button id='updateAll' type="submit" hidden class="btn btn-primary col-md-12">
                                UpdateCategories
                            </button>
                        </form>
                    </div>
                    <div class="card-header border-top" >
                        Add new category <span class="glyphicon glyphicon-download"></span>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection
