@extends('layouts.app')

@section('title', 'Inventory List')

@section('content')
<div class="container-fluid">

    <!-- Page Heading -->
    <div class="d-sm-flex align-items-center justify-content-between mb-4">
        <h1 class="h3 mb-0 text-gray-800">Inventory</h1>
        <a href="{{route('productlist.createinventory')}}" class="btn btn-sm btn-primary" >
            <i class="fas fa-plus"></i> Add New
        </a>
    </div>

    {{-- Alert Messages --}}
    @include('common.alert')
   
    <!-- DataTales Example -->
    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary">All Products</h6>
            
        </div>
        <div class="card-body">
      
            <div class="table-responsive">
           
                <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                    <thead>
                    
                        <tr>
                            <th width="20%">PID</th>
                            <th width="20%">Item_Code</th>
                            <th width="20%">UPC</th>
                            <th width="50%">Item</th>
                            <th width="30%">Stock</th>
                            <th width="30%">Currency</th>
                            <th width="30%">Cost</th>
                            <th width="30%">MRP</th>
                            <th width="30%">R_Price</th>
                            <th width="30%">W_Price</th>
                            <th width="30%">Value</th>
                          
                            <th width="20%">Action</th>
                       
                       
                        </tr>
                       
                    </thead>
                   
                    <tbody>

                 
                    
                   
                  
                  

                  
                    @foreach ($products as $row)
                           <tr>
                               <td>{{$row->id}}</td>
                               <td>{{$row->itemcode}}</td>
                               <td>{{$row->upc}}</td>
                               <td>{{$row->item}}</td>
                               <td>{{$row->stockinhand}}</td>
                               <td>{{$row->currency}}</td>
                               <td>{{$row->Cost}}</td>
                               <td>{{$row->mrpprice}}</td>
                               <td>{{$row->rprice}}</td>
                               <td>{{$row->wprice}}</td>
                               <td>{{$row->stockvalue}}</td>
                              
                              
                               <td style="display: flex">
                                   <a href="{{route('productlist.inventoryedit', ['products' => $row->id]) }}" class="btn btn-primary m-2">
                                        <i class="fa fa-pen"></i>
                                   </a>
                                   <!-- <form method="POST" action="{{route('productlist.inventorydestroy', ['id' => $row->id]) }}">
                                        @csrf
                                         @method('DELETE')
                                        <button class="btn btn-danger m-2" type="submit" onclick="return confirm('Sure Want Delete?')">
                                            <i class="fa fa-trash"></i>
                                        </button>
                                       
                                   </form> -->
                                   <a class="btn btn-danger m-2" href="#" data-toggle="modal" data-target="#deleteModal1">
                                            <i class="fas fa-trash"></i>
                                        </a>
                                   <!-- <a class="btn btn-danger m-2" href="#" data-toggle="modal" data-target="#deleteModal1">
                                            <i class="fas fa-trash"></i>
                                        </a> -->
                               </td>
                               
                           </tr>
                       @endforeach
                
                    </tbody>
                </table>
   
              {{$products->links()}}
             
            </div>
           
        </div>
    </div>

</div>
@if ($products->count() > 0 )
@if(isset($products) && !empty($products))

@include('inventroy.delete_inventoryModel')

@endif  
@endif 
@endsection
