@php $authStaffDepartment = auth()->user()?->staff?->department; $authStaffDepartmentSlug = $authStaffDepartment?->slug ?? ''; // $isRetentionDepartment = $authStaffDepartmentSlug === 'retention'; $canAddStudent = false; // $canManageInvoices = $isRetentionDepartment; if ($course->schedule_type === 'course') { $canAddStudent = (optional($course->academyProduct)->count_of_students ?? 0) > $course->courseStudent->count(); } elseif ($course->schedule_type === 'track') { $canAddStudent = (optional($course->trackType)->count_of_students ?? 0) > $course->courseStudent->count(); } @endphp
Assigned Students

Manage enrolment, invoices, and payment follow-up for this course.

{{-- @if ($isRetentionDepartment) --}} @can('retention_courses_storeCourseToStudent') @if ($canAddStudent) @endif @endcan {{-- @endif --}}
@foreach ($course_students as $course_student) @php $createdTime = \Carbon\Carbon::parse($course_student->created_at); $allowedHours = $HrSetting->allowed_period_to_pay_invoices; $hoursPassed = abs(\Carbon\Carbon::now()->diffInHours($createdTime)); $invoice = $course_student->finanaceStudentInvoiceId; $transaction = $invoice?->transaction?->first(); $studentName = trim(($course_student->student->first_name ?? '') . ' ' . ($course_student->student->last_name ?? '')); $examAssignments = collect($course_student->examAssignments ?? []); $selectedPackage = ($selectedPackagesByCourseStudentId ?? collect())->get($course_student->id); $currentUserStaff = auth()->user()->staff; $addedByStaff = $course_student->addedBy ? $course_student->addedBy->staff : null; $isPrivileged = false; if ($course_student->added_by == auth()->id()) { $isPrivileged = true; } elseif ($addedByStaff && $currentUserStaff && $addedByStaff->manager_id == $currentUserStaff->id) { $isPrivileged = true; } elseif ($addedByStaff && $addedByStaff->department && $currentUserStaff && $addedByStaff->department->department_head_id == $currentUserStaff->id) { $isPrivileged = true; } elseif ($currentUserStaff && $currentUserStaff->jobTitle && ($currentUserStaff->jobTitle->slug == 'schedule-manager' || $currentUserStaff->jobTitle->sort == 1)) { $isPrivileged = true; } $canDelete = $isPrivileged || (!$invoice ? $hoursPassed > $allowedHours : ($invoice->payment_status != 'paid' && $hoursPassed > $allowedHours)); @endphp
{{ $studentName ?: 'N/A' }} @if ($hoursPassed > $allowedHours && (!$invoice || $invoice->payment_status != 'paid')) Payment window exceeded @endif @if ($course->schedule_type === 'track') @if ($selectedPackage) {{ $selectedPackage->name }} ({{ $selectedPackage->levels_count }} levels) @else No package selected @endif @endif
@if (!$invoice) Loading... {{-- @if ($canManageInvoices) --}} {{-- @endif --}} @elseif($invoice?->payment_status == 'paid') @else @if ($transaction?->payment_type == 'online') Loading... {{-- @if ($canManageInvoices) --}} {{-- @endif --}} @elseif ($transaction?->payment_type == 'instapay') Loading... {{-- @if ($canManageInvoices) --}} {{-- @endif --}} @else {{-- @if ($canManageInvoices) --}} {{-- @endif --}} @endif @endif
Exams: {{ $examAssignments->count() }}
@if($canAssignCourseAssessments ?? false) @else No access @endif
{{-- @if ($isRetentionDepartment) --}} @can('retention_course_students_destroy') @if ($invoice?->payment_status == 'paid') @elseif($canDelete) @else @endif @else - @endif {{-- @else - @endif --}} @endforeach
@include('dashboard.academics.schedule_demo.assing_student_modal' , [ 'route' => route('courses_storeCourseToStudent')]) {{-- @if ($canManageInvoices) --}} @include('dashboard.academics.courses.request_invoice_modal') {{-- @endif --}} @foreach ($course_students as $course_student) @php $isLastStudentInCourse = $course_students->count() <= 1; $studentName = trim(($course_student->student->first_name ?? '') . ' ' . ($course_student->student->last_name ?? '')); @endphp @if($canAssignCourseAssessments ?? false) @endif @endforeach