@forelse ($listresults as $index => $item)
@php
// Get user's response
$userResponse = $item->responses->firstWhere('user_id', auth()->id());
$hasResponded = !is_null($userResponse);
// Response colors mapping
$responseColors = [
'accepted' => 'success',
'rejected' => 'danger',
'maybe' => 'warning'
];
// Priority icons mapping
$priorityIcons = [
'high' => 'fa-flag text-danger',
'medium' => 'fa-flag text-warning',
'low' => 'fa-flag text-info'
];
// Audience type mapping with translation
$audienceTypes = [
'staff_training' => __('labels.staff_training'),
'customer_event' => __('labels.customer_event'),
'both' => __('labels.both'),
];
// Audience colors and icons
$audienceColors = [
'staff_training' => 'primary',
'customer_event' => 'info',
'both' => 'success'
];
$audienceIcons = [
'staff_training' => 'fa-users-cog',
'customer_event' => 'fa-handshake',
'both' => 'fa-users'
];
@endphp
|
{{ $index + 1 }}
|
@if($item->logo_path)
 }})
@else
{{ strtoupper(substr($item->title, 0, 2)) }}
@endif
{{ $item->title }}
@if($item->creator)
{{ $item->author_name ?? (auth()->check() ? auth()->user()->name : null) }}
@endif
|
@if(isset($item->audience_type) && array_key_exists($item->audience_type, $audienceTypes))
@php
$audienceType = $item->audience_type;
$audienceLabel = $audienceTypes[$audienceType];
$audienceColor = $audienceColors[$audienceType] ?? 'secondary';
$audienceIcon = $audienceIcons[$audienceType] ?? 'fa-users';
@endphp
{{ $audienceLabel }}
@else
{{ __('labels.not_specified') }}
@endif
|
{{ $item->started_at_iso?->format('d.m.Y') }}
{{ $item->started_at_iso?->format('H:i') }}
|
{{ $item->ended_at_iso?->format('d.m.Y') }}
{{ $item->ended_at_iso?->format('H:i') }}
|
@php
$total = $item->responses_count ?? $item->responses->count();
$accepted = $item->accepted_count ?? 0;
$rejected = $item->rejected_count ?? 0;
$maybe = $item->maybe_count ?? 0;
if ($total > 0) {
$acceptedPercent = ($accepted / $total) * 100;
$rejectedPercent = ($rejected / $total) * 100;
$maybePercent = ($maybe / $total) * 100;
} else {
$acceptedPercent = $rejectedPercent = $maybePercent = 0;
}
@endphp
{{ $accepted }}
{{ $rejected }}
{{ $maybe }}
{{ $total }}
|
@if($hasResponded && $userResponse->response)
@php
$response = $userResponse->response;
$responseClass = $responseColors[$response] ?? 'secondary';
@endphp
{{ ucfirst($response) }}
@if($userResponse->priority)
@endif
@if($userResponse->reason)
{{ Str::limit($userResponse->reason, 20) }}
@endif
@else
{{ __('labels.not_responded') }}
{{ __('labels.please_submit_response') }}
@endif
|
@if($item->published_at)
{{ $item->published_at ? date('d.m.Y', strtotime($item->published_at)) : '' }}
{{ $item->published_at ? date('H:i', strtotime($item->published_at)) : '' }}
{{ __('labels.published') }}
@else
{{ __('labels.draft') }}
@endif
|
@can('view', $item)
@endcan
@can('update', $item)
@endcan
@can('delete', $item)
@endcan
|
@empty