Skip to content

Commit

Permalink
Merge pull request bagisto#9132 from jitendra-webkul/master
Browse files Browse the repository at this point in the history
Fixed order datagrid items count issue
  • Loading branch information
jitendra-webkul authored Dec 12, 2023
2 parents 03e0164 + 7da2ba3 commit 477a16f
Showing 1 changed file with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<div class="flex gap-[6px]">
@php
$maxVisibleItems = 3;
$items = $order->items->take($maxVisibleItems);
$restCount = max($order->items->count() - $maxVisibleItems, 0);
$restCount = max($order->items->count() - 3, 0);
@endphp

@foreach ($items as $item)
@php
$imageCount = $item->product?->images->count();
@endphp

@foreach ($order->items->take(3) as $item)
<div class="relative">
<div class="w-full h-[60px] max-w-[60px] max-h-[60px] relativerounded-[4px]">
@if ($imageCount > 0)
<div class="w-full h-[60px] max-w-[60px] max-h-[60px] relative rounded-[4px]">
@if ($item->product?->images->count() > 0)
<img
class="w-full h-full rounded-[4px]"
src="{{ $item->product->base_image_url }}"
>
<span class="absolute bottom-[1px] ltr:left-[1px] rtl:right-[1px] text-[12px] font-bold text-white bg-darkPink rounded-full px-[6px]">{{ $imageCount }}</span>

<span class="absolute bottom-[1px] ltr:left-[1px] rtl:right-[1px] text-[12px] font-bold text-white bg-darkPink rounded-full px-[6px]">
{{ $item->qty_ordered }}
</span>
@else
<div class="w-full h-[60px] max-w-[60px] max-h-[60px] relative border border-dashed border-gray-300 dark:border-gray-800 rounded-[4px] dark:invert dark:mix-blend-exclusion">
<img src="{{ bagisto_asset('images/product-placeholders/front.svg') }}">
Expand All @@ -31,14 +28,13 @@ class="w-full h-full rounded-[4px]"
</div>
@endforeach

@if ($restCount >= 1)
<a href="{{ route('admin.sales.orders.view', $order->id) }}">
<div class="flex items-center w-[65px] h-[65px] bg-gray-50 dark:bg-gray-800 rounded-[4px]">
<p class="text-[12px] text-gray-600 dark:text-gray-300 text-center font-bold px-[6px] py-[6px]">
@lang('admin::app.sales.orders.index.datagrid.product-count', ['count' => $restCount])
</p>
</div>
</a>
@endif
</div>
@if ($restCount >= 1)
<a href="{{ route('admin.sales.orders.view', $order->id) }}">
<div class="flex items-center w-[65px] h-[65px] bg-gray-50 dark:bg-gray-800 rounded-[4px]">
<p class="text-[12px] text-gray-600 dark:text-gray-300 text-center font-bold px-[6px] py-[6px]">
@lang('admin::app.sales.orders.index.datagrid.product-count', ['count' => $restCount])
</p>
</div>
</a>
@endif
</div>

0 comments on commit 477a16f

Please sign in to comment.