@extends('layouts.members')

@section('content')
    <div class="container" style="">
        <div class="card card-primary">
            <div class="panel panel-black">
                <div class="panel-heading">
                    <a href="{{route('member_all_products')}}"><span class="btn btn-raised btn-primary pull-right">All Products</span></a>
                    <hr/>
                    <h3>Create New Product</h3>
                </div>

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

                        <div class="form-group required">
                            <label class="col-sm-2 control-label" for="categoryID">Select Category</label>
                            <div class="col-sm-10">
                                <select name="categoryID" placeholder="select category" id="categoryID"  class="form-control">
                                    <option value="0">
                                        Select Category
                                    </option>
                                    @foreach ($categories as $cat)
                                        <option value="{!! $cat->id !!}">{!! $cat->name !!}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>

                        <div class="form-group required">
                            <label class="col-sm-2 control-label" for="brand_id">Select Brand</label>
                            <div class="col-sm-10">
                                <select name="brand_id" id="brand_id"  class="form-control">
                                    <option value="">
                                        Select Brand
                                    </option>
                                    @foreach ($brands as $brand)
                                        <option value="{!! $brand->id !!}">{!! $brand->name !!}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>


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

                        <div class="form-group required">
                            <label class="col-sm-2 control-label" for="weight">Product Weight</label>
                            <div class="col-sm-10">
                                <input type="text" name="weight" value="" placeholder="Product Weight" id="weight"
                                       class="form-control"/>
                            </div>
                        </div>

                        <div class="form-group required">
                            <label class="col-sm-2 control-label" for="weight">Sales Price</label>
                            <div class="col-sm-10">
                                <input type="number" name="price" value="{{old('price')? old('price'):0.00}}" placeholder="Enter Price" id="price"
                                       class="form-control"/>
                            </div>
                        </div>


                        <div class="form-group required">
                            <label class="col-sm-2 control-label" for="weight">Quantity</label>
                            <div class="col-sm-10">
                                <input type="number" name="quantity"  value="{{old('quantity')? old('quantity'):0}}" placeholder="Enter Quantity" id="quantity"
                                       class="form-control"/>
                            </div>
                        </div>



                        {{--<div id="cp2" class="input-group colorpicker-component" title="Using input value">--}}
                        {{--<input type="text" class="form-control input-lg" value="#DD0F20"/>--}}
                        {{--<span class="input-group-addon"><i></i></span>--}}
                        {{--</div>--}}

                        {{--<input id="html5colorpicker" onchange="clickColor(0, -1, -1, 5)" value="#ff0000"  type="color">--}}



                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="description">Description</label>
                            <div class="col-sm-10">
                            <textarea name="description" placeholder="Description" id="description"
                                      class="form-control"></textarea>
                            </div>
                        </div>


                        <div class="form-group{{ $errors->has('image') ? ' has-error' : '' }}">
                            <label for="image" class="col-md-2 control-label">Product Image</label>
                            <div class="col-md-2" style="border:1px solid #333">
                                <input name="image" class="form-control" type="file" required="required" id="image">
                                <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="" class="img-responsive thumbnail" id="loaded-img"/>
                            </div>
                            <div class="col-md-2">
                                <span id="img-name"></span>
                            </div>
                        </div>
                        {{--<div class="form-group required">--}}
                            {{--<label class="col-sm-2 control-label" for="meta_title">Meta Title</label>--}}
                            {{--<div class="col-sm-10">--}}
                                {{--<input type="text" name="meta_title" value="" placeholder="Meta Tag Title"--}}
                                       {{--id="meta_title" class="form-control"/>--}}
                            {{--</div>--}}
                        {{--</div>--}}
                        {{--<div class="form-group">--}}
                            {{--<label class="col-sm-2 control-label" for="meta_description">Meta Description</label>--}}
                            {{--<div class="col-sm-10">--}}
                            {{--<textarea name="meta_description" rows="5" placeholder="Meta Tag Description"--}}
                                      {{--id="meta_description" class="form-control"></textarea>--}}
                            {{--</div>--}}
                        {{--</div>--}}
                        {{--<div class="form-group">--}}
                            {{--<label class="col-sm-2 control-label" for="keywords">Meta Keywords</label>--}}
                            {{--<div class="col-sm-10">--}}
                                {{--<input type="text" name="keywords" placeholder="Meta Keywords"--}}
                                       {{--id="keywords" class="form-control"/>--}}
                            {{--</div>--}}
                        {{--</div>--}}
                        {{--                   <div class="form-group">
                                            <label class="col-sm-2 control-label" for="input-tag1"><span data-toggle="tooltip" title="Comma separated">Product Tags</span></label>
                                            <div class="col-sm-10">
                                              <input type="text" name="product_tag" value="" placeholder="Product Tags" id="input-tag1" class="form-control" />
                                            </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">Submit</button>
                            </div>

                        </div>

                    </form>

                </div>

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

    </div>


    <div class="form-group">
        <label for="blog_post_body">Post Body
            @if(config("binshopsblog.echo_html"))
                (HTML)
            @else
             (Html will be escaped)
            @endif

        </label>
        <textarea style='min-height:600px;' class="form-control" id="blog_post_body" aria-describedby="blog_post_body_help"
                  name='post_body'></textarea>


        <div class='alert alert-warning'>
            If you want to add HTML content to be rendered, click source button at top left, and then paste your HTML snippet. (Youtube iFrames)
        </div>
    </div>

@endsection

@if( config("binshopsblog.use_wysiwyg") && config("binshopsblog.echo_html"))
    <script src="//cdn.ckeditor.com/4.15.0/full/ckeditor.js"></script>

    <script>
        if( typeof(CKEDITOR) !== "undefined" ) {
            CKEDITOR.replace('post_body');
        }
    </script>
@endif
