@extends('user-panel.layouts.master') @section('title', 'دوره ها') @section('content') @if ($authUser->field == null && $authUser->grade == null) @endif

لیست پرونده های مالی

{{-- @foreach ($authUser->payments()->whereStatus('paid')->get() as $payment) --}} @foreach ($paymentItems as $item) @php $payment = $item->payment; $course = $item->course; if ($course->is_package == 1) { $installments = $payment ->installments() ->whereHas('installment', function ($q) { $q->whereHas('course', function ($qu) { $qu->whereIsPackage(1); }); }) ->get(); } else { $installments = $payment->installments; } @endphp
@foreach ($installments as $key => $payIns) @php $ins = $payIns->installment; $prevUserIns = null; $userIns = $authUser->installments()->where(['installment_id' => $ins->id, 'payment_id' => $payment->id, 'status' => '1']); // if($payIns->id == 2366){ // dd($userIns ); // } $prevIns = App\Models\Installment::where('course_id', $ins->course_id) ->where('id', '<', $ins->id) ->orderByDesc('id') ->first(); if ($prevIns) { $prevUserIns = $authUser ->installments() ->wherePaymentId($payment->id) ->whereInstallmentId($prevIns->id) ->whereHas('payment', function ($q) { $q->whereStatus('paid'); }) ->first(); } @endphp
{{ ++$key }} - {{ $payIns->id }}
{{ $ins->title }}
@if ($existsIns = $authUser->installments()->whereInstallmentId($ins->id)->first()) {{ number_format($existsIns->amount) }} تومان @else {{ number_format($ins->price) }} تومان @endif
@if ($userIns->exists()) @elseif(($prevUserIns && $prevUserIns->status == '0') || (!$prevUserIns && $prevIns)) @else
@csrf
@endif
@endforeach
@endforeach {{-- @endforeach --}}
@endsection