@extends('layouts.app')

@section('title', 'Sales')

@section('content')
    <div class="row nomargins">
        <div class="card card-primary">
            <div class="panel panel-black">
                <div class="panel-heading">
                    @if(!Auth::user()->is_admin)
                        <a href="{{route('storeSell', Session('store_id'))}}"
                           class="btn btn-raised btn-primary">Sell</a>
                        <hr/>
                    @endif


                    <h3 class="text-center">{{Session('store_name')}} Sales</h3>
                </div>

                @if(Auth::user()->is_admin)
                    <div class="panel-body" id="sales_load">
                        <form class="form-horizontal" method="POST" action="javascript:void(0);">
                            {!! csrf_field() !!}
                            <div class="form-group">
                                <div class="col-md-5">
                                    <label for="storeID">Stores</label>
                                    <select name="storeID" id="storeID" class="form-control">
                                        <option value="0">All Stores</option>
                                        @foreach($stores as $store )
                                            <option class="selecter-options" value="{{$store->id}}">
                                                {{$store->name}}
                                            </option>
                                        @endforeach

                                    </select>
                                </div>
                            </div>

                        </form>
                        @endif

                        <div class="panel-body sales">
                            @include('sales.load')
                        </div>
                    </div>
            </div>
        </div>
    </div>
@endsection