@extends('layouts.members')

@section('content')
    <div class="container">

        <div class="card card-primary">
            <div class="panel panel-black">
                <div class="panel-heading">
                    <a href="{{route('member_all_brands')}}" class="btn btn-raised btn-primary">Brands</a>
                    <hr/>
                    <h3>Edit Brand</h3>
                </div>

                <div class="panel-body">
                    @include('includes.flash')
                    <form class="form-horizontal" method="post" enctype="multipart/form-data"
                          action="{{ route('member_brand_update', $brand->id) }}">
                        {!! csrf_field() !!}


                        <div class="form-group required">
                            <label class="col-sm-2 control-label" for="name">Brand Name</label>
                            <div class="col-sm-10">
                                <input type="text" name="name" value="{{$brand->name}}" placeholder="Brand Name" id="name"
                                       class="form-control"/>
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('image') ? ' has-error' : '' }}">
                            <label for="image" class="col-md-2 control-label">Brand Logo</label>
                            <div class="col-md-2" style="border:1px solid #333">
                                <input name="image" class="form-control" value="{{$brand->logo}}" type="file" required="required" id="image">
                                <input type="hidden" name="logo" value="{{$brand->logo}}" id="logo">
                                <i class="zmdi zmdi-image" style="font-size: 40px; margin-top: 10px; color: #f25f43"></i>
                                @if ($errors->has('image'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('image') }}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="col-md-2">
                                <img src="{{asset('assets/img/brands/'.$brand->logo)}}" class="img-responsive thumbnail" id="loaded-img" />
                            </div>
                            <div class="col-md-2">
                                <span id="img-name"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-2"></div>
                            <div class="col-md-10 ">
                                <button type="submit" class="btn btn-success clear-fix">Update</button>
                            </div>
                        </div>

                    </form>
                </div>

                <div class="panel-footer">
                </div>
            </div>
        </div>
    </div>
@endsection