<script>
    $(document).ready(function () {
        $('#underwriting-search-results').dataTable({
            dom: 'lBfrtip',
            buttons: [
                { extend: 'excel', className: 'download-buttons' },
            ]
        });
    });
    var o = document.getElementsByClassName("or");
    for (var i = 0; i < o.length; i++) {
        o[i].innerHTML = (i+1)+".";
    }
</script>
<style>
    #underwriting-search-results th, td {
        text-align: left;
        padding: 5px;
    }
    #underwriting-search-results tr:hover {background-color: #d4d8f8;}

    #underwriting-search-results tr:nth-child(even) {
        background-color: #e3e2e2;
    }
    [data-href] { cursor: pointer; }
</style>



<div style="text-align: center">Search Engine Results:</div>
<div class="guestDetails_inputDivider"></div>
@if($item != null)
    <table id="underwriting-search-results" style="width:100%; border-collapse: collapse">
        <thead>
        <tr style="background-color: #a1b5d3">
            <th>No</th>
            <th>Item Name</th>
            <th>Min Selling Price</th>
            <th>Allowed Selling Price</th>
            <th>Current Stock</th>
            <th>Created By</th>
            <th>Date Created</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td class="or" style="border-bottom: 2px solid black"></td>
            <td style="border-bottom: 2px solid black"><b class="error">{!! $item->name !!}</b></td>
            <td style="border-bottom: 2px solid black"><b class="error">{!! $item->min_selling_price !!}</b></td>
            <td style="border-bottom: 2px solid black"><b class="success">{!! $item->max_selling_price !!}</b></td>
            <td style="border-bottom: 2px solid black"><b>{!! $item->itemInventory ? $item->itemInventory->sum('quantity') : 0 !!}</b></td>
            <td style="border-bottom: 2px solid black">
                @if($item->user)
                    {!! $item->user->firstName." ".$item->user->lastName !!}
                @else
                    -
                @endif
            </td>
            <td style="border-bottom: 2px solid black"><b> {!! date('d/m/Y H:i:s a',strtotime($item->created_at)) !!}</b></td>
        </tr>
        </tbody>
    </table>
@else
    <div style="text-align: center"><p class="error"><b>No Results Found! Please Check your Input Value</b></p></div>
@endif
