{{ __('Task Details') }}

@if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif @php $isOverdue = $task->due_date && now()->gt(\Carbon\Carbon::parse($task->due_date)->endOfDay()) && $task->status !== 'completed'; @endphp @if($isOverdue)
{{ __('This task is overdue!') }}
@endif @if($task->administrativeCommunication?->canBeViewedBy(auth()->user()))

{{ __('Created from administrative communication') }}

#{{ $task->administrativeCommunication->id }} · {{ $task->administrativeCommunication->subject }}

{{ __('View request') }}
@endif
{{ $commentCount }}
{{ __('Comments') }}
{{ $attachmentCount }}
{{ __('Attachments') }}
{{ $assignedUserCount }}
{{ __('Assigned Users') }}
@if($durationInDays !== null)
{{ $durationInDays }}
{{ __('Days to Complete') }}
@else
{{ __('Not completed yet') }}
@endif
@if($task->status !== 'completed' && $task->canBeClosedBy(auth()->user())) @endif @if($task->status == "leader_review" && $task->canBeClosedBy(auth()->user())) @endif @if($task->status == "department_review" && $task->canBeClosedBy(auth()->user())) @endif @if($task->status == "administrate_review" && $task->canBeClosedBy(auth()->user())) @endif @if($task->status === 'completed' && $task->canBeClosedBy(auth()->user())) @endif @if($task->status !== 'completed' && $task->canBeEditedBy(auth()->user())) @endif {{-- زر تعليم بنجمة --}} {{-- زر تمييز كغير مقروء --}} {{ __('Back to Tasks') }}
@if($showEditModal)

{{ __('Edit Task') }}

@error('edit_title') {{ $message }} @enderror
@error('edit_category_id') {{ $message }} @enderror
@error('edit_project_id') {{ $message }} @enderror
@error('edit_client_id') {{ $message }} @enderror
@error('edit_workflow_template_id') {{ $message }} @enderror @if($task->workflow)

{{ __('The active workflow stays linked to this task. You can update its step duration and assignees below.') }}

@endif @php $editWorkflowSteps = $task->workflow ? $task->workflow->steps : ($workflowEditTemplates->firstWhere('id', (int) $edit_workflow_template_id)?->steps ?? collect()); @endphp @if($editWorkflowSteps->isNotEmpty())
@foreach($editWorkflowSteps as $workflowEditStep) @php $workflowEditStepId = $task->workflow ? $workflowEditStep->task_template_step_id : $workflowEditStep->id; $workflowEditAdministration = $workflowEditStep->administrate_id ?? $workflowEditStep->administrate?->id ?? $task->workflow?->template?->administrate_id; $editStepPrerequisites = $task->workflow ? app(\App\Services\TaskWorkflowService::class)->blockingPrerequisites($workflowEditStep) : collect(); @endphp
{{ $task->workflow ? ($workflowEditStep->title ?: $workflowEditStep->templateStep?->title) : $workflowEditStep->title }} · {{ __('Administration') }}: {{ $workflowEditStep->administrate?->name ?? $workflowEditStep->templateStep?->administrate?->name ?? __('N/A') }}
@error("edit_workflow_overrides.$workflowEditStepId.assignee_ids.*"){{ $message }}@enderror
@if($editStepPrerequisites->isNotEmpty())

{{ __('This step depends on :prerequisite. Complete it before changing its settings.', ['prerequisite' => $editStepPrerequisites->join('، ')]) }}

@endif @error("edit_workflow_overrides.$workflowEditStepId")

{{ $message }}

