@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) {{-- section content --}} @section('content') @include('layouts.navbars.auth.topnav', ['title' => ''])
{{-- Display success or error messages --}} @if (session('success'))
{{ session('success') }}
@elseif (session('error'))
{{ session('error') }}
@endif
List {{ $title_menu }}
{{-- button download word --}}
{{-- Notification --}} @if (Session::has('message')) @endif

@php $groupedData = $hasil->groupBy('id')->map(function ($items) { $totalGdg = $items->sum('gdg'); $totalOff = $items->sum('off'); $count = $items->count(); $average = $count > 0 ? number_format(($totalGdg + $totalOff) / ($count * 2), 2) : 0; return [ 'nama_catering' => $items->first()->nama_catering, // Updated to use nama_catering 'average' => $average, 'id' => $items->first()->id, // Use the first item's ID for actions ]; }); @endphp @foreach ($groupedData as $data) @endforeach
No Nama Catering Rata-Rata Keseluruhan Action
{{ $loop->iteration }} {{ $data['nama_catering'] }} {{ $data['average'] }} {{-- button view --}} {{-- check authorize edit --}} @if ($authorize->edit == '1') {{-- button edit --}} @endif {{-- check authorize delete --}} @if ($authorize->delete == '1')
@csrf @method('DELETE')
@endif
@endsection