@php $projectOptions = $projects->mapWithKeys(fn ($project) => [$project->id => $project->name])->toArray(); $clientOptions = $clients->mapWithKeys(fn ($client) => [$client->id => $client->name ?: $client->company_name ?: $client->client_code])->toArray(); $clientsForTaskProject = filled($project_id) ? $clients->where('project_id', $project_id) : $clients; $taskClientOptions = $clientsForTaskProject->mapWithKeys(fn ($client) => [$client->id => $client->name ?: $client->company_name ?: $client->client_code])->toArray(); $categoryOptions = $categories->mapWithKeys(fn ($category) => [$category->id => $category->name])->toArray(); $hasAdvancedFilters = filled($searchFilter) || filled($filter_project_id) || filled($filter_client_id) || filled($filter_employee_id) || filled($filter_category_id) || filled($filter_priority) || filled($filter_start_date) || filled($filter_due_date) || filled($filter_last_comment_from) || filled($filter_last_comment_to); @endphp

@if($mounted_status != 'need_action')

{{ __('Tasks') }}

@if($this->canCreateTask()) @endif @canany(['task categories create', 'task categories edit', 'task categories delete']) @endcan @can('export excel') @endcan @can('export pdf') @endcan {{ __('Tasks board') }}
@endif @if (session()->has('message'))
{{ session('message') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{-- أزرار النطاق --}}
{{-- أزرار النجمة وحالة القراءة --}}
{{-- زر الفلترة بالمعلمة بنجمة --}} {{-- فلاتر القراءة: الكل / غير مقروء / مقروء --}}
{{-- نطاق زمني: اليوم / الأسبوع / الشهر --}}
{{-- زر لمسح المدى الزمني (رجوع للوضع العادي) --}} {{-- Today --}} {{-- This Week --}} {{-- This Month --}}
{{-- أزرار سريعة للحالات --}}
{{-- All الكل --}} {{-- غير مكتملة (الافتراضي) --}} {{-- To Do --}} {{-- In Progress --}} {{-- Completed --}} {{-- Overdue (متأخرة) --}}
@if($showEmployeeList)
{{ __('All Employees') }}
{{ __('No results') }}
@endif
@forelse($tasks as $task) @php $employeeNames = $task->employees->pluck('name')->join('، '); @endphp @php $workflowSteps = $task->workflow?->steps ?? collect(); $currentWorkflowStep = $workflowSteps->firstWhere('status', 'in_progress') ?? $workflowSteps->firstWhere('status', 'available') ?? $workflowSteps->firstWhere('status', 'blocked') ?? $workflowSteps->firstWhere('status', 'pending') ?? $workflowSteps->last(); $currentWorkflowAdministration = $currentWorkflowStep?->administrate?->name ?? $currentWorkflowStep?->templateStep?->administrate?->name; @endphp @empty @endforelse
# {{ __('Project') }} {{ __('Title') }} {{ __('Unread') }} {{ __('Due Date') }} {{ __('Status') }} {{ __('Priority') }} {{ __('Employees') }} {{ __('Workflow progress') }} {{ __('Current step') }} {{ __('Current administration') }} {{ __('Comments') }} {{ __('Last Comment By') }} {{ __('Last Comment Time') }} {{ __('Actions') }}
{{ $loop->iteration + ($tasks->currentPage() - 1) * $tasks->perPage() }} {{ optional($task->project)->name }}
@if($task->is_draft) @else {{ \Illuminate\Support\Str::limit($task->title, 55) }} @endif
{{ $task->due_date ? \Carbon\Carbon::parse($task->due_date)->format('Y-m-d') : '-' }} @if($task->is_draft)
{{ __('Draft') }}
@else
{{ __($task->status) }}
@if($task->status === 'completed') @else @if($task->work_state === 'paused' && filled($task->pause_reason)) @endif @if(in_array($task->work_state,['active','near_completion','paused'])) @endif @endif
@endif
{{ __(ucwords(str_replace('_', ' ', $task->priority))) }}
{{ $employeeNames ? \Illuminate\Support\Str::limit($employeeNames, 45) : '-' }}
@if($task->workflow)
{{ number_format((float) $task->workflow->progress, 0) }}%
@else - @endif
@if($task->workflow)
{{ $currentWorkflowStep?->title ?: $currentWorkflowStep?->templateStep?->title ?: '-' }}
@if($currentWorkflowStep)
{{ __($currentWorkflowStep->status) }}
@endif @else - @endif
{{ $currentWorkflowAdministration ?: '-' }} {{ $task->comments_count }} {{ $task->latestComment?->user?->name ?? '-' }} {{ $task->latestComment?->created_at ?? $task->created_at }} @if($task->is_draft) @else @if($task->status !== 'completed' && $task->canBeEditedBy(auth()->user())) {{ __('Edit') }} @endif @can('tasks delete') {{ __('Delete') }} @endcan {{ __('Task Details') }} @php $allowedStatuses = $this->allowedStatusesForTask($task); @endphp @if($task->status !== 'completed' && !empty($allowedStatuses))
@endif @endif
{{ __('No tasks found.') }}
{{ $tasks->links() }}
@if($showModal)

@error('title') {{ $message }} @enderror
@error('category_id') {{ $message }} @enderror
{{ __('Loading workflow template') }} @error('template_id') {{ $message }} @enderror @if($hasWorkflow)

{{ __('This workflow is linked to the task. You can change the duration and assigned employees of its steps.') }}

@foreach($workflowEditSteps as $runtimeStep)
{{ $runtimeStep->title ?: $runtimeStep->templateStep?->title }} · {{ __('Administration') }}: {{ $runtimeStep->administrate?->name ?? __('N/A') }}
@endforeach
@elseif($template_id && count($workflow_overrides))

{{ __('You can adjust the default duration and assignee for this task without changing the template.') }}

@foreach($workflow_overrides as $stepId => $override) @php $templateStep = $templates->firstWhere('id', $template_id)?->steps->firstWhere('id', $stepId); @endphp @if($templateStep)
{{ $templateStep->sort_order }}. {{ $templateStep->title }} · {{ $templateStep->administrate?->name ?? __('N/A') }}
@endif @endforeach
@endif @if(auth()->user()->can('tasks edit') || auth()->user()->can('tasks workflow review')) @endif
@if($showProjectsList)
{{ __('Loading') }} @error('project_id') {{ $message }} @enderror
@endif @if($showClientsList)
@error('client_id') {{ $message }} @enderror
@endif
@if(auth()->user()->can('tasks assign employees') and $showEmployeeList)
@endif
@error('start_date') {{ $message }} @enderror
@error('due_date') {{ $message }} @enderror
@error('reminder_days_before') {{ $message }} @enderror

{{ __('Set how many days before the task date the reminder should be sent.') }}

@if($canAssignEmployees || !$isEditMode)
@unless($canAssignEmployees)

{{ __('Tasks can only be assigned to you with your current permissions.') }}

@endunless @error('assigned_users') {{ $message }} @enderror
@endif
@error('description') {{ $message }} @enderror
@error('attachments.*') {{ $message }} @enderror
@if(!$isEditMode || $editingDraft)

{{ __('Remove attachments before saving a draft; upload them when publishing the task.') }}

@endif
@foreach($existing_attachments as $file) @endforeach
{{-- تكرار المهمة --}}
{{ __('Loading') }}

{{ __('days') }}

{{ __('weeks') }}

{{ __('months') }}

{{-- weekly --}}
@php $days = [ 1 => __('Mon'), 2 => __('Tue'), 3 => __('Wed'), 4 => __('Thu'), 5 => __('Fri'), 6 => __('Sat'), 7 => __('Sun'), ]; @endphp @foreach($days as $num => $name) @endforeach
@error('weekly_days') {{ $message }} @enderror
{{-- monthly --}}
@error('monthly_day') {{ $message }} @enderror

{{ __('Example: 25 => every month on 25th') }}

{{-- specific dates (اختياري) --}}
@foreach(($specific_dates ?? []) as $idx => $d)
@endforeach

{{ __('Choose how the task behaves when it repeats') }}

@if(!$isEditMode || $editingDraft) @endif
@endif

{{ __('Pause Task') }}

@if($showTemplateModal)

{{ __('Create workflow template') }}

{{ __('Define reusable steps, owners, durations, visibility, and dependencies.') }}

@error('template_name') {{ $message }} @enderror
@error('template_description') {{ $message }} @enderror
@foreach($workflow_steps as $index => $step)

{{ __('Step') }} {{ $index + 1 }}

@if(count($workflow_steps) > 1) @endif
@error("workflow_steps.$index.administrate_id") {{ $message }} @enderror
@error("workflow_steps.$index.title") {{ $message }} @enderror
@error("workflow_steps.$index.duration_days") {{ $message }} @enderror
@error("workflow_steps.$index.assignee_ids") {{ $message }} @enderror @error("workflow_steps.$index.assignee_ids.*") {{ $message }} @enderror
@if($index > 0)
@error("workflow_steps.$index.depends_on") {{ $message }} @enderror
@error("workflow_steps.$index.depends_on_checklist_items") {{ $message }} @enderror
@endif

{{ __('Checklist items') }}

@foreach($step['checklist_items'] ?? [] as $itemIndex => $item)
@error("workflow_steps.$index.checklist_items.$itemIndex.title") {{ $message }} @enderror
@endforeach
@endforeach
@endif
\n