@extends('layouts.app')

@section('content')
    <div class="container">
        <div class="row">
            <div class="{{ $containerSize }}">
                @include('layouts.alerts')

                <div class="panel panel-default">
                    <div class="panel-heading">
                        <strong>@lang($heading) {{ $customHeading?$singular:'' }}</strong>
                        <div class="pull-right hidden-xs">
                            @lang('Last edit at') {{ $result->updated_at }}
                        </div>
                    </div>
                    {!! Form::open(['route' => [$router . '.update', $objectId], 'method' => 'put', 'class' => 'form-horizontal', 'role' => 'form']) !!}
                    <div class="panel-body">

                        <div class="form-group">
                            {!! Form::label('id', Lang::getFromJson('id'), ['class' => 'col-md-4 control-label']) !!}
                            <div class="col-md-6">
                                {!! Form::text('id', $result->id, [
                                    'class' => 'form-control',
                                    'disabled'
                                ]) !!}
                            </div>
                        </div>

                        @foreach(array_diff($columns, ['id', 'created_at', 'updated_at']) as $column)
                            <div class="form-group">
                                {!! Form::label($column, Lang::getFromJson($column),['class' => 'col-md-4 control-label']) !!}
                                <div class="col-md-6">
                                    {!! Form::text($column, $result->$column, [
                                        'class' => 'form-control',
                                        'autofocus'
                                    ]) !!}
                                </div>
                            </div>
                        @endforeach
                    </div>
                    <div class="panel-footer">
                        <a class="btn btn-default hidden-xs"
                           href="{{ route($router . '.show', $objectId) }}">
                            <i class="glyphicon glyphicon-arrow-left"></i>
                            @lang('Go to Detail')
                        </a>
                        <div class="pull-right">
                            <button type="submit" class="btn btn-primary">
                                @lang('Confirm Update')
                                <i class="glyphicon glyphicon-arrow-right"></i>
                            </button>
                        </div>
                    </div>
                    {!! Form::close() !!}
                </div>
            </div>
        </div>
    </div>
@endsection
