Skip to content

Commit

Permalink
Orders group per day
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccoon254 committed Jun 15, 2024
1 parent a016f92 commit 6ad89d0
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,28 +69,36 @@ class="text-white border border-white p-2 px-4 rounded-lg hover:text-white">View

<div class="orders">
<div class="item overflow-scroll mt-4">
@foreach($orders as $order)
@php
$groupedOrders = $orders->groupBy(function($order) {
return $order->created_at->format('dS M, Y');
});
@endphp

@foreach($groupedOrders as $date => $ordersOnDate)
<div class="day mt-4">
<span class="text-sm text-gray-200">
{{ $order->created_at->format('dS M, Y') }}
{{ $date }}
</span>

<div
class="flex justify-between bg-white bg-opacity-10 p-2 w-full rounded-lg items-center mt-2">
<div class="flex items-center gap-4">
<div class="text-lg w-14 font-semibold text-blue-50">
{{ $order->created_at->format('H:i') }}
</div>
<!-- Vertical Line -->
<div class="w-1 h-10 rounded-lg {{ $order->getStatusClass() }} mx-2 "></div>
<div class="mr-2">
<h4 class="text-lg text-gray-10 font-semibold">{{ $order->title }}</h4>
<p class="text-xs text-ellipsis whitespace-nowrap mr-2">{{ Str::limit($order->description, 25) }}</p>
@foreach($ordersOnDate as $order)
<div
class="flex justify-between bg-white bg-opacity-10 p-2 w-full rounded-lg items-center mt-2">
<div class="flex items-center gap-4">
<div class="text-lg w-14 font-semibold text-blue-50">
{{ $order->created_at->format('H:i') }}
</div>
<!-- Vertical Line -->
<div
class="w-1 h-10 rounded-lg {{ $order->getStatusClass() }} mx-2 "></div>
<div class="mr-2">
<h4 class="text-lg text-gray-10 font-semibold">{{ $order->title }}</h4>
<p class="text-xs text-ellipsis whitespace-nowrap mr-2">{{ Str::limit($order->description, 25) }}</p>
</div>
</div>
</div>
</div>
@endforeach
</div>

@endforeach
</div>
</div>
Expand Down

0 comments on commit 6ad89d0

Please sign in to comment.