@extends('layouts.members')

@section('content')
    <div class="container">
        <div class="card card-primary">
            <aside class="panel panel-default">
                <div class="panel-heading">
                    <a href="{{route('member_new_product')}}" class="btn btn-raised btn-primary">New Product</a>
                    <a href="{{route('member_all_categories')}}" class="btn btn-raised btn-primary">Categories</a>

                    <hr/>
                    <h3 class="text-center">All Products</h3>
                </div>

                <div class="panel-body">
                    @include('includes.flash')
                    <div class="table-responsive mb-0"
                         data-list="{&quot;valueNames&quot;: [&quot;goal-project&quot;, &quot;goal-status&quot;, &quot;goal-progress&quot;, &quot;goal-date&quot;]}">
                        <table class="table table-sm table-nowrap card-table">
                            <thead>
                            <tr>
                                <th>S/N</th>
                                <th>Name</th>
                                <th>Description</th>
                                <th>Quantity</th>
                                <th>Price</th>
                                <th>Image</th>
                                <th>Action</th>
                            </tr>
                            </thead>
                            <tfoot>
                            <tr>
                                <th>S/N</th>
                                <th>Name</th>
                                <th>Description</th>
                                <th>Quantity</th>
                                <th>Price</th>
                                <th>Image</th>
                                <th>Action</th>

                            </tr>
                            </tfoot>
                            <tbody>
                            <?php $i = 0; ?>
                            @foreach($products as $prod)
                                <tr>
                                    <td><?= ++$i; ?></td>
                                    <td>{!!$prod->name!!}</td>
                                    <td>{!!$prod->description. ' '. $prod->description!!}</td>
                                    <td>{!!$prod->quantity!!}</td>
                                    <td>
                                        {!! number_format($prod->price, 2) !!}</td>
                                    <td>
                                        <img src="{{asset('uploads/products/thumbImage/'.$prod->image)}}" alt="images"
                                             style="max-width:100px;" class="responsive thumbnail">
                                    </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 class="">
                                                    <a href="{{route('member_edit_product', $prod->id)}}">Edit</a>
                                                </li>
                                                <li>

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

                                                <li>
                                                    <a href="{{url('member/products/'.$prod->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>
    </div>

@endsection