@if(count($productStockData)>0)
@php $bgColor = ''; $textColor = ''; @endphp
@foreach($productStockData as $key => $row)
@php $currentStock = getCurrentStock($row->id,''); @endphp
@if(isset($row->exp_date))
   @php $expiryDateTime = new DateTime($row->exp_date);
    $today = new DateTime();
    $interval = $today->diff($expiryDateTime);
    $daysDifference = $interval->days;

    if ($daysDifference < 30) 
    {
        $color = "red";
    }
    @endphp
@endif
<tr>
    <td>{!! $key + 1 !!}</td>
    <td>{!! $row->name !!}</td>
    <td>{!! convertDecimelPoint($row->mrp)??'' !!}</td>
    {{-- <td>{!! $row->batch??'N/A' !!}</td>--}}
    <td>{!! $currentStock??0 !!}</td>
    <td style="color:{!! $color??'' !!}">{!! $row->exp_date?date('d-M-Y',strtotime($row->exp_date)) :'' !!}</td>
    <td class="text-center">
        @if(!isset($row->product_short_list_id) && $row->product_short_list_id=='')
        <button type="button" class="btn-warning btn-sm restock" data-product_id="{!! $row->id !!}" data-product_qty="{!! $row->item_min_stock_qty!=0?$row->item_min_stock_qty:10 !!}" title="Restock" ><i class="bi bi-arrow-counterclockwise"></i></button>
        @endif
    </td>
    <td><input type="text" name="re_stock_qty" id="re_stock_qty_{!! $row->id !!}" class="form-control" value="{!! $row->item_min_stock_qty??0 !!}"></td>
</tr>
@endforeach
@else
<tr>
    <td colspan="6" class="text-center"><b>No Data Available.</b></td>
</tr>
@endif