@extends('layouts.members')

@section('page_title')
    AllStocks
@endsection
@section('page_category')
    STOCKS
@endsection
<!-- HEADER -->
@section('page_action')
    <!-- Button -->
    <a href="{{ route('member_all_stocks') }}" class="btn btn-primary lift">
        All Stocks
    </a>
@endsection

@section('content')
    <div class="row nomargins">
        <div class="card card-primary">
            <aside class="panel panel-black">
                <div class="panel-heading">
                    <a href="{{route('member_new_stock')}}" class="btn btn-raised btn-primary">New Stock</a>
                    <hr/>
                    <h3 class="text-center">All Stock</h3>
                </div>

                <div class="panel-body">
                    <table class="table table-striped table-bordered table-hover" id="dataTables">
                        <thead>
                        <tr>
                            <th>S/No</th>
                            <th>Product</th>
                            {{--<th>Supplier</th>--}}
                            <th>Cost</th>
                            <th>Sales Price</th>
                            <th>Vat</th>
                            <th>Quantity</th>
                            <th>Expiry</th>
                            <th>Reorder</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>

                        <?php $i = 0; ?>
                        @foreach($stocks as $stock)
                            <tr>
                                <td><?= ++$i; ?></td>
                                <td>{!!$stock->product->name!!}</td>
                                {{--                                <td>{!!$stock->supplier->name!!}</td>--}}
                                <td>{!!$stock->cost_price!!}</td>
                                <td>{!!$stock->sales_price!!}</td>
                                <td>{!!$stock->vat!!}</td>
                                <td>{!!$stock->quantity!!}</td>
                                <td>{!!$stock->expiry_date!!}</td>
                                <td>{!!$stock->reorder_level == null?'Not Set':$stock->reorder_level!!}</td>
                                <td>
                                    <div class="btn-group">
                                        <button type="button" class="btn btn-primary btn-raised">Action</button>
                                        <button type="button" class="btn btn-primary btn-raised dropdown-toggle"
                                                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                            <i class="zmdi zmdi-chevron-down right only"></i>
                                        </button>
                                        <ul class="dropdown-menu dropdown-menu-primary">
                                            <li>

                                                <a href="{{url('admin/stock/'.$stock->id.'/delete')}}" id="delete-btn"
                                                   onclick="return confirm('Are you sure you want to delete the product?')"
                                                   data-action="{{'/product/'.$stock->id.'/delete'}}">Delete</a>
                                            </li>

                                            <li>
                                                <a href="{{url('admin/stock/'.$stock->id)}}">Details</a>
                                            </li>
                                            <li role="separator" class="divider"></li>
                                            <li>
                                            </li>
                                        </ul>
                                    </div>

                                </td>
                            </tr>
                        @endforeach


                        </tbody>

                    </table>
                </div>

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

@endsection




