@enderror
@endforeach
@endif
@error('edit_reminder_days_before') {{ $message }} @enderror
@error('edit_start_date') {{ $message }} @enderror
@error('edit_due_date') {{ $message }} @enderror
@error('edit_description') {{ $message }} @enderror
@endif
{{ __('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 }}
@else
{{ __('Client') }}: {{ __('other') }}
@endif
{{ __('Created at') }}: {{ $task->created_at }}
{{ __('Start Date') }}: {{ $task->start_date }}
{{ __('Due Date') }}: {{ $task->due_date ? \Carbon\Carbon::parse($task->due_date)->format('Y-m-d') : '-' }} @if(auth()->user()->can('tasks edit') || auth()->user()->can('tasks workflow review'))
@error('due_date')
{{ $message }}
@enderror @else {{ $task->due_date ? \Carbon\Carbon::parse($task->due_date)->format('Y-m-d') : '-' }} @endif
{{ __('Reminder Days Before') }}: {{ $task->reminder_days_before ?? 2 }}
{{ __('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}} @if((int) $task->employee_id === (int) auth()->id() && (int) $mention_employee->id !== (int) auth()->id()) @endif @endforeach @if($task->mentions->pluck('id')->contains(auth()->id()) && (int) $task->employee_id !== (int) auth()->id()) @endif
{{ __('Notes') }}:
{!! \App\Support\RichTextSanitizer::forDisplay($task->description) !!}
@if($task->work_state === 'paused' && filled($task->pause_reason))
{{ __('Pause reason') }}:
{{ $task->pause_reason }}
@endif @if($task->completed_by)
{{ __('Completed By') }}: {{ $task->completedBy->name }} ({{ \Carbon\Carbon::parse($task->completed_at)->format('Y-m-d H:i') }})
@endif
@if($task->workflow)

{{ __('Workflow path') }}

{{ $task->workflow->template->name ?? __('Task workflow') }} · {{ __('Workflow steps: :count', ['count' => $task->workflow->steps->count()]) }}

{{ number_format((float) $task->workflow->progress, 0) }}%
@foreach($task->workflow->steps as $workflowStep) @php $step = $workflowStep->templateStep; $stepTitle = $workflowStep->title ?: $step?->title; $stepProgress = $workflowStep->progress(); $assignedUsers = $workflowStep->assignedUsers; if ($assignedUsers->isEmpty() && $workflowStep->assignee) $assignedUsers = collect([$workflowStep->assignee]); $inactiveStepAssignees = $assignedUsers->filter(fn ($user) => $user->status !== 'active'); $canActOnStep = (int) $task->employee_id === (int) auth()->id() || $assignedUsers->isEmpty() || $assignedUsers->contains('id', auth()->id()) || auth()->user()->can('tasks edit') || auth()->user()->can('tasks workflow review'); $canManageStepAssignment = (int) $task->employee_id === (int) auth()->id() || auth()->user()->can('tasks edit') || auth()->user()->can('tasks workflow review'); $returnableWorkflowSteps = app(\App\Services\TaskWorkflowService::class)->returnableSteps($workflowStep); @endphp
{{ $loop->iteration }}
{{ $stepTitle }}
{{ number_format($stepProgress, 0) }}%
@if($workflowStep->description ?: $step?->description)
{{ $workflowStep->description ?: $step?->description }}
@endif
{{ __($workflowStep->status) }} @if($workflowStep->due_at) · {{ \Carbon\Carbon::parse($workflowStep->due_at)->format('Y-m-d') }} @endif @if($workflowStep->delay_days) · {{ $workflowStep->delay_days }} {{ __('delay days') }} @endif · {{ __('Assignees') }}: {{ $assignedUsers->isNotEmpty() ? $assignedUsers->pluck('name')->join('، ') : __('Unassigned') }} @if($workflowStep->administrate?->name ?? $step?->administrate?->name) · {{ __('Administration') }}: {{ $workflowStep->administrate?->name ?? $step?->administrate?->name }} @endif
{{ __('View step details') }}⌄
@if($inactiveStepAssignees->isNotEmpty() && $canManageStepAssignment)

{{ __('An assigned employee is inactive. Choose a replacement to keep this step moving.') }}

{{ $inactiveStepAssignees->pluck('name')->join('، ') }}

@error("workflowStepReplacementUsers.$workflowStep->id"){{ $message }}@enderror
@endif
@if($canActOnStep && $workflowStep->status === 'available')@endif @if($canActOnStep && in_array($workflowStep->status, ['available', 'in_progress']))@endif
@if(in_array($workflowStep->status, ['pending', 'blocked'])) @php $blockingPrerequisites = app(\App\Services\TaskWorkflowService::class)->blockingPrerequisites($workflowStep); @endphp
@if($blockingPrerequisites->isNotEmpty())

{{ __('This step is waiting for: :prerequisites', ['prerequisites' => $blockingPrerequisites->join('، ')]) }}

@else

{{ __('This step is waiting for its prerequisites to be completed.') }}

@endif

{{ __('Start and completion actions will appear when its prerequisites are complete.') }}

@elseif($workflowStep->checklistItems->isEmpty() && in_array($workflowStep->status, ['available', 'in_progress']))

{{ __('This step has no checklist actions. Use Complete step to mark it as finished.') }}

@endif @error("workflowSteps.$workflowStep->id")
{{ $message }}
@enderror @if($canActOnStep && $returnableWorkflowSteps->isNotEmpty() && in_array($workflowStep->status, ['available', 'in_progress', 'completed', 'blocked']))
{{ __('Return this step for rework') }}
@error("workflowStepReturnTargets.$workflowStep->id"){{ $message }}@enderror @error("workflowStepReturnReasons.$workflowStep->id"){{ $message }}@enderror
@endif @if($workflowStep->returnsReceived->isNotEmpty())

{{ __('Returned for rework') }}: {{ $workflowStep->returnsReceived->count() }} {{ __('times') }}

    @foreach($workflowStep->returnsReceived->sortByDesc('created_at') as $stepReturn)
  • {{ $stepReturn->created_at?->format('Y-m-d H:i') }} · {{ $stepReturn->returnedBy?->name ?? __('Unknown') }}@if($stepReturn->reason) — {{ $stepReturn->reason }}@endif
  • @endforeach
@endif @error('checklist')
{{ $message }}
@enderror @if($workflowStep->checklistItems->isNotEmpty())

{{ __('Checklist items') }}

@foreach($workflowStep->checklistItems as $item) @endforeach
@endif

{{ __('Step discussion') }}

@forelse($workflowStep->comments as $stepComment)
{{ $stepComment->user?->name ?? __('Unknown') }}{{ $stepComment->created_at?->format('Y-m-d H:i') }}
{!! \App\Support\RichTextSanitizer::forDisplay($stepComment->content) !!}
@foreach($stepComment->attachments as $commentFile){{ $commentFile->file_name }}@endforeach
@empty

{{ __('No step updates yet.') }}

@endforelse

{{ __('Step attachments') }}

@forelse($workflowStep->attachments as $stepFile) {{ $stepFile->file_name }} @empty

{{ __('No step attachments yet.') }}

@endforelse
@if($canActOnStep)
@error("workflowStepComments.$workflowStep->id"){{ $message }}@enderror
{{ __('No files selected') }}
{{ __('Uploading files...') }}
@error("workflowStepAttachments.$workflowStep->id.*"){{ $message }}@enderror
@endif
@endforeach
@endif @if($task->status === 'completed' && !$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') }}
{{ __($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','completed')->count() }} {{ __('Overdue') }}: {{ $task->childrenRecurrences()->where('status','!=','completed')->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 !== 'completed')
@error('comment') {{ $message }} @enderror

{{ __('selected file(s) will be uploaded after saving the comment.') }}

@error('comment_attachments.*') {{ $message }} @enderror
@if($task->canBeClosedBy(auth()->user())) @endif
@section("scripts") @endsection @endif @if($task->comments->whereNull('workflow_step_id')->count())
@foreach($task->comments->whereNull('workflow_step_id') as $c)
@if ((int) $editingCommentId === (int) $c->id)
@error('editingCommentContent')
{{ $message }}
@enderror
@else
{!! \App\Support\RichTextSanitizer::forDisplay($c->content) !!}
@if ($c->canBeEditedBy(auth()->user())) @endif
{{ $c->user->name ?? __('User') }} – {{ $c->created_at->diffForHumans() }} @if ($c->edited_by) · {{ __('Last edited by :name on :date', [ 'name' => $c->editedBy?->name ?? __('User'), 'date' => \Carbon\Carbon::parse($c->updated_at)->format('Y-m-d H:i'), ]) }} @elseif ($c->updated_at->gt($c->created_at)) · {{ __('Edited') }} {{ \Carbon\Carbon::parse($c->updated_at)->format('Y-m-d H:i') }} @endif @endif @if($c->attachments->count())
{{ __('Attachments') }}:
@endif
@endforeach
@endif

{{ __('Activity Logs') }}

@if($logs && $logs->count())
    @foreach($logs as $log)
  • {{ $log->user->name ?? __('System') }} – @if($log->action === 'task_viewed') {{ __('Task viewed') }} @endif {{ $log->description }} {{ \Carbon\Carbon::parse($log->created_at)->format('Y-m-d H:i') }}
  • @endforeach
@else
{{ __('No activity yet.') }}
@endif