{{ __('Task Details') }}

@if (session()->has('message'))
{{ session('message') }}
@endif @php $isOverdue = $task->due_date && now()->gt(\Carbon\Carbon::parse($task->due_date)->endOfDay()) && $task->status !== 'done' && $task->status !== 'completed'; @endphp @if($isOverdue)
⚠️ {{ __('This task is overdue!') }}
@endif
{{ $commentCount }}
{{ __('Comments') }}
{{ $attachmentCount }}
{{ __('Attachments') }}
{{ $assignedUserCount }}
{{ __('Assigned Users') }}
@if($durationInDays !== null)
{{ $durationInDays }}
{{ __('Days to Complete') }}
@else
{{ __('Not completed yet') }}
@endif
@if($task->status != "done" and (auth()->user()->hasRole('Employee') || auth()->user()->hasRole('Admin') || auth()->user()->hasRole('General Manager') || auth()->user()->hasRole('HR Manager')) ) @endif @if($task->status == "leader_review" and (auth()->user()->hasRole('Team Leader') || auth()->user()->hasRole('Admin') || auth()->user()->hasRole('General Manager') || auth()->user()->hasRole('HR Manager'))) @endif @if($task->status == "department_review" and (auth()->user()->hasRole('Unit Supervisor') || auth()->user()->hasRole('Admin') || auth()->user()->hasRole('General Manager') || auth()->user()->hasRole('HR Manager'))) @endif @if($task->status == "administrate_review" and (auth()->user()->hasRole('Head of Department') || auth()->user()->hasRole('Admin') || auth()->user()->hasRole('General Manager') || auth()->user()->hasRole('HR Manager'))) @endif @if($task->status != "completed" and (auth()->user()->hasRole('Head of Department') || auth()->user()->hasRole('Admin') || auth()->user()->hasRole('General Manager') || auth()->user()->hasRole('HR Manager'))) @endif @if($task->status == "completed" and ( auth()->user()->hasRole('Admin') || auth()->user()->hasRole('General Manager') || auth()->user()->hasRole('HR Manager'))) @endif @if($task->status != "completed" and ( auth()->user()->hasRole('Head of Department') || auth()->user()->hasRole('Admin') || auth()->user()->hasRole('General Manager') || auth()->user()->hasRole('HR Manager'))) @endif {{ __('Back to Tasks') }}
{{ __('Title') }}: {{ $task->title }}
{{ __('Category') }}: {{ $task->category->name ?? '-' }}
{{ __('Priority') }}: {{ __(ucwords(str_replace('_', ' ', $task->priority))) }}
{{ __('Status') }}: {{-- الشارة الحالية للقراءة فقط --}} {{ __($task->status) }} {{-- سلكت التغيير يظهر فقط لمن يحق لهم التعديل --}} @php // نستدعي ميثود Livewire مباشرة $allowed = $this->allowedStatusesForCurrentUser(); @endphp @if(!empty($allowed))
@endif
@if($task->project)
{{ __('Project') }}: {{ $task->project->name }}
@endif @if($task->client)
{{ __('Client') }}: {{ $task->client->company_name }}
@endif
{{ __('Created at') }}: {{ $task->created_at }}
{{ __('Start Date') }}: {{ $task->start_date }}
{{ __('Due Date') }}: @if(auth()->user()->hasAnyRole(['Head of Department', 'Unit Supervisor', 'Team Leader','Admin','General Manager','HR Manager']))
@error('due_date')
{{ $message }}
@enderror @else {{ $task->due_date ? \Carbon\Carbon::parse($task->due_date)->format('Y-m-d') : '-' }} @endif
{{ __('Created by') }}: {{ $task->employee?$task->employee->name:'-' }}
{{ __('Assigned Users') }}: @foreach($task->employees as $task_employee) {{$task_employee->name}} @endforeach
{{ __('Mentions') }}: @foreach($task->mentions->unique('id') as $mention_employee) {{$mention_employee->name}} @endforeach
{{ __('Notes') }}:
{!! nl2br($task->description) !!}
@if($task->completed_by)
{{ __('Completed By') }}: {{ $task->completedBy->name }} ({{ $task->completed_at->format('Y-m-d H:i') }})
@endif
@if($task->status === 'done' && !$task->rating)

{{ __('Rate This Task') }}

@foreach (range(1, 5) as $i) @endforeach
@endif @if($task->rating)

{{ __('Rating') }}

@foreach (range(1, 5) as $i) @endforeach ({{ $task->rating }}/5)
@if($task->rating_comment)
"{{ $task->rating_comment }}"
@endif
@endif @if($task->attachments->count())
{{ __('Attachments') }}:
@endif @if($task->is_recurring) {{-- بطاقة التكرار --}}

{{ __('Recurrence') }}

@if($task->is_recurring && $task->recurrence_type !== 'none')
{{ __('Type') }}
{{ ucfirst(str_replace('_',' ', $task->recurrence_type)) }}
{{ __('Repeat every') }}
{{ $task->repeat_every }} @switch($task->recurrence_type) @case('daily') {{ __('day(s)') }} @break @case('weekly') {{ __('week(s)') }} @break @case('monthly') {{ __('month(s)') }} @break @default @endswitch
@if($task->recurrence_type === 'weekly')
{{ __('Week days') }}
@php $map = [1=>__('Mon'),2=>__('Tue'),3=>__('Wed'),4=>__('Thu'),5=>__('Fri'),6=>__('Sat'),7=>__('Sun')]; @endphp {{ collect($task->weekly_days ?? [])->map(fn($d) => $map[$d] ?? $d)->implode(', ') ?: '-' }}
@endif @if($task->recurrence_type === 'monthly')
{{ __('Day of month') }}
{{ $task->monthly_day }}
@endif @if($task->recurrence_type === 'dates')
{{ __('Specific dates') }}
@if(is_array($task->specific_dates) && count($task->specific_dates)) {{ collect($task->specific_dates)->implode(', ') }} @else — @endif
@endif
{{ __('Starts at') }}
{{ optional($task->repeat_starts_at)->toDateString() ?? '-' }}
{{ __('Ends at') }}
{{ optional($task->repeat_ends_at)->toDateString() ?? __('Open') }}
{{ __('Recurrence summary') }}
{{ $task->recurrence_summary ?? '—' }}
{{-- إحصاءات النسخ --}}
{{ __('Generated') }}: {{ $task->childrenRecurrences()->count() }} {{ __('Done') }}: {{ $task->childrenRecurrences()->where('status','done')->count() }} {{ __('Overdue') }}: {{ $task->childrenRecurrences()->where('status','!=','done')->whereDate('due_date','<', now())->count() }}
@elseif($task->is_recurrence_instance)

{{ __('This is a generated instance of recurring task') }} #{{ $task->recurrence_parent_id }}

@else @if($task->is_recurring && is_null($task->recurrence_parent_id)) {{ __('Master') }} @endif @endif
@endif

{{ __('Comments') }}

@if($task->status != "done")
@error('comment') {{ $message }} @enderror
{{ __('No users found') }}
@error('comment_attachments.*') {{ $message }} @enderror
@section("scripts") @endsection @endif @if($task->comments->count())
@foreach($task->comments as $c)

{!! preg_replace('/(@[\x{0600}-\x{06FF}A-Za-z0-9_\-\.\x{00A0}]+)/u', '$1', nl2br(e($c->content))) !!}

{{ $c->user->name ?? __('User') }} – {{ $c->created_at->diffForHumans() }} @if($c->attachments->count())
{{ __('Attachments') }}:
@endif
@endforeach
@endif

{{ __('Timeline') }}

@if($logs && $logs->count()) @else
{{ __('No activity yet.') }}
@endif