Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="card-body">
- @if(count($products) > 0)
- <table class="table table-bordered table-hover ">
- <thead>
- <tr>
- <th scope="col" class="text-center"><i class="fas fa-list"></i></th>
- <th scope="col" class="text-center">Suppliers</th>
- <th scope="col" class="text-center">Category</th>
- <th scope="col" class="text-center">Model</th>
- <th scope="col" class="text-center">Products</th>
- <th scope="col" class="text-center">Quantity</th>
- <th scope="col" class="text-center">Price</th>
- <th scope="col" class="text-center"><i class="fas fa-user-cog"></i> Settings</th>
- </tr>
- </thead>
- @foreach($products as $product)
- <tbody>
- <tr>
- <td scope="row" class="text-center">{{ (($products->currentPage() - 1 ) * $products->perPage() ) + $loop->iteration}}</td>
- <td scope="row" class="text-center">{{$product->suppliers['company_name']}}</td>
- <td scope="row" class="text-center">{{$product->category['category']}}</td>
- @if($product->model !== null)<td scope="row" class="text-center">{{$product->model}}</td>@else<td scope="row" class="text-center">Unknown</td>@endif
- <td scope="row" class="text-center">{{$product->products_name}}</td>
- @if($product->quantity <= 20)<td class="text-center" bgcolor="#FF0000">{{$product->quantity}}</td>
- @elseif($product->quantity <= 49)<td class="text-center" bgcolor="#FFFF00">{{$product->quantity}}</td>
- @elseif($product->quantity >= 50)<td class="text-center" bgcolor="#00FF00">{{$product->quantity}}</td>
- @endif
- <td class="text-center">RM {{ number_format($product->unit_price, 2, '.', ',') }}</td>
- <td class="text-center">
- <div class="btn-group mr-2">
- <button class="btn btn-sm btn-secondary"><a href="/products/edit/{{$product->id}}" style="color:white"><i class="fas fa-edit" style="color:white"></i></a></button>
- </div>
- <div class="btn-group mr-2">
- <button class="btn btn-sm btn-danger" data-toggle="modal" data-target="#exampleModal" ><i class="fas fa-trash-alt" style="color:white"></i></button>
- <!-- Modal -->
- <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="exampleModalLabel">Delete Suppliers</h5>
- <button type="submit" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- Are you sure want to delete the product?
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal">No</button>
- <form action="{{ action('ProductsController@destroy', $product->id) }}" method="POST">
- @csrf
- @method('DELETE')
- <button class="btn btn-danger" type="submit">Yes</button>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </td>
- </tr>
- </tbody>
- @endforeach
- </table>
- <div class="btn-group mr-2">
- {{-- {{ (($products->currentPage() - 1 ) * $products->perPage() ) + $loop->iteration }} --}}
- {{ $products->links() }}
- </div>
- <div class="btn-group mr-2">
- <button class="btn btn-sm btn-success"><a href="/products/add" style="color:white"><i class="fas fa-plus style="color:white"></i> New Product</a></button>
- </div>
- @else
- <h5>You have no Products</h5></br>
- <div class="btn-group mr-2">
- <button class="btn btn-sm btn-success"><a href="/products/add" style="color:white"><i class="fas fa-plus style="color:white"></i> New Product</a></button>
- </div>
- @endif
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement