@extends('Employee.layout') @section('title',"Dashboard") @section('page-name',"Hello ".$employee['name']) @section('page-detail',"Welcome Back!") @section('pagelink', 'dashboard') @section('body')
@if (!empty($employee['image'])) Employee Image @else
{{ strtoupper(substr($employee['name'], 0, 2)) }}
@endif @php // Query emoji assignments - tenant_id can be Admin ID or SuperAdmin ID $latestEmoji = \App\Models\EmojiAssignment::with('emoji') ->where('assignable_id', $employee['employee_id']) ->where('assignable_type', 'App\Models\Employee') ->whereIn('tenant_id', $adminIds ?? [$employee['tenant_id']]) ->orderBy('created_at', 'desc') ->first(); @endphp @if($latestEmoji)
@if($latestEmoji->emoji->type === 'emoji') {{ $latestEmoji->emoji->emoji_text }} @else {{ $latestEmoji->emoji->name }} @endif
@endif

Hello {{ $employee['name'] }}! @if($latestEmoji) {{ $latestEmoji->emoji->type === 'emoji' ? $latestEmoji->emoji->emoji_text : '' }} @endif

Welcome back to your dashboard

{{ $employee['category'] }} • {{ $employee['role'] }}
@if(isset($assignedEmojis) && $assignedEmojis->count() > 0)
Your Assigned Emojis & GIFs
Special emojis and GIFs assigned to you
@foreach($assignedEmojis as $assignment)
@if($assignment->emoji->type === 'emoji') {{ $assignment->emoji->emoji_text }} @else {{ $assignment->emoji->name }} @endif
{{ $assignment->emoji->name }}
@if($assignment->message)

{{ $assignment->message }}

@endif {{ $assignment->created_at->format('M d, Y') }}
@endforeach
@endif

Your Progress in : {{$employee['category']}}

@if($targets->isEmpty())

No Record to Show

@else
@foreach($targets as $target) @endforeach
Name & Product Your Contribution Total Points You Gained
@if($target->custom == null)
{{$target->name ?? 'No Query'}}
@else
{{$target->custom}}
@endif
@php $claim = $claims->filter(function ($item) use ($target) { return $item->target_id == $target->id; }); if ($claim->isEmpty()) { $percent['value'] = 0; $percent['status'] = "Completed"; } else { $firstClaim = $claim->first(); // Get the first matching record $redeemed = $firstClaim->redeemed_points ?? 0; // Ensure it exists $quantity = $firstClaim->quantity ?? 1; // Avoid division by zero $percent = calculatePercentage($redeemed, $quantity); if ($percent['value'] > 100) { $percent['value'] = 100; } } @endphp
{{$percent['value']}}% {{$percent['status']}}
{{ $target->quantity }} pts {{ $redeemed ?? "0" }} pts
@endif

Updated at: {{$currentDate}}

Redeemed Points

Overall Points

Redeemed Points

Pending Points

Redeemed Points

@if($points->isEmpty())

No Claimed Points to Show

@else
@foreach($points as $point) @if($point->custom == null) @else @endif @endforeach
VIN# Target/Product Points Claimed Date Status
{{ $point->vin_no }}{{ $point->name }}{{ Str::limit($point->custom, 50) }}{{ $point->points }} {{ \Carbon\Carbon::parse($point->created_at)->format('m-d-y') }} @if($point->status === 'Redeemed') Redeemed @elseif($point->status === 'Rejected') Rejected @else Pending @endif
@endif
@endsection @section('custom-scripts') @endsection