@extends('backend.layouts.master')
@section('title')
ProductCategory Listing Page
@endsection
@section('css')

@endsection
<!-- page content -->
@section('content')
<div class="right_col" role="main">
    <div class="">
        <div class="clearfix"></div>
        @if(Session::has('success'))
        <div class="alert alert-success">
            {{ Session::get('success') }}
        </div>
        @endif
        @if(Session::has('error'))
        <div class="alert alert-danger">
            {{ Session::get('error') }}
        </div>
        @endif
        <div class="row">
            <div class="col-md-7 col-sm-7 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>Manage Product Category
                            <!--<a href="{{route('productcategory.create')}}" class="btn btn-xs btn-success">Create Product Category</a>-->
                        </h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="#">Settings 1</a>
                                    </li>
                                    <li><a href="#">Settings 2</a>
                                    </li>
                                </ul>
                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <div class="row search-section">
							<form action="{{route('productcategory.list')}}" id="searchForm" method="Get">
								<div class="col-sm-3">
									<select class="form-control" name="show" id="show">
										<option value="{{$productcategory->count()}}">{{$productcategory->count()}}</option>
										<option value="10">10</option>
										<option value="25">25</option>
										<option value="50">50</option>
										<option value="100">100</option>
										<option value="250">250</option>
										<option value="500">500</option>
									</select>
								</div>
								<div class="col-sm-4"></div>
								<div class="col-sm-5">
									<div class="input-group">
										<input type="text" id="myInput" class="form-control" placeholder="Search">
										<span class="input-group-btn">
											<button type="button" class="btn btn-primary">
											<span class="ace-icon fa fa-search icon-on-right bigger-110"></span></button>
										</span>
									</div>
								</div>
							</form> 
						</div>
                        <table class="table table-responsive table-bordered table-condensed">
                            <thead>
                                <tr class="bg-primary">
                                    <th>SL</th>
                                    <th>Category</th>
                                    <th>Slug</th>
                                    <th>Type</th>
                                    <th>Status</th>
                                    <th>Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $i = 1 ?>
                                @foreach($productcategory as $pc)
                                <tr>
                                    <td>{{$i++}}</td>
                                    <td>{{$pc->name}}</td>
                                    <td>{{$pc->slug}}</td>
                                    <td>{{$pc->ctype->name}}</td>
                                    <td>
                                        @if($pc->status == 1)
                                        <span class="label label-success"> Active </span>
                                        @else
                                        <span class="label label-danger">DeActive</span>
                                        @endif
                                    </td>
                                    <!--<td> {{$pc->created_by}}</td>
                                    <td> {{$pc->modified_by}}</td>-->
                                    <td>
                                        <div class="row">
                                            <div class="col-md-4">
                                                <a href="{{route('productcategory.edit',$pc->id)}}" class="btn btn-xs btn-warning"><i class="fa fa-pencil"></i> </a>
                                            </div>
                                            @can('category-delete')
                                            <div class="col-md-4">
                                                <form action="{{route('productcategory.delete' ,$pc->id)}}" method="post">
                                                    <input type="hidden" name="_method" value="DELETE">
                                                    {{ csrf_field()}}
                                                    <button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('are you sure to delete?')"><i class="fa fa-trash-o"></i> </button>
                                                </form>
                                            </div>
                                            @endcan
                                        </div>
                                    </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                        <div class="text-center">
                            {{$productcategory->links()}}
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-5 col-sm-5 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>
                            <!--<a href="{{route('productcategory.list')}}" class="btn btn-xs btn-success"> Category List</a>-->
                            Category Entry
                        </h2>
                        <ul class="nav navbar-right panel_toolbox">
                            <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="#">Settings 1</a>
                                    </li>
                                    <li><a href="#">Settings 2</a>
                                    </li>
                                </ul>
                            </li>
                            <li><a class="close-link"><i class="fa fa-close"></i></a>
                            </li>
                        </ul>
                        <div class="clearfix"></div>
                    </div>
                    <div class="x_content">
                        <div class="row">
                            <div class="col-sm-3"></div>
                            <div class="col-sm-6">
                                <form action="{{route('productcategory.store')}}" method="post">
                                    {{ csrf_field()}}
                                    <div class="form-group">
                                        <label for="type">Type Name <span class="required" >*</span></label>
                                        <select class="select2 form-control" name="type" >
                                            <option value="" > -- Select-- </option>
                                            @foreach($types as $ty)
                                                <option value="{{$ty->id}}" {{old('type_id') == $ty->id ? 'selected' : ''}} >{{$ty->name}}</option>
                                            @endforeach
                                        </select>
                                        <span class="error"><b>@if($errors->has('type')){{$errors->first('type')}}@endif</b></span>
                                    </div>
                                    <div class="form-group">
                                        <label for="name">Name <span class="required" >*</span></label>
                                        <input type="text" class="form-control" id="name" name="name" placeholder="Enter name">
                                        <span class="error"><b>
                                            @if($errors->has('name')){{$errors->first('name')}}@endif</b>
                                        </span>
                                    </div>
                                    <div class="form-group">
                                        <label for="slug">Slug <span class="required" >*</span></label>
                                        <input type="text" class="form-control" id="slug" name="slug" placeholder="Enter slug">
                                        <span class="error"><b>
                                            @if($errors->has('slug')){{$errors->first('slug')}}@endif</b>
                                        </span>
                                    </div>
                                    <div class="form-group">
                                        <label>Status</label>
                                        <input type="radio" name="status" value="1" id="Active" checked=""><label for="Active"> Active</label>
                                        <input type="radio" name="status" id="deactive" value="0"><label for="deactive">Inactive</label>
                                    </div>
                                    <div class="box-footer">
                                        <button type="submit" name="btnCreate" class="btn btn-primary">Save Productcategory</button>
                                    </div>
                                </form>
                            </div>
                            <div class="col-sm-3"></div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- /page content -->
@endsection

@section('script')

@endsection