@extends("layouts.members")
@section('page_title')
    REQUISITION
@endsection
@section('page_category')
    All Requests
@endsection
<!-- HEADER -->
@section('page_action')
    <!-- Button -->
    <a href="{{ route('member_new_requisition') }}" class="btn btn-primary lift">
        New Request
    </a>
@endsection

@section('content')
    <div class="container-fluid">
        {{--<div class="row">--}}
        <div class="row">
            <div class="col-12">
                <!-- Goals -->
                <div class="card">
                    <div class="card-header">
                        <div class="row align-items-center">
                            <div class="col">
                                <!-- Title -->
                                <h4 class="card-header-title">
                                    Purchases
                                </h4>

                            </div>
                            <div class="col-auto">
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    Today
                                </a>
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    Last 7 Days
                                </a>
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    All
                                </a>
                                <!-- Button -->
                                <a href="#!" class="btn btn-sm btn-white">
                                    Export
                                </a>
                            </div>
                        </div> <!-- / .row -->
                    </div>
                    <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>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-project">
                                        SN
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-project">
                                        Product
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-project">
                                        Quantity
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-status">
                                        Unit
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-progress">
                                        Date
                                    </a>
                                </th>
                                <th>
                                    <a href="#" class="text-muted list-sort" data-sort="goal-progress">
                                        Status
                                    </a>
                                </th>
                                <th></th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody class="list">
                            <?php $n=1; ?>
                            @forelse($requisitions as $request)
                                <tr>
                                    <td class="goal-project">
                                        {{$n++}}
                                    </td>
                                    <?php $product = $request->product;  ?>
                                    <td class="goal-project">
                                        {{$product[0]->name}}
                                    </td>
                                    <td class="goal-project">
                                        {{$request->quantity}}
                                    </td>
                                    <td class="goal-project">
                                        {{$request->unit}}
                                    </td>
                                    <td class="goal-project">
                                        {{$request->created_at}}
                                    </td>
                                    <td class="goal-project">
                                        {{$request->status ==0? 'Pending':'issued'}}
                                    </td>

                                    <td class="text-right">
                                        <div class="dropdown">
                                            <a href="#" class="dropdown-ellipses dropdown-toggle" role="button"
                                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                <i class="fe fe-more-vertical"></i>
                                            </a>
                                            <div class="dropdown-menu dropdown-menu-right">
                                                <a href="#!" class="dropdown-item">
                                                    Details
                                                </a>
                                                <a href="#!" class="dropdown-item">
                                                    Edit
                                                </a>
                                                <a href="#!" class="dropdown-item">
                                                    Delete
                                                </a>
                                            </div>
                                        </div>
                                    </td>

                                </tr>
                            @empty
                                <h6>No Purchase Record Available</h6>
                            @endforelse
                            </tbody>
                        </table>
                    </div>
                </div>

            </div>
        </div> <!-- / .row -->
    </div>

@endsection